A heap buffer overflow in Brotli's decode.c allows unauthenticated remote attackers to corrupt decoder state memory via a crafted compressed stream, enabling RCE in Node.js and all other affected consumers.
// PLAIN ENGLISH VERSION
A Hidden Trap in Compressed Files
A widely used software tool that helps compress and decompress data on the internet has a serious flaw that attackers are already taking advantage of. This tool, called Brotli, works invisibly behind the scenes on millions of websites and apps. When it receives a specially crafted compressed file, it can be tricked into breaking down completely.
Think of it like a moving company that has a strict weight limit for its boxes. If someone secretly overloads a box just beyond what the company expects, the shelf holding all the boxes collapses and damages everything around it. That is exactly what happens here: a malicious file overloads a specific area of computer memory, causing surrounding data to be corrupted.
When that memory corruption happens, an attacker can use the chaos to run their own malicious code on your system. This works without needing a password or any special access. If you are running a server or application that processes compressed web content, you could be vulnerable right now.
This is especially dangerous because the flaw exists across many different platforms and programming environments, including Node.js applications that power countless websites and business tools.
Here are three specific steps non-technical readers should take right now
- Contact whoever manages your website, server, or business software and ask them directly whether they have updated Brotli and any Node.js applications to the latest available versions this week.
- If you run your own website through a hosting provider, log into your control panel and check for any pending software updates, then apply them immediately.
- Sign up for security alert emails from your software vendors or hosting company so you receive future warnings like this one before attackers can reach you.
Want the full technical analysis? Click "Technical" above.
Buffer Overflow · CVE-2026-111497 · CRITICAL
Brotli Decoder Heap Layout Attack Flow
google/brotli 1.0.3–1.2.0 · c/dec/decode.c · Remote Unauthenticated
①Delivery — Crafted Brotli-Compressed Stream
A remote unauthenticated attacker sends a specially crafted Brotli-compressed byte stream to any service that decompresses Brotli content (e.g. a Node.js server or any application linking the library).
▼
②Heap Layout Before Overflow — Decoder Buffers Allocated
The decoder in c/dec/decode.c allocates an output ring-buffer on the heap; adjacent heap chunks hold sensitive decoder state (Huffman tables, context maps, ring-buffer metadata).
[ output_buf | N bytes ][ decoder_state | M bytes ]
<-- controlled --> <-- adjacent target -->
▼
③Overflow — Bounds Check Bypassed in decode.c
The crafted stream causes the decoder to write more bytes than the allocated output buffer can hold; the missing or incorrect bounds check in decode.c allows writes to overflow into the adjacent heap chunk.
[ output_buf | N bytes | OVERFLOW→→→ ][ decoder_state CORRUPTED ]
▼
④Corruption — Adjacent Decoder State Overwritten
Attacker-controlled bytes overwrite adjacent decoder state memory, corrupting Huffman table pointers or ring-buffer length fields, enabling either an out-of-bounds read (info disclosure) or further controlled writes.
▼
⑤Impact Path A — DoS or Memory Disclosure
Corrupted state causes a crash (denial of service) or, if an OOB read is triggered before the crash, leaks sensitive heap contents back to the attacker through the decompressed output stream.
▼
⑥Impact Path B — Potential Arbitrary Code Execution
If a function pointer or vtable inside the corrupted adjacent chunk is overwritten with an attacker-supplied address, the decoder's next internal call may redirect execution, potentially achieving arbitrary code execution.
Mitigation:
Update to google/brotli ≥ 1.0.10 / 1.1.1 / 1.2.1 and Node.js ≥ 24.22.1. Actively exploited in the wild.
Vulnerability Overview
CVE-2026-111497 is a heap buffer overflow in the Brotli compressed-data decoder, located in c/dec/decode.c, affecting all platforms running Google Brotli versions 1.0.3 through 1.2.0. An unauthenticated remote attacker can deliver a specially crafted Brotli-compressed stream — over HTTP, WebSocket, or any other transport that accepts Brotli-encoded content — causing the decoder to write past the boundary of an output or ring-buffer allocation. The resulting corruption can leak adjacent heap contents, crash the decoder process, or, under controlled heap layout conditions, redirect code execution. The bug is confirmed actively exploited in the wild and is listed on the CISA Known Exploited Vulnerabilities (KEV) catalog. Any software that decompresses Brotli data without first validating stream fidelity is affected, including Node.js (which bundles its own Brotli copy) and the Python binding library brotlicffi.
Root cause: The Brotli decoder in c/dec/decode.c advances an output write pointer based on a back-reference length field decoded from the stream without sufficiently bounding it against the remaining allocated output buffer size, allowing attacker-controlled length values to produce an out-of-bounds write into adjacent heap memory.
Affected Component
Library: libbrotlidec / libbrotlicommon — the reference C implementation of the Brotli decompression algorithm maintained at google/brotli.
Vulnerable file: c/dec/decode.c (the monolithic decoder translation unit).
Affected version ranges (NVD CPE):
- google/brotli ≥ 1.0.3, < 1.0.10
- google/brotli ≥ 1.1.0, < 1.1.1
- google/brotli ≥ 1.2.0, < 1.2.1
- nodejs/node.js ≥ 23.0.0, < 24.22.1
- nodejs/node.js ≥ 25.0.0, < 26.12.1
- python-hyper/brotlicffi (all versions linking the vulnerable libary)
Brotli is the RFC 7932 general-purpose lossless compression codec widely deployed as HTTP Content-Encoding: br. It is bundled directly into Node.js (deps/brotli/) rather than dynamically linked, meaning the Node.js binary itself carries the vulnerable decoder and any HTTP server or client built on Node.js that accepts Brotli responses is an attack surface.
Root Cause Analysis
The Brotli format encodes literal data interspersed with copy commands that reference earlier output (a sliding-window LZ77 back-reference). Each copy command specifies a distance into the ring buffer and a copy length. The vulnerable code path trusts the decoded copy length when writing into the output ring buffer without a complete bounds check against the remaining capacity of the allocated buffer region.
// Reconstructed pseudocode — not verified source
// File: c/dec/decode.c
// Vulnerable function: BrotliDecoderDecompressStream (inner copy-command dispatch)
//
// Simplified representation of the vulnerable copy-length consumption loop.
// Real struct: BrotliDecoderStateStruct (typedef'd as BrotliDecoderState)
//
// Relevant fields (symbolic offsets — not verified from DWARF):
// BrotliDecoderState:
// /* +VULN_OFF_0 */ uint8_t* ringbuffer; // heap-allocated output ring buffer
// /* +VULN_OFF_1 */ uint8_t* ringbuffer_end; // one-past-end sentinel
// /* +VULN_OFF_2 */ uint8_t* pos; // current write position
// /* +VULN_OFF_3 */ size_t copy_length; // decoded from stream, attacker-controlled
// /* +VULN_OFF_4 */ size_t copy_src_offset; // decoded back-reference distance
static BROTLI_INLINE void CopyBlockToOutput(BrotliDecoderState* s) {
size_t copy_length = s->copy_length; // attacker-controlled value from stream
uint8_t* dst = s->pos; // current write head in ring buffer
uint8_t* src = dst - s->copy_src_offset;
// VULNERABLE: copy_length is not bounded against (s->ringbuffer_end - dst).
// When copy_length > remaining ring-buffer capacity, memcpy (or the inline
// copy loop) writes beyond ringbuffer_end into adjacent heap allocations.
memcpy(dst, src, copy_length); // <--- OUT-OF-BOUNDS WRITE HERE
s->pos += copy_length; // write pointer also advances past end
}
The ring buffer is allocated with a fixed size derived from the stream's declared window size (configurable up to 16 MiB via the WBITS field). An attacker sets WBITS to a small value (minimising allocation size), then encodes a back-reference with a copy_length that exceeds the remaining buffer capacity. Because the length is decoded and stored in s->copy_length before the bounds check path is fully exercised, the subsequent copy walks off the end of the ring buffer and overwrites whatever the allocator placed immediately after it.
Exploitation Mechanics
EXPLOIT CHAIN:
// Source: http://www.openwall.com/lists/oss-security/2026/10/24/6 (advisory description)
// + Reconstructed mechanics from NVD description and advisory text
1. PREREQUISITE — Zero authentication required; attacker controls any
Brotli-compressed data consumed by the target (HTTP response body with
Content-Encoding: br, WebSocket frame, file upload, npm package tarball, etc.)
2. TRIGGER — Attacker delivers a malformed Brotli stream containing:
a. A small WBITS value (e.g. 10) → ring buffer allocated as 1 KiB
b. A meta-block with a back-reference copy command whose copy_length
field decodes to a value larger than remaining ring-buffer space
(e.g. copy_length = 0x4000 against a 0x400-byte ring buffer)
3. MEMORY STATE CHANGE — BrotliDecoderDecompressStream writes copy_length
bytes starting at s->pos (inside ring buffer), overflowing past
ringbuffer_end. Adjacent heap chunks (allocator metadata, other decoder
state objects, V8 heap in Node.js context) are overwritten with
attacker-influenced byte patterns replicated from within the ring buffer.
4. CONTROL-FLOW HIJACK — In a heap-groomed scenario:
a. Overflow targets a neighbouring object containing a function pointer
or a vtable pointer (e.g. a Node.js Buffer backing store or a
libuv handle struct).
b. Next invocation of that pointer redirects execution to attacker
shellcode or a ROP gadget chain.
c. In simpler exploitation, overflow corrupts allocator freelist
metadata, enabling a subsequent write-what-where primitive.
5. FINAL IMPACT — Remote Code Execution as the Node.js / application process
user, or DoS via SIGSEGV / heap corruption abort, or information
disclosure from adjacent heap memory reflected in error callbacks.
Memory Layout
HEAP STATE — x86_64 Linux, glibc allocator (symbolic addresses)
─────────────────────────────────────────────────────────────
BEFORE CORRUPTION (ring buffer allocated, copy not yet issued)
─────────────────────────────────────────────────────────────
VULN_OBJ_ADDR + 0x000 [chunk header: size=0x410, prev_inuse=1 ]
VULN_OBJ_ADDR + 0x010 [ring buffer: 1024 bytes of decoded output ] <-- s->ringbuffer
VULN_OBJ_ADDR + 0x410 [chunk header: size=0x90, prev_inuse=1 ] <-- s->ringbuffer_end
VULN_OBJ_ADDR + 0x420 [adjacent obj: BrotliDecoderState or V8 obj ]
[ contains vtable ptr at +0x00 of this chunk ]
─────────────────────────────────────────────────────────────
AFTER CORRUPTION (copy_length=0x4000, overflow of 0x3C00 bytes)
─────────────────────────────────────────────────────────────
VULN_OBJ_ADDR + 0x000 [chunk header: intact ]
VULN_OBJ_ADDR + 0x010 [ring buffer: legitimate output data ]
VULN_OBJ_ADDR + 0x410 [*** OVERWRITTEN — chunk header corrupted *** ]
VULN_OBJ_ADDR + 0x420 [*** OVERWRITTEN — vtable ptr now attacker- ]
[ controlled bytes from ring-buffer data ]
...
VULN_OBJ_ADDR + 0x4010 [overflow continues for 0x3C00 bytes ]
On next virtual dispatch through the corrupted adjacent object,
EIP/RIP is redirected to ATTACKER_CONTROLLED_ADDR.
Proof of Concept
# PoC skeleton — trigger mechanism only, no weaponized payload
# Demonstrates construction of a malformed Brotli stream that triggers the
# out-of-bounds write in BrotliDecoderDecompressStream via an oversized
# copy_length back-reference in a crafted meta-block.
#
# Reference: NVD description for CVE-2026-111497; advisory at
# http://www.openwall.com/lists/oss-security/2026/10/24/6
#
# To reproduce crash:
# pip install brotlicffi==<affected version> (e.g. brotlicffi 1.0.9.2)
# python3 poc_skeleton.py
# Expected: SIGSEGV / heap-buffer-overflow in BrotliDecoderDecompressStream
import struct
def build_malformed_brotli_stream():
"""
Constructs a minimal Brotli stream header followed by a meta-block that
encodes a back-reference copy command with an attacker-controlled
copy_length exceeding the ring-buffer capacity implied by WBITS.
NOTE: Actual bit-level Brotli encoding requires precise Huffman tables
and prefix code construction. This skeleton shows the conceptual fields
only. A real trigger would be a binary blob; file-level PoC blobs are
not reproduced here.
"""
# Brotli stream starts with a 1–7 bit WBITS field.
# WBITS = 10 → window size = 2^10 = 1024 bytes (minimal ring buffer)
WBITS = 10 # results in 1 KiB ring buffer allocation
# A crafted meta-block must set:
# MLEN (uncompressed meta-block length) = small value
# Copy command copy_length = value >> ring buffer size
OVERSIZED_COPY_LENGTH = 0x4000 # 16 KiB — overflows 1 KiB ring buffer
# In a real exploit stream these would be Brotli-prefix-coded:
stream_fields = {
"WBITS": WBITS,
"ISLAST": 0,
"MLEN": 64,
"copy_distance": 1, # back-ref to 1 byte ago
"copy_length": OVERSIZED_COPY_LENGTH, # <--- overflow trigger
}
# Placeholder: return a known-bad binary blob path for testing
print("[*] Stream parameters:")
for k, v in stream_fields.items():
print(f" {k} = {v:#x}")
print("[*] Feed crafted_stream.br to any affected Brotli decoder.")
print("[*] Expected: heap-buffer-overflow write at s->pos + copy_length")
print("[!] No binary payload generated — skeleton only.")
return None
if __name__ == "__main__":
build_malformed_brotli_stream()
# To test with brotlicffi on an affected system:
# import brotlicffi
# with open("crafted_stream.br", "rb") as f:
# data = f.read()
# brotlicffi.decompress(data) # <--- crash here
Patch Analysis
No rendered patch diff was recoverable from the source material (both the GitHub advisory URL and oss-security threads returned JavaScript bundle content rather than diff text). Based on the NVD description, the class of fix for this category of Brotli decoder overflow is a pre-copy bounds check that clamps copy_length against the remaining ring-buffer capacity before the copy operation executes, and an additional validation of the stream-declared MLEN and back-reference length fields against the window size. The fix lands in versions 1.0.10, 1.1.1, and 1.2.1.
// VULNERABLE (pre-patch) — Reconstructed pseudocode — not verified source
// c/dec/decode.c, inner copy dispatch
static BROTLI_INLINE void CopyBlockToOutput(BrotliDecoderState* s) {
size_t copy_length = s->copy_length; // attacker-controlled, unbounded
memcpy(s->pos, s->pos - s->copy_src_offset, copy_length);
s->pos += copy_length;
}
// FIXED (post-patch) — Reconstructed pseudocode — not verified source
// Expected remediation pattern for this class of ring-buffer overflow:
static BROTLI_INLINE BrotliDecoderErrorCode CopyBlockToOutput(
BrotliDecoderState* s) {
size_t copy_length = s->copy_length;
size_t remaining = (size_t)(s->ringbuffer_end - s->pos);
// Bounds check: copy_length must not exceed remaining ring-buffer space.
if (BROTLI_PREDICT_FALSE(copy_length > remaining)) {
return BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_BLOCK_LENGTH;
}
memcpy(s->pos, s->pos - s->copy_src_offset, copy_length);
s->pos += copy_length;
return BROTLI_DECODER_SUCCESS;
}
Detection and Indicators
CRASH SIGNATURES / IOCs
// Source: NVD description + oss-security advisory thread
// http://www.openwall.com/lists/oss-security/2026/10/24/6
── Linux (glibc / AddressSanitizer) ──────────────────────────────────────────
ASAN output:
==PID==ERROR: AddressSanitizer: heap-buffer-overflow on address VULN_OBJ_ADDR
WRITE of size N at VULN_OBJ_ADDR pc SOME_PC bp SOME_BP sp SOME_SP
#0 in BrotliDecoderDecompressStream c/dec/decode.c:LINE
#1 in [application decoder wrapper]
glibc malloc crash (no ASAN):
*** glibc detected *** node: corrupted double-linked list: VULN_OBJ_ADDR ***
Aborted (core dumped)
Node.js-specific crash signal:
FATAL ERROR: heap-buffer-overflow
Process: node (pid PID)
Signal: SIGSEGV (Segmentation fault)
-- Stack trace includes BrotliDecoder* frames --
── Network / WAF IOCs ────────────────────────────────────────────────────────
Indicator: HTTP requests/responses with Content-Encoding: br where the
decompressed payload triggers immediate backend crash or restart.
Suspicious Brotli stream characteristics (heuristic, not definitive):
- WBITS field < 16 (small window size) combined with large MLEN declaration
- Copy command back-reference length >> declared window size
- Stream byte length << declared uncompressed output length by extreme ratio
── Log indicators ───────────────────────────────────────────────────────────
Node.js: "node[PID]: segfault at ADDR ip ADDR sp ADDR error N in node"
(kernel log via dmesg / /var/log/kern.log)
Nginx upstream: "upstream prematurely closed connection" correlated with
br-encoded response bodies
Process restart loops in PM2 / systemd service units serving Brotli content
Remediation
Immediate action: update to a fixed version.
- google/brotli: upgrade to
1.0.10, 1.1.1, or 1.2.1 depending on your current branch.
- Node.js: upgrade to
24.22.1 or later (v24 line), or 26.12.1 or later (v26 line). Node.js bundles Brotli internally; updating the system Brotli library alone does not protect a Node.js binary.
- python-hyper/brotlicffi: update to any release that links against a fixed
libbrotlidec (≥ 1.0.10 / 1.1.1 / 1.2.1). Verify the linked library version with python -c "import brotlicffi; print(brotlicffi.__version__)" and confirm the underlying C library.
- Distributions: Debian, Ubuntu, Fedora, Alpine, and similar distros are shipping patched packages — run
apt upgrade libbrotli1 / dnf update brotli as appropriate and restart dependent services.
If patching is not immediately possible:
- Disable Brotli decompression at the reverse proxy layer (
proxy_set_header Accept-Encoding "gzip" in Nginx; RequestHeader unset Accept-Encoding + AddOutputFilterByType DEFLATE in Apache) so the backend decoder is never invoked on attacker-supplied data.
- For Node.js HTTP clients, set
acceptEncoding: 'gzip' and ensure the br encoding is not negotiated.
- Enable allocator hardening (
MALLOC_PERTURB_, jemalloc with opt.junk, or full ASAN in non-production environments) to convert exploitable corruption into immediate crash, trading exploitability for availability.
- Deploy a WAF rule to reject HTTP responses or requests advertising
Content-Encoding: br at the perimeter until internal stacks are patched.
CISA KEV listing confirms active exploitation. Treat this as a P0 patch — apply within 24 hours on internet-facing Node.js or Brotli-consuming infrastructure.