CVE-2026-111497
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Node.js is an asynchronous, event-driven JavaScript runtime designed for building scalable network applications. Its zlib module decompresses Brotli data with Google's Brotli library, which Node.js bundles as C source at deps/brotli and drives from the native zlib binding. The same decoder handles zlib.createBrotliDecompress(), zlib.brotliDecompress() and zlib.brotliDecompressSync(), and the bundled undici uses it when fetch() receives a response with Content-Encoding: br.
A heap-based buffer overflow vulnerability (CVE-2026-111497) has been identified in Node.js's bundled Brotli decoder. When the decoder runs short of input in the middle of a read, it keeps the leftover bytes in a small internal buffer and waits for the next chunk, on the assumption that a few more bytes will always let the read finish. However, a block switch that the stream is not allowed to make was reported as that same "needs more input" condition instead of a format error. The read can never finish, so the streaming decoder keeps appending input bytes to its eight-byte buffer and writes past its end into the rest of the decoder state.
This behaviour maps to CWE-787 (Out-of-bounds Write), where the product writes data past the end, or before the beginning, of the intended buffer. In Node.js, the overwritten memory is the heap-allocated decoder state behind a Brotli decompression stream, whose next fields are the buffer length, the ring-buffer positions and the pointers into the output ring buffer and Huffman tables. The CVE record also lists CWE-252 (Unchecked Return Value), since the decoder treated the failed block switch as a request for more data.
Exploitation requires an application that decompresses Brotli data an attacker controls, such as a server that accepts Content-Encoding: br request bodies, a service that unpacks uploaded .br files, or a fetch() client talking to an attacker's server. No authentication is needed, and the attacker only has to send a crafted stream. Corrupting the decoder state can crash the process, disclose process memory, or lead to remote code execution. Applications that never decompress Brotli data from untrusted sources are not exposed. The Node.js project describes the issue as affecting its supported 22.x, 24.x and 26.x lines. Every Node.js release that ships the zlib Brotli APIs bundles a Brotli version in the affected range, so the End-of-Life 12.x, 14.x, 16.x, 18.x and 20.x lines contain the same vulnerable decoder code.
Details
Module Info
- Product: Node.js
- Affected packages: node (bundled at deps/brotli)
- Affected versions: >=10.16.0 <=10.24.1, >=11.7.0 <=21.7.3, >=22.0.0 <22.23.4, >=23.0.0 <=23.11.1, >=24.0.0 <24.22.1, >=25.0.0 <=25.9.0, >=26.0.0 <26.12.1
- GitHub repository: https://github.com/nodejs/node, https://github.com/google/brotli
- Published packages: https://nodejs.org/en/download
- Package manager: Not applicable; Node.js is distributed as runtime builds from nodejs.org rather than as a published npm package
- Fixed in: Node.js 22.23.4, 24.22.1, and 26.12.1; Node.js NES v12.22.21, v14.21.14, v16.20.16, v18.20.20, v20.20.5, v20.20.13, and v22.23.5
Vulnerability Info
This Critical-severity vulnerability is found in the block-switch handling of the Brotli decoder in Node.js's zlib module (deps/brotli/c/dec/decode.c). The Google CNA scores it 9.2 (CVSS v4.0), which NVD displays without a score of its own, and the Node.js project rates it High.
A Brotli stream is split into blocks, and the stream declares how many block types each category of data uses. A block switch is only valid when more than one block type exists. The decoder checks this in DecodeBlockTypeAndLength(), but it signals the invalid case with the same BROTLI_FALSE it uses for "not enough bits yet".
When input is short, ProcessCommandsInternal() calls the block-switch functions through the BROTLI_SAFE macro, which turns any false result into BROTLI_DECODER_NEEDS_MORE_INPUT. With plenty of input, the result is discarded altogether.
BrotliDecoderDecompressStream() handles "needs more input" by copying input into s->buffer, an eight-byte union inside the decoder state, and retrying. The only guard on the buffer's size is a BROTLI_DCHECK that buffer_length stays below eight.
That design is safe only if every "needs more input" can be satisfied within eight bytes. An invalid block switch never succeeds, so each retry appends another byte, or the whole remaining tail, and buffer_length grows past eight. BROTLI_DCHECK is an assert only in debug builds of Brotli, so release builds of Node.js write the bytes into whatever follows the buffer in BrotliDecoderState, starting with buffer_length itself. Node.js allocates that state on the heap for every Brotli decompression stream. Because the bytes come straight from the compressed input, the attacker chooses what is written.
Note: The streaming path, where data arrives in chunks as it does for HTTP bodies and createBrotliDecompress(), is the one that buffers input and is the path the Node.js project describes. Compression with zlib.createBrotliCompress() does not use the affected code.
Mitigation
Node.js 22.x, 24.x and 26.x are supported and are fixed in 22.23.4, 24.22.1 and 26.12.1 and later. Every other release line is past its support window and never received an upstream fix. Node.js 12.x reached End-of-Life on April 30, 2022; Node.js 14.x on April 30, 2023; Node.js 16.x on September 11, 2023; Node.js 18.x on April 30, 2025; Node.js 19.x on June 1, 2023; Node.js 20.x on April 30, 2026; Node.js 21.x on June 1, 2024; Node.js 23.x on June 1, 2025; and Node.js 25.x on June 1, 2026. For more information see the Node.js previous releases schedule.
Users of the affected components should apply one of the following mitigations:
- Upgrade to Node.js 22.23.4, 24.22.1 or 26.12.1 or later on those lines, all of which include this fix.
- Migrate affected applications away from the End-of-Life Node.js release lines.
- Leverage a commercial support partner like HeroDevs for post-EOL security support, through Node.js NES.
Credits
- Khai Tran from OpenAI Codex Security (reporter)
- Sylvie Mayer from OpenAI Codex Security (reporter)
- mcollina (remediation developer)
- aduh95 (remediation developer)