CVE-2026-111497 (Node2Shell): investigation report and exploit development
Technical report: we rebuilt the out-of-bounds write in the Node.js Brotli decoder from the fix diff, proved arithmetically why no fuzzer would find the trigger, developed our own exploitation route (static-dictionary ghost commands), and demonstrate in real terminal recordings the three consequences: memory exfiltration over HTTP, denial of service on the official binary, and the RCE chain to system().
On October 21, 2026, Node.js fixed CVE-2026-111497: an out-of-bounds write in the C Brotli decoder embedded in the binary, with denial-of-service, memory disclosure and remote code execution impact. Imperva demonstrated RCE on the official build and called the exploitation “not deterministic”. None of the public analyses explained the complete path.
This report documents what we did with our own means: reconstruction of the flaw from the diff (our lab code is byte-for-byte Node 24.22.0’s deps/brotli — verified by direct comparison), a fuzzing campaign of ~770 thousand cases that empirically confirmed what arithmetic already stated, the development of a previously unpublished exploitation route of our own, and validation of the three consequences in real terminal recordings. We are not publishing the payload generator.
First, Brotli: what it is and where it lives
Brotli is the compression format Google launched in 2013 as gzip’s successor on the web. Same role — turning an HTTP response into fewer bytes — with 15 to 25% better compression. It is the Content-Encoding: br that browsers, CDNs and APIs negotiate by default over HTTP/2 and HTTP/3; it is what compresses your page fonts and your webhook bodies.
And here is the CVE’s starting point: Node.js does not implement this decoder in JavaScript. It compiles Google’s original C code (deps/brotli) into its own binary. Every Node application carries a C decoder in-process — even if nobody ever wrote “brotli” anywhere. All it takes is a middleware accepting compressed request bodies, or a fetch() receiving a compressed response, for data from someone we don’t trust to reach that C code.
How the format works — the minimum needed for the flaw
A Brotli file is a sequence of meta-blocks. Each meta-block declares in its header its size (MLEN) and, for each of the three data categories — literals, commands and distances — how many block types exist (NBLTYPES). Those numbers tell the decoder how the content is organized: if NBLTYPES = 1, the whole category is a single block and there will never be a block switch in it; if it is 2 or more, the decoder will read, mid-content, “block switches” — instructions that change the current type and renew a counter of how many items still fit in the current block.
Inside the meta-block everything is a command: “insert N literals” followed by “copy M bytes from up to M positions back” (the same idea as LZ77). And the copies have a second origin: a static dictionary embedded in the format itself — a fixed vocabulary of common web words — whose entries may go through transformations (uppercasing, prefix cuts, suffix cuts). Everything is bit-packed with Huffman codes, read in order, with no byte alignment.
How the decoder reads this arriving in pieces
The data does not arrive whole: it arrives in chunks, the way the network delivers it. The decoder keeps state across calls and, when bits run out mid-read, must tell the caller “send me more data” and hold the leftover to resume later. For that leftover there is an internal 8-byte buffer — the format was designed so that 64 bits always suffice to continue. Distinguishing “not enough bits” (transient; the caller should send more) from “this stream is invalid” (permanent; the caller should reject) is the most important decision the decoder makes on every chunk.
The flaw: two cases became one
That is precisely the distinction that breaks. The function processing block switches, DecodeBlockTypeAndLength(), returned BROTLI_FALSE for two opposite cases: “I don’t have enough bits” (transient) and “the stream asked for a block switch in a category declared NBLTYPES = 1” — impossible, a permanent error. The caller’s BROTLI_SAFE macro translates any FALSE as NEEDS_MORE_INPUT. Faced with a stream that drains the block counter without having declared switch types, the decoder never rejects: it parks “waiting for more data” forever.
In the parked state, the leftover of every subsequent chunk is appended to the 8-byte buffer with no verification at all — the copy-tail copies everything the caller delivers (while (*available_in) { s->buffer.u8[s->buffer_length] = *next_in++; ... }). The only protection is a BROTLI_DCHECK, disabled in production builds. The overflowing bytes land on neighboring fields of the state struct: buffer_length (+80), pos — the ring-buffer write position (+88), distance limits (+96/+104), ringbuffer_mask, and further out the pointers ringbuffer (+136) and metadata_start_func (+720), a callback the decoder invokes.
The trigger no fuzzer would find
Now the hard part: how do you drain a category’s block counter when NBLTYPES = 1? The decoder resets those counters every meta-block to 2^24, and conventional arithmetic prevents draining them: every command consumes from the MLEN (capped at 2^24) the literals inserted plus the copy length — and since every copy produces at least 2 output bytes, Σ(insert+copy) ≤ 2^24 never drains a 2^24 counter. No syntactically reasonable stream gets there. We confirmed it with ~770 thousand structured fuzzing cases — parameter sweeps, blind mutation, mutation of official encoder corpus, full random grammar: zero occurrences of the trigger state. It is also why OSS-Fuzz never found the flaw in nearly ten years: its Brotli fuzzer does not do chunked streaming, and the bug only exists in the multi-call flow.
The route we developed reads the format the way an adversary would — and returns precisely to the static dictionary described above. There is a transform (OMIT_FIRST_4 with empty prefix and suffix — index-49 strings, the implicit \0 at the end of kPrefixSuffix) whose result has length zero. A command with insert=0 and a copy resolving to that transform consumes no MLEN, advances no output, yet decrements the block counter: a ghost command. It takes 2^24 of them — ~29 MB, the stream body a 7-byte pattern repeated 4,194,304 times — to zero the counter with NBLTYPESI=1. The next command fires the impossible switch. This route is 100% stream; the Oct 26 public PoC uses a 13-byte trigger that depends on hand-writing a decoder field to activate the condition.
Two limits that shape all exploitation
Measured in our lab: the 28-byte barrier (BROTLI_FAST_INPUT_SLACK) — in the parked state, any single chunk of 28 or more bytes makes the decoder’s fast path spin without consuming a bit, in an infinite loop (the DoS vector we will demonstrate). And the optimization-level effect: on unoptimized builds, the byte landing on buffer_length corrupts the index itself and jumps the write to any struct offset (the RCE path); on optimized builds the counter lives in a register and corruption stays linear. That difference separates public demonstrations (lab builds) from exploitation of the official binary — and is the most likely explanation for Imperva’s “not deterministic”.
The three proofs
Real terminal recordings (asciinema, converted to GIF): timing, typing and output are from the actual execution, unedited.
1. Memory exfiltration over HTTP
A server with the vulnerable decoder accepts uploads with Content-Encoding: br and keeps sessions in memory. Alice authenticates; a second user, with no credentials at all, sends the 29 MB stream. The decoder’s pos field is overwritten (value 0x4000); the output routines start reading past the ring buffer (~1.5 KB allocation) and deliver process memory as “decompressed content” in the HTTP response — in the recording, the session token read from the heap appears in the attacker’s curl. The stream’s legitimate output is empty: everything that comes out is memory.

