Brotli2Shell: Anatomy of a Critical Compression Library Vulnerability (CVE-2026-111497)
A critical out-of-bounds write in Google's Brotli decoder enables remote code execution. Covers root cause, affected software across Node.js, Python, .NET, Envoy, and Istio, and practical detection and remediation strategies.
CVE-2026-111497 is a critical out-of-bounds write in Google's Brotli decoder that enables remote code execution across Node.js, Python, .NET, Envoy, and many other products. The root cause is an unchecked return value in block-switch processing — when a format error is silently discarded, the decoder continues with corrupted Huffman-tree state and writes past buffer boundaries.
Why is Brotli2Shell (CVE-2026-111497) critical for engineering teams?
Because most networks run affected Node.js versions, the vulnerability is reachable via HTTP request bodies and responses, and exploitation has been confirmed in the wild. Teams need to audit their Brotli dependencies, verify running versions in containers, and prioritize patching internet-facing services that decompress untrusted compressed data.
Sources: Node.js Security Advisory · Google Brotli v1.2.1 Release
CVE-2026-111497 — Out-of-Bounds Write in Google's Brotli Decoder
Published: November 2026
Severity: Critical (CVSSv4.0: 9.2)
Known Exploited: Yes — added to CISA KEV on October 27, 2026
Overview
CVE-2026-111497 is a critical out-of-bounds write vulnerability in Google's Brotli compression library, affecting the decoder implementation in c/dec/decode.c. The flaw has circulated under several names — Brotli2Shell, Node2Shell, HTTP2Shell, and Broccoli2Shell — reflecting its impact across multiple downstream ecosystems.
Google scored it 9.2 under CVSSv4.0 with the vector:
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
The attack vector is network-based, complexity is low, no privileges or user interaction are required, and the impact on confidentiality, integrity, and availability is high. Scope is unchanged (S:C). Microsoft rates the flaw 8.1 under CVSSv3.1 for its .NET implementation.
The Vulnerability: What Went Wrong
Root Cause: Unchecked Return Value (CWE-252)
The vulnerability sits in DecodeBlockTypeAndLength(), a function in the Brotli C decoder that reads block type and length information from the compressed stream during meta-block processing.
Brotli divides each meta-block into three categories — literals, insert/copy commands, and distances. Each category is Huffman-encoded and may be split into multiple blocks, each with its own Huffman tree. When a new block begins, the decoder reads a block switch from the stream: the next block type and its length.
The bug occurs when a category declares only one block type (max_block_type <= 1). In that case, the RFC specifies that no block switches are valid — the stream should carry exactly 16,777,216 blocks of that single type. If the stream forces a switch before that count is exhausted, it is invalid.
In Brotli versions 1.0.3 through 1.2.0, the fast-path wrappers for DecodeLiteralBlockSwitch, DecodeCommandBlockSwitch, and DecodeDistanceBlockSwitch were declared as static void. They called DecodeBlockTypeAndLength(), which returned a boolean indicating success or failure — but the result was discarded. The decoder continued processing with corrupted state.
On the slow (safe) path, the boolean return was read and treated as "needs more input" rather than "format error." This meant even the safe path could be misled by crafted input — it would simply keep appending bytes to an internal eight-byte buffer, eventually writing past its bounds.
The Exploit Path
- An attacker crafts a Brotli-compressed stream containing an invalid block switch in a single-type category
- The decoder reaches
DecodeBlockTypeAndLength(), which returns failure (false) because the stream is malformed - On the fast path, the void wrapper discards this result; on the safe path, it's misinterpreted as
NEEDS_MORE_INPUT - The decoder continues with stale Huffman-tree state —
block_type_rb,block_length[tree_type],htree_command, anddist_context_map_sliceare never updated - Subsequent decoding operations write to the ring buffer using incorrect offset calculations, causing an out-of-bounds write into adjacent decoder state memory
What Successful Exploitation Enables
- Remote code execution — demonstrated against unpatched Node.js environments
- Process crash — denial of service via memory corruption
- Information disclosure — process memory contents can be read
- State corruption — the decoder's internal buffers and Huffman trees are overwritten, potentially affecting subsequent decompression operations
Affected Software
The risk applies wherever an application decompresses Brotli data that an attacker can control. This includes both inbound (request bodies) and outbound (fetched responses) HTTP traffic, as well as compressed files.
Core Library
| Product | Affected Versions | Fixed Versions |
|---|---|---|
| Google Brotli (libbrotli) | 1.0.3 – 1.0.9, 1.1.0, 1.2.0 | 1.0.10, 1.1.1, 1.2.1 |
Language Runtimes
| Product | Affected Versions | Fixed Versions |
|---|---|---|
| Node.js | < 22.23.4, < 24.22.1, < 26.12.1 | 22.23.4, 24.22.1, 26.12.1 |
| Bun | >= 1.0.21, < 1.4.4 | 1.4.4 |
| Python Brotli | <= 1.2.0 | 1.2.1 |
| Python brotlicffi | <= 1.2.0.2 | 1.2.1.0 |
| Java brotli4j | < 1.24.0 | 1.24.0 |
| Ruby brotli gem | < 0.21.1 | 0.21.1 |
Infrastructure and Frameworks
| Product | Affected Versions | Fixed Versions |
|---|---|---|
| Envoy Proxy | <= 1.36.11, 1.37.7, 1.38.5, 1.39.2 | 1.36.12, 1.37.8, 1.38.6, 1.39.3, 1.40.0 |
| Istio | < 1.29.9, < 1.30.6, < 1.31.2 | 1.29.9, 1.30.6, 1.31.2 |
| Microsoft .NET 8 | < 8.0.33 | 8.0.33 |
| Microsoft .NET 9 | < 9.0.22 | 9.0.22 |
| Microsoft .NET 10 | < 10.0.14 | 10.0.14 |
| PHP for Windows | Bundled Brotli 1.0.3–1.2.0 | 8.2.35-1, 8.3.36-1, 8.4.27-1, 8.5.12-1 |
Other Affected Projects
- FFmpeg — reachable via libjxl Brotli-compressed metadata in JPEG XL files (JFrog demonstrated instruction-pointer control)
- Apache Arrow — infinite-loop denial of service with a crafted 534-byte input (fix merged, no release as of October 26)
- ClickHouse — crashable with a single malformed Brotli-compressed HTTP request (fix merged)
- curl/libcurl — vulnerable when built with
--compressedorCURLOPT_ACCEPT_ENCODINGset
End-of-Life Lines
Node.js 20.x, 23.x, and 25.x receive no fix. Akamai telemetry showed that a majority of networks are running affected Node.js versions.
Exposure Paths
The vulnerability is reachable through multiple attack vectors:
1. Inbound Request Bodies (Server-Side)
Applications that decompress incoming Content-Encoding: br request bodies are exposed. Express 5 with default JSON body parsing (express.json()) does this automatically. Any API endpoint that accepts Brotli-encoded POST data is a potential entry point.
2. Outbound HTTP Responses (Client-Side)
Any application that fetches URLs from untrusted sources and decompresses the response is at risk. Node.js fetch() with Content-Encoding: br on the response, or Python HTTP clients (urllib3[brotli], requests, httpx, aiohttp[speedups]) when the Brotli package is installed, will automatically decompress Brotli responses — even if the client did not advertise br in Accept-Encoding, because a hostile server can send Brotli-encoded data unilaterally.
3. Compressed Files
Brotli-compressed files received from untrusted sources (e.g., uploaded documents with Brotli metadata, webhooks containing compressed payloads) are also in scope.
The Fix
Google committed the upstream fix to the Brotli source repository on February 27, 2026 — eight months before public disclosure. Stable fixes were released on October 21, 2026.
What Changed
The fix touches two files: c/dec/decode.c and c/include/brotli/decode.h. The key changes are:
- Block switch functions now return error codes. The three
Decode*BlockSwitchwrappers changed fromstatic voidto returningBrotliDecoderErrorCode, passing the result through a newBROTLI_SAFE_WITH_STATUSmacro on both paths. - A new error code.
BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH(-17) was introduced as a formal error code. Until this fix, -17 was a reserved value. - Invalid streams are rejected at the switch point. When a single-type category runs out and forces an invalid block switch, the decoder now stops immediately with
BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCHinstead of continuing in corrupted state.
Why mbrotli Is Not Affected
The Rust crate mbrotli is immune to this specific vulnerability because it is built with #![cfg_attr(not(test), forbid(unsafe_code))]. A logic error of the same kind could make its decoder accept a stream it should reject, but it cannot write past buffer boundaries — the Rust borrow checker and bounds checks prevent the out-of-bounds write that turns the format bug into memory corruption.
Detection and Scanning
brotli2scan
The community tool brotli2scan (by shouldipanic.ch) detects vulnerable servers by sending two small POST requests: one with a valid Brotli body (the 6 bytes encoding {}) and one with an unknown Content-Encoding. A server that accepts the Brotli request but rejects the unknown encoding is decoding Brotli it receives — and is potentially vulnerable.
Manual Checks
Node.js:
node -v
# Any version below 22.23.4, 24.22.1, or 26.12.1 is affected
Python:
pip show brotli brotlicffi
# Below 1.2.1 / 1.2.1.0 needs updating
Bun:
bun --version
# Below 1.4.4 is affected
Envoy:
envoy --version
# Below 1.40.0 (or the latest in your supported branch)
Container Images
A running process keeps the old code until restarted. A container image must be rebuilt and redeployed to pick up the fix. Updating the host's system libbrotli library only helps processes that link against it dynamically — applications that bundle their own copy (Node.js, Bun) remain vulnerable until the application itself is updated.
Mitigation Strategies
Immediate (Before Patching)
- Reject
Content-Encoding: brat the proxy or load balancer. This blocks inbound Brotli request bodies from reaching the vulnerable decoder. Note: this does not protect against outbound responses — if your code fetches URLs and decompresses the response, that path remains exposed. - Disable Brotli decoding in HTTP clients. For Node.js, this means removing
brfromAccept-Encodingand disabling response decompression. For Python, uninstalling theBrotliandbrotlicffipackages forces HTTP clients to fall back to gzip and deflate. - Remove Brotli from Express 5 middleware. Set
express.json({ inflate: false })— note this also disables gzip, so test your clients. - Disable the Brotli decompressor filter in Envoy/Istio. A disabled filter forwards compressed bytes as-is, which leaves any downstream service that decodes Brotli at risk.
- Run Node.js as an unprivileged user and keep secrets out of its environment to reduce the impact of a successful exploit.
Long-Term
- Upgrade to patched versions. See the version tables above. Restart every process, rebuild every container image.
- Move off end-of-life Node.js lines. Node.js 20.x gets no fix. Plan migration to 22.x or 24.x.
- Verify the running version, not just the installed one. A patched package on disk doesn't help if the running process hasn't been restarted. Check what actually runs inside containers and workloads.
Audit transitive dependencies. urllib3[brotli], httpx[brotli], and aiohttp[speedups] all install Brotli without anyone explicitly importing it. Search your lockfiles:
grep -RniE "brotli|speedups" --include="requirements*.txt" --include="poetry.lock" --include="uv.lock" .
Timeline
| Date | Event |
|---|---|
| February 27, 2026 | Upstream fix committed to google/brotli repository |
| October 21, 2026 | Google releases fixed Brotli versions; Node.js discloses vulnerability in security advisory |
| October 22, 2026 | NVD publishes CVE record; Python packages reach PyPI |
| October 25, 2026 | Microsoft releases .NET security updates |
| October 26, 2026 | Canadian Centre for Cyber Security releases advisory AL26-027; ELLIO reports exploitation attempt against Node.js 24.22.0 on x86-64 |
| October 27, 2026 | CISA adds CVE-2026-111497 to Known Exploited Vulnerabilities (KEV) catalog; remediation due date November 10 for FCEB agencies |
Conclusion
CVE-2026-111497 is a textbook example of how an unchecked return value in error handling can cascade into remote code execution. The fix was committed eight months before disclosure, but the window between fix and public disclosure was critical — public PoCs are available, and exploitation attempts have been observed.
For engineering teams: audit your dependency tree for Brotli, verify running versions in every container and workload, and prioritize patching internet-facing services that decompress untrusted compressed data. The networks still running affected Node.js versions represent a significant attack surface.
References
- Node.js Security Advisory — Brotli OOB Write
- Google Brotli v1.2.1 Release
- CISA KEV Entry — CVE-2026-111497
- Canadian Centre for Cyber Security Advisory AL26-027
- JFrog Security Research — Brotli2Shell Beyond Node2Shell
- Tenable FAQ — Brotli2Shell
- Wiz Blog — Broccoli2Shell
- brotli2scan — Detection Tool
- NY ITS Advisory 2026-120
Feature image: Alexandru.munteanu98 / CC BY-SA 4.0 / Wikimedia Commons.