Node2Shell — CVE-2026-111497 independent reproduction lab

Out-of-bounds write in the Brotli decoder's internal input buffer · Brotli C library 1.0.3–<1.0.10, 1.1.0–<1.1.1, 1.2.0–<1.2.1 · fixed in 1.0.10 / 1.1.1 / 1.2.1 and Node.js 22.23.4 / 24.22.1 / 26.12.1. Everything below is measured on local builds of Brotli 1.2.0 and 1.2.1, not quoted from third-party tooling.

trigger ✓ reproduced OOB write ✓ reproduced (16 B past the 8-byte buffer) pointer control ✗ unreachable (ceiling: offset 98) RCE ✗ not reproduced DoS ✓ 100 % CPU spin, one call never returns patch A/B ✓ −17 FORMAT_BLOCK_SWITCH

1 · The trigger

why draining a 2²⁴ counter needed a zero-cost command

The bug fires when a block-length counter reaches 0 while the meta-block declared only one block type. BrotliDecoderStateMetablockBegin() resets every counter to 2²⁴ at the start of each meta-block, so the drain has to happen inside one meta-block — and a negative meta_block_remaining_len is rejected by WriteRingBuffer, so the drain may not cost anything. A static-dictionary copy whose transform returns 0 does exactly that: BrotliTransformDictionaryWord() returns idx (bytes written), not the transformed length, and transform 34 (OMIT_FIRST_4, empty affixes) returns 0.

/* per command: insert 0, copy 4, explicit distance */
pos += len;                          /* +0  */
s->meta_block_remaining_len -= len;   /* -0  */
--s->block_length[1];                 /* the counter we are draining */
--s->block_length[2];                 /* ...and the distance counter too  */
animation is time-scaled; the real loop runs 16 777 216 iterations

block_length[1] — drained

block_length[1]16 777 216 commands issued0 bits consumed0 B

what the drain must not touch

meta_block_remaining_len1 · unchanged output produced0 B pos / max_distance0 / 0
parametervaluewhy
transform34OMIT_FIRST_4, empty prefix and suffix → returns 0 for a 4-byte word
copy length4i ≥ 4 is required to enter the dictionary word path
distance34818= ((34 ≪ 10) + 1) + 1, pins transform_idx at 34 while max_distance is 0
distance postfix3alphabet 400; spreads each extra bit over 8 distances → 11 bits per command
commands2²⁴ × 11 bit= 23 068 672 bytes of payload, enough to drain exactly once
MLEN1nothing is produced, so nothing is consumed

2 · Where the write actually lands

the write index is the buffer_length field — but the ceiling is not

An attacker byte at index i lands at decoder-state offset 72 + i. BROTLI_FAST_INPUT_SLACK = 28 means both fill loops only run while fewer than 28 input bytes remain, so at most 27 bytes are ever written. Drag the slider — this is the measured behaviour, not a sketch.

24 B
write 3F at index 8 so the next index becomes 64
ceiling · 27 B
04488 132176
input buffer (8 B) buffer_length (write index) live decoder fields pointers written by the OOB padding

verdict for N = 24

the three pointer fields, as measured

before → after the OOB write
ringbuffer     0x51b000000080 → 0x51b000000080
ringbuffer_end 0x51b000000480 → 0x51b000000480
htree_command  0x521000002908 → 0x521000002908

3 · Vulnerable vs patched — same bytes, same chunking

the payload is byte-identical; only the decoder differs

Brotli 1.2.0 — vulnerable


      

Brotli 1.2.1 — patched


      

4 · The window that mattered

fixed upstream in February, released in October
8 months unreleased
2026-02-27
fix committed
0ed4268
2026-10-21
1.0.10 / 1.1.1 / 1.2.1
Node 22.23.4 · 24.22.1
2026-10-22
CVE published
+ Imperva post

The release that carried the fix added no regression test and no CHANGELOG entry, so the malformed-stream shape had to be reconstructed from the code — which is what the payload generator in this repo does.

readingNVD / CNANode.jsImperva
severity9.2 CRITICALHIGHHIGH
reported by—OpenAI Codex Security
(Khai Tran, Sylvie Mayer)
Matteo Collina
fixed by—mcollina, aduh95Antoine du Hamel