Real session recording — interactive version (play/pause, selectable text): asciinema.org/a/EpV3Z34QmZ9DSF1k
The corrupted size vs. prev_size glibc abort at the end is the other face of the same overflow: the WrapRingBuffer with the corrupted-pos size writes ~15 KB into a 1.5 KB buffer.
2. Denial of service on the official binary
Binaries from nodejs.org, same payload. On 24.22.0 (unpatched), the decoder enters the fast-path infinite loop: the process stops responding and never terminates — the timeout is what kills it (exit 124). Each attack leaves one Node pool thread at 100% CPU; four parallel uploads exhaust the pool and the application stops for every user. On 24.22.1 (patched), the same stream dies in milliseconds with ERR__ERROR_FORMAT_BLOCK_SWITCH — the error created by the patch.

Real session recording — interactive version: asciinema.org/a/P1xOBoPmFrTAiyQB
3. RCE chain to system()
With the write primitive (the buffer_length jump on unoptimized builds), we overwrite metadata_start_func (+720) with system() and metadata_callback_opaque (+736) with the command; a 7-byte metadata meta-block in the stream fires the callback. It is the same chain as the Oct 26 public PoC — reproduced and audited here, including struct offsets confirmed via offsetof. The final 16 pointer bytes use a lab shortcut (direct write): delivering them 100% via stream is the open frontier, detailed below.

Real session recording — interactive version: asciinema.org/a/RUd6YttdN2GrYvGW
In the recording: [1] ringbuffer = 0xdeadbeefdeadbeef — write primitive with value control, 100% via stream; [2] the output of id; uname -a executed by the hijacked decoder; [3] pos = 0x13371337 — second controlled field.
Where this work fits the state of the art
| Chain piece | Imperva | Public PoC 10/26 | This work |
|---|---|---|---|
| CVE condition 100% via stream | undisclosed | no (13-byte trigger + hand-written field) | yes — ghost commands, 29 MB |
| Write primitive via stream | undisclosed | yes (unoptimized build) | yes, and characterized across -O0 vs -O2 |
| Controlled disclosure | mentioned | no | yes — heap token in the HTTP response |
| Differential on official binary | RCE (non-deterministic) | not executed | proven DoS; leak physics mapped |
system() chain | undisclosed | yes, with shortcut | reproduced and audited |
The open frontier: the 16 bytes that hijack the callback pointer require a choreography of chunks up to 27 bytes alternating decoder state (num_block_types[1] between 1 and 2, toggling the CVE condition) — described by the public PoC’s author as “works but requires careful sequencing” and never published in execution. On leaking third-party credentials: the initial window (the first KB allocated after the ring buffer) covers what the attacking request and the decoder itself allocated; other logins’ passwords live in other allocator blocks — we tested login bodies of 45 B, 2 KB, and the exact ring-buffer size, and the neighborhood did not line up. It is probability, not impossibility: fine heap grooming, the same step as the choreography.
The fix
The upstream patch (commit 0ed4268a, cherry-picked into Node as 8c5debbea4) removes the boolean ambiguity:
if (max_block_type <= 1) {
- return BROTLI_FALSE; /* "send more data" */
+ return BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH; /* "invalid stream" */
}
The function now returns a three-way code (success / need data / permanent error), and the new BROTLI_SAFE_WITH_STATUS macro propagates errors instead of swallowing them — including on the fast path, which previously discarded the return. Detail: code -17 takes the slot the enum had kept reserved since 2017 — the case was known, just never reported.
Patch: Node.js 22.23.4 / 24.22.1 / 26.12.1+; Bun 1.4.4+; native Brotli 1.2.1 / 1.1.1 / 1.0.10. The fix had existed upstream since 2026-02-27 with no advisory — an eight-month window for direct library consumers. Containment: reject Content-Encoding: br on request bodies at the proxy, express.json({ inflate: false }), cap body sizes. Detection: Node processes at high single-thread CPU after handling compressed content; giant, highly repetitive Brotli bodies; on patched systems, a spike of ERR__ERROR_FORMAT_BLOCK_SWITCH indicates probing.
Timeline
| Date | Event |
|---|---|
| 2026-02-27 | Commit 0ed4268a fixes the flaw in Brotli, no public advisory. |
| 2026 | OpenAI Codex Security reports to Node.js (HackerOne 4107681). |
| 2026-10-21 | Node.js 22.23.4 / 24.22.1 / 26.12.1 among ten CVEs. |
| 2026-10-22 | First public PoC (deliberately weakened build). |
| 2026-10-23 | Imperva: RCE on the official build, “not deterministic”. |
| 2026-10-26 | Public C PoC (stream primitive + RCE with shortcut) — audited in this report. |
Conclusion
The barrier protecting the decoder was arithmetic — and arithmetic can be proved. That is what 770 thousand fuzzing cases could not tear down, and what an adversarial reading of the format did: a length-zero transform in the static dictionary turned “impossible” into “29 MB”. The three recordings above are the result, reproducible line by line.
For defenders: your Node compiles C nobody reviews along with the application — a boolean with two meanings and an assertion disabled in production were enough, and eight months separate the silent commit from the patch. For researchers: the open frontier is the final chunk choreography; it will only fall to those who do the complete homework.
Sources
- Node.js — October 21, 2026 Security Releases
- Fix in google/brotli (0ed4268a) · Cherry-pick in nodejs/node (8c5debbea4)
- Imperva — Node2Shell: From Brotli Data to Remote Code Execution
- Strobes — HTTP2Shell: Brotli RCE in Node.js and Python
- Sysdig — Detecting the Node.js Brotli RCE
- Aikido · Qualys · HeroDevs
- Related from Gila: HTTP2Shell — the vector beyond Node.js