Node2Shell: CVE-2026-111497 — Brotli Decoder RCE in Node.js
1. Executive Summary
CRITICAL — Actively Exploited
Node2Shell (CVE-2026-111497) is a critical out-of-bounds write in the Brotli decompression library, rated CVSS 9.2. A malicious HTTP response or request body compressed with a crafted Brotli stream can overwrite memory in the Node.js process and achieve remote code execution. CISA added it to the KEV catalog on October 27, 2026.
On October 21, 2026, the Node.js project released emergency patches for a critical vulnerability in the Brotli decompression library bundled with Node.js. The flaw, tracked as CVE-2026-111497, allows an attacker to trigger an out-of-bounds write by sending a specially crafted Brotli-compressed payload.
The vulnerability affects Brotli versions 1.0.3 through 1.2.0 and is reachable through multiple common paths: the built-in fetch() API, Express 5 with body-parser 2.x, and direct node:zlib usage. Security firm Imperva named the vulnerability “Node2Shell” and demonstrated code execution on a Node.js 24 image.
2. What Is Node2Shell?
“Node2Shell” is the name given by Imperva to CVE-2026-111497. The security community also refers to it as Broccoli2Shell (a play on “Brotli”) and HTTP2Shell (highlighting the HTTP response vector). All three names refer to the same vulnerability.
The name captures the attack path: a Node.js application makes an outbound HTTP request (or receives a compressed request body), the response/body uses Brotli compression (Content-Encoding: br), and the malformed compressed stream triggers a memory corruption in the Brotli decoder — giving the attacker code execution on the Node.js server.
Unlike PHP2Shell (which targets the server processing incoming requests), Node2Shell primarily exploits outbound connections — the Node.js server is the victim when it fetches data from an attacker-controlled or compromised endpoint. This makes it particularly dangerous for SSRF-exposed services, webhook handlers, API aggregators, and any service that fetches external URLs.
3. Root Cause: Brotli Decoder OOB Write
The Bug
The vulnerability lies in the streaming Brotli decoder (part of the Brotli reference implementation maintained by Google). When processing a malformed compressed input, the decoder's streaming mode continues appending decompressed bytes to a small internal ring buffer past its allocated boundary.
Technical Detail
In normal operation, the Brotli decoder writes decompressed output into a fixed-size ring buffer and flushes it when full. The bug occurs when a crafted stream manipulates the decoder's internal state such that it miscalculates how many bytes remain before the buffer boundary. The decoder keeps writing — an out-of-bounds (OOB) write — corrupting adjacent heap memory.
The corruption is controlled: the attacker dictates the content being written (it's the “decompressed” output from their crafted stream), making this a write-what-where primitive. From there, standard heap exploitation techniques lead to arbitrary code execution.
Affected Brotli Versions
| Brotli Branch | Affected | Fixed In |
|---|---|---|
| 1.0.x | 1.0.3 – 1.0.9 | 1.0.10 |
| 1.1.x | 1.1.0 | 1.1.1 |
| 1.2.x | 1.2.0 | 1.2.1 |
The Brotli library is not specific to Node.js. Any application or runtime that links against Brotli 1.0.3–1.2.0 for decompression is potentially affected. However, Node.js is the highest-profile consumer due to its automatic Brotli decompression in fetch().
4. Attack Vectors & Entry Paths
The vulnerability is reachable anywhere Node.js decompresses Brotli data. Three primary entry paths have been identified:
4.1 Outbound fetch() — The Primary Vector
Node.js's built-in fetch() API automatically decompresses responses based on the Content-Encoding header. When a response declares Content-Encoding: br, Node.js pipes the body through the Brotli decoder — no opt-in required.
// This is all it takes — fetch() auto-decompresses Brotli
const resp = await fetch("https://attacker-controlled.example/api/data");
const data = await resp.json();
// If the response was Brotli-compressed with a malformed stream,
// the OOB write already happened during decompressionAttack scenario: An attacker compromises an upstream API, CDN edge, or stands up a malicious service. Any Node.js application that fetches from it decompresses the response and triggers the exploit.
4.2 Express 5 + body-parser 2.x — Inbound Requests
Express 5 with body-parser 2.x supports Brotli-compressed request bodies. When a client sends a POST with Content-Encoding: br, the middleware decompresses it server-side.
// Express 5 + body-parser 2.x
import express from "express";
import bodyParser from "body-parser";
const app = express();
app.use(bodyParser.json()); // Accepts br-encoded bodies
app.post("/webhook", (req, res) => {
// If the request body was a crafted Brotli stream,
// the exploit fired during body-parser decompression
console.log(req.body);
res.sendStatus(200);
});This vector is attacker-initiated — unlike the fetch() path (which requires the server to make an outbound request), the body-parser path lets the attacker send a crafted payload directly to the server. Any Express 5 endpoint accepting POST/PUT bodies is a potential target.
4.3 Direct node:zlib Usage
Applications that directly use zlib.createBrotliDecompress() or zlib.brotliDecompress() on untrusted input are also vulnerable. This includes file processing pipelines, message queue consumers, and custom protocol handlers.
import { createBrotliDecompress } from "node:zlib";
import { pipeline } from "node:stream/promises";
// Any pipeline decompressing untrusted Brotli data
await pipeline(
untrustedInputStream,
createBrotliDecompress(),
outputStream
);5. Affected Versions & Fixed Releases
| Node.js Line | Status | Fixed In |
|---|---|---|
| v26.x | Current | 26.12.1 |
| v24.x | Active LTS | 24.22.1 |
| v22.x | Maintenance LTS | 22.23.4 |
| v20.x | End of Life | No fix — EOL |
| v18.x | End of Life | No fix — EOL |
Node.js 20 and 18 will not receive a fix. Both lines are past their End-of-Life date. Applications still running on these versions must upgrade to a supported release line (22.x, 24.x, or 26.x) to receive the patch.
CISA KEV & Federal Deadline
CISA added CVE-2026-111497 to the Known Exploited Vulnerabilities (KEV) catalog on October 27, 2026. Federal civilian agencies face a remediation deadline of November 10, 2026. Private organizations that follow CISA BOD 22-01 guidance should treat this as an emergency patch.
6. Proof of Concept
Imperva published the first proof-of-concept demonstrating full code execution:
- Target: Node.js 24.22.0 (one version before the fix)
- Platform: Linux arm64 container image
- Vector: Crafted HTTP response with
Content-Encoding: br - Result: Arbitrary code execution in the Node.js process
The PoC works by sending a malformed Brotli stream that overflows the decoder's ring buffer, overwriting heap metadata. Through careful heap shaping, the attacker redirects control flow to shellcode embedded in the “decompressed” data.
Imperva's PoC targeted Linux arm64 specifically. The exploit is architecture-dependent — heap layouts differ between x86_64, arm64, and other platforms, and between Node.js versions. However, the underlying vulnerability exists on all platforms, and researchers warn that portable exploits are likely.
7. Timeline of Events
| Date | Event |
|---|---|
| Oct 21, 2026 | Node.js releases emergency patches (22.23.4, 24.22.1, 26.12.1). Google patches Brotli (1.0.10, 1.1.1, 1.2.1). |
| Oct 22, 2026 | Imperva publishes Node2Shell research and demonstrates code execution on Node.js 24 arm64 |
| Oct 23, 2026 | Security researchers confirm the vulnerability also affects Bun runtime |
| Oct 24, 2026 | Bun releases version 1.4.4 with the Brotli fix |
| Oct 27, 2026 | CISA adds CVE-2026-111497 to KEV catalog. Federal remediation deadline: November 10, 2026. |
| Oct 28, 2026 | Cloudflare and AWS WAF add detection rules for Brotli-based exploit payloads |
| Oct 30, 2026 | Docker official Node.js images updated to patched versions |
8. Beyond Node.js: Bun & Other Runtimes
Because the vulnerability is in the Brotli library itself (not in Node.js-specific code), any runtime or application that bundles an affected Brotli version is at risk.
Bun
Bun bundles its own copy of the Brotli library. Versions prior to Bun 1.4.4 are affected. The fix was released on October 24, 2026.
Deno
Deno uses Rust-native decompression (via the brotli crate), which is a separate implementation from Google's C reference library. Deno is not affected by this specific CVE.
Other Consumers
The Brotli C library is also used by:
- Nginx (via the
ngx_brotlimodule) — check if your build links Brotli 1.0.3–1.2.0 - curl (when built with Brotli support)
- Python's
brotlipackage (which wraps the C library) - Go's
google/brotli/go/cbrotli(CGo wrapper)
Pure-language reimplementations (Rust brotli crate, Go's andybalholm/brotli) are separate codebases and are not affected.
9. Detection & Mitigation
Check Your Node.js Version
# Check Node.js version
node -v
# Check which Brotli version is linked
node -e "console.log(process.versions)"
# Look for the 'brotli' field
# For Docker images
docker run --rm node:24 node -v
docker run --rm node:24 node -e "console.log(process.versions.brotli)"Interim Mitigations (If You Cannot Patch Immediately)
1. Disable Brotli decompression on outbound fetch:
// Force fetch() to not accept Brotli
const resp = await fetch(url, {
headers: {
"Accept-Encoding": "gzip, deflate" // Exclude 'br'
}
});2. Reject Brotli on inbound requests (Express/body-parser):
// Middleware to reject Brotli-encoded request bodies
app.use((req, res, next) => {
const encoding = req.headers["content-encoding"];
if (encoding && encoding.toLowerCase().includes("br")) {
return res.status(415).json({ error: "Brotli encoding not accepted" });
}
next();
});3. Network-level blocking:
- Configure your reverse proxy (Nginx, HAProxy, Envoy) to strip
Content-Encoding: brfrom upstream responses before they reach Node.js - If using Cloudflare or AWS CloudFront, enable managed rules that detect malformed Brotli payloads
- Block outbound connections from Node.js services to untrusted origins where possible
4. Monitor for exploitation:
- Watch for Node.js process crashes (segfaults) — a sign of failed exploitation attempts
- Monitor for unexpected child process spawns from Node.js workers
- Alert on outbound connections from Node.js to unusual IP addresses or ports
10. Patching Guide
Step 1: Identify All Node.js Installations
Check production servers, CI/CD pipelines, Docker images, serverless functions (AWS Lambda, Vercel, Cloudflare Workers using Node.js compat), and development machines. Don't forget version managers (nvm, fnm, volta).
Step 2: Update Node.js
# Using nvm
nvm install 24.22.1
nvm alias default 24.22.1
# Using fnm
fnm install 24.22.1
fnm default 24.22.1
# Using volta
volta install node@24.22.1
# Direct download
# https://nodejs.org/en/download/
# Docker — update base image
# FROM node:24.22.1-slim
# Then rebuild ALL imagesStep 3: Update Bun (If Used)
# Update Bun to 1.4.4+
bun upgrade
# Verify
bun --versionStep 4: Verify
# Confirm Node.js version
node -v
# Should show >= 22.23.4, >= 24.22.1, or >= 26.12.1
# Confirm Brotli version
node -e "console.log(process.versions.brotli)"
# Should show >= 1.0.10, >= 1.1.1, or >= 1.2.1
# For containers — check the RUNNING version, not just the image
docker exec <container> node -vStep 5: Handle EOL Versions
If you are running Node.js 20 or 18, there is no patch available. You must:
- Upgrade to Node.js 22.x (maintenance LTS), 24.x (active LTS), or 26.x (current)
- If immediate upgrade is not possible, apply all interim mitigations from Section 9
- Prioritize isolating affected services behind a reverse proxy that strips Brotli encoding
Conclusion
Node2Shell demonstrates that supply-chain vulnerabilities in compression libraries can have devastating consequences. A single malformed Brotli stream — delivered via an HTTP response or request body — is enough to compromise a Node.js server.
The attack surface is broad: any Node.js application that fetches external URLs, processes user-uploaded compressed files, or accepts Brotli-encoded request bodies is potentially exposed. The fact that fetch() auto-decompresses Brotli by default means many applications are vulnerable without any explicit Brotli-related code.
If you run Node.js, update to a patched version immediately. If you run Node.js 20 or 18, begin your migration to a supported release line — these versions are end-of-life and will not receive security fixes for this or future vulnerabilities.
Sources
Khubab Ahmed
PNPT Certified Penetration Tester • Security Researcher • FAST-NUCES