
Proof-of-Concept-Reproduktion eines nginx-Heap-Overflows und eines Informationslecks (CVE-2026-42533) mit zwei Angriffsflächen, Debug-Analyse und einer vollständigen RCE-Kette.
nginx (0.9.6–1.30.3 / mainline ≤1.31.2) Pre-Authentifizierungs-Heap-Overflow + Informationsleck in der komplexen Wert-Skript-Engine; CVSS 9.2. Dieselbe Grundursache hat zwei Angriffsflächen: HTTP (Regex-location + Regex-map) und stream (ssl_preread + SNI + Regex-map).
Eine eingehende technische Analyse und Errata finden Sie in ANALYSIS.md.
.
├── ANALYSIS.md # 深度分析(根因 / 两遍执行 / 动态证据 / RCE 链路 + 勘误)
├── README.md # 本文件(索引)
├── http/ # ① HTTP 变体黑盒复现(classmethod 触发面)
│ ├── nginx.conf # 漏洞配置(regex location + regex map)
│ ├── docker-compose.yml # nginx:1.30.3(vuln,:8081) vs 1.30.4(fixed,:8082)
│ ├── test.sh # clobber / overflow / leak 三方向测试
│ └── repro.py # PoC,自动提取泄漏的堆指针/残留数据
├── debug/ # ② HTTP 变体 debug 构建 + pwndbg/gdb 动态分析
│ ├── Dockerfile(.buster) / docker-compose.yml(.buster) / nginx.debug.conf
│ ├── gdb.py # 两遍执行追踪 + LEN/VALUE 不一致告警(核心)
│ ├── attach.sh / extract-symbols.sh / trace_one.sh
│ ├── recon/ # 堆布局侦察脚本(recon.py / recon2/4/5.py)
│ └── README.md # 详见该目录
└── stream-rift/ # ③ stream 变体完整 RCE 链(已复现 echo pwned)
├── Dockerfile / docker-compose.yml / nginx.conf / server.py / entrypoint.sh
├── poc.py # 完整链(泄漏→喷射→伪造 pool→system),技术来自公开披露
└── README.md # 归属声明 + 运行说明
debug/src,debug/symbols*,debug/logs*werden vonextract-symbols.shgeneriert (DWARF-Binärdatei + Quellbaum), sind in.gitignoreaufgenommen und können neu erstellt werden.
cd http
docker compose up -d # 1.30.3(vuln) + 1.30.4(fixed)
./test.sh # 三方向对比
python3 repro.py --vuln http://localhost:8081 --fixed http://localhost:8082 # 解析泄漏
cd debug
docker compose build && docker compose up -d # debug 构建(--with-debug + DWARF)
./extract-symbols.sh # 拉二进制+源码到本机供 gdb
./attach.sh # gdbserver 附着 worker(:2333)
gdb -x gdb.py # pwndbg 加载;c 后从宿主发请求
Weitere Details finden Sie in debug/README.md.
echo pwned > /tmp/pwn)cd stream-rift
docker compose build && docker compose up -d # nginx 1.31.1 (jammy/glibc2.35)
python3 poc.py --host 127.0.0.1 --port 29443 --leak # 泄漏 heap/libc/system
python3 poc.py --host 127.0.0.1 --port 29443 --cmd 'echo pwned > /tmp/pwn'
docker compose exec nginx-rce cat /tmp/pwn # → pwned(属主 nobody = worker)
Die Technik stammt aus der öffentlichen Offenlegung DepthFirstDisclosures/Nginx-Rift; Details in stream-rift/README.md.
| Auswirkung | HTTP-Variante | Stream-Variante |
|---|---|---|
| Informationsleck (Heap/PIE + Restdaten) | ✅ stabil | ✅ stabil |
| DoS (Worker-Abbruch) | ✅ stabil | ✅ stabil |
| Beliebige Codeausführung | ❌ Kein öffentlicher PoC (eigenständiges Projekt) | ✅ reproduziert (stream-rift/) |
Die vollständige Stream-Kette funktioniert auf modernem glibc 2.35 (ohne Lockerung der Mitigationen): Das Cleanup-Dispatching läuft vor dem free() in ngx_destroy_pool, und system() wird vor dem Abbruch ausgeführt. Zuverlässigkeit „teilweise“ (Heap-Feng-Shui, Einzelschuss trifft etwa 1–2 Mal, Wiederholungen erforderlich); Offsets sind auf diesen Build gepinnt.
Docker + Compose; lokal gdb (+ pwndbg, auf die von dir bevorzugte Weise geladen); pip install requests (http/repro.py).