A critical security vulnerability, identified as CVE-2026-111497, has emerged in the Google Brotli compression library. Originally highlighted as 'Node2Shell' due to its impact on Node.js, the flaw is an out-of-bounds write occurring in the `DecodeBlockTypeAndLength()` function. This function is responsible for handling block switches—points where a Brotli stream changes the Huffman tree it uses. In affected versions (1.0.3 through 1.2.0), the function returns a boolean value that can be misinterpreted by the decoder as either a request for more input or a signal that the stream is malformed. On the 'fast path' of the decoder, this return value is discarded, allowing a crafted stream to force a switch that fails and subsequently leads to an out-of-bounds write, potentially allowing an unauthenticated remote attacker to leak memory, crash a process, or execute arbitrary code.

This image illustrates the core vulnerability and its expanded impact on web services and Python packages.

This visual demonstrates the practical exploitation of the out-of-bounds write in the Brotli library.
The scope of the vulnerability has broadened significantly as it has been confirmed to affect major Python packages and various web service runtimes. Because Brotli is a standard for HTTP compression, many Python HTTP clients—including `requests`, `httpx`, and `aiohttp`—automatically load and use the vulnerable `Brotli` or `brotlicffi` packages if they are present in the environment. This means an application can be exposed to the vulnerability even if it does not explicitly import the Brotli library in its own source code. The vulnerability is particularly dangerous because it can be triggered via outbound requests (e.g., a malicious server sending a crafted response to a client) or inbound requests (e.g., a client sending a malicious request body to a server).
Remediation involves upgrading to patched versions of the affected libraries. For Python, users should upgrade to `Brotli` version 1.2.1 or higher and `brotlicffi` version 1.2.1.0 or higher. Other affected runtimes, such as Node.js, Bun, and Envoy, have also released patches. For those unable to upgrade immediately, security experts recommend rejecting incoming HTTP requests that include `br` in the `Content-Encoding` header at the reverse proxy or load balancer level. Additionally, removing the Brotli and `brotlicffi` packages from Python environments can mitigate the risk, as most popular HTTP clients will automatically fall back to `gzip` or `deflate` compression.
While the root cause was addressed in the upstream Brotli source code in February 2026, the fix was not initially recognized as a security vulnerability, delaying the release of a patched version until October. This delay means that any project or container image that bundled the older version of the library remains vulnerable until it is rebuilt with the updated components. Because many advisory databases have not yet mapped the CVE to specific PyPI packages, automated tools like `pip-audit` or `Dependabot` may not yet flag these versions as high-risk, necessitating manual checks of dependency trees.