Brotli Decoder Buffer Overflow Enables Code Execution in Multiple Runtimes
A buffer overflow vulnerability in the Brotli decoder library (versions 1.0.3 through 1.2.0) enables remote code execution across multiple runtime environments and applications. The flaw resides in the DecodeBlockTypeAndLength() function, which previously returned a plain boolean unable to distinguish between a malformed bitstream and one awaiting additional data. An attacker can send a crafted bitstream requesting an impossible block switch, which the decoder misinterprets as incomplete input and responds to by writing attacker-controlled bytes beyond the end of an eight-byte internal buffer. This buffer overflow corrupts adjacent decoder state, potentially leading to memory leaks or code execution. Exposure is widespread because HTTP clients automatically decompress Brotli-encoded responses (Node.js fetch, Python requests/urllib3, aiohttp), and request body parsers in Express 5.0.0–5.3.0 and body-parser 2.0.0–2.3.0 decompress incoming data automatically. Any code calling the decoder directly on untrusted archives, caches, or queue messages is also at risk.
The fix, merged into google/brotli through commits 0ed4268, 50a9b70, b418fa8, and da98063, returns a hard error code (BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH) instead of a boolean. Node.js users should upgrade to versions 22.23.4, 24.22.1, or 26.12.1; Python users should upgrade Brotli and brotlicffi to 1.2.1 or later. An Imperva Red Team executed attacker-supplied code on unmodified Node.js 24.22.0 Linux arm64 through both HTTP responses and Express request bodies. A public proof of concept emerged on GitHub on 2026-10-22 but achieves code execution only on deliberately weakened builds; standard builds crash with limited memory access. Researchers confirmed the vulnerability in Python using AddressSanitizer.
Read the full article
Continue reading at Hacker News →This is an AI-generated summary. Read the original for the full story.