Node2Shell Exploit: How to Patch Node.js Brotli Now

📅 2026-10-28T00:00:00.000Z⏱️ 4 min read#Tech#Guide#Troubleshooting

Node2Shell Is Being Exploited Right Now — Here’s How to Patch It Today

CISA added the Node2Shell vulnerability (tracked as CVE-2026-XXXXX, also circulating as Broccoli2Shell and HTTP2Shell) to its Known Exploited Vulnerabilities catalog on Tuesday, confirming that attackers are actively weaponizing the flaw in the wild. The bug lives in Node.js’s Brotli decompression handling combined with HTTP/2 stream processing, allowing an unauthenticated remote attacker to trigger a heap overflow and achieve remote code execution on exposed servers. If you run any Node.js service that accepts HTTP/2 traffic with Brotli content encoding enabled, you are a target. The short version: upgrade to Node.js 22.11.1, 20.18.2, or 18.20.5 immediately, disable Brotli request decompression at the edge, and rotate any secrets that lived on affected hosts. The rest of this guide gives you the exact commands, detection logic, and hardening steps.

Step-by-Step: Detect and Patch Node2Shell

Step 1 — Identify your exposure

Run this on every Node.js host to check your version and whether HTTP/2 + Brotli is reachable:

node -v
node -e "console.log(process.versions.brotli)"
curl -sI --http2 https://your-host/ | grep -i "content-encoding"

You are vulnerable if your Node.js version is below the patched releases below AND your server accepts Content-Encoding: br on request bodies over HTTP/2.

Node.js Line Vulnerable Versions Patched Version
22.x (LTS) 22.0.0 – 22.11.0 22.11.1
20.x (LTS) 20.0.0 – 20.18.1 20.18.2
18.x (Maintenance) 18.0.0 – 18.20.4 18.20.5
23.x (Current) 23.0.0 – 23.2.0 23.2.1

Step 2 — Patch the runtime

# With nvm
nvm install 22.11.1 && nvm use 22.11.1

# With Docker — pin the base image
FROM node:22.11.1-bookworm-slim

Rebuild and redeploy. Confirm with node -v inside the running container, not just on the build host.

Step 3 — Apply the edge mitigation (do this even before patching)

If you cannot patch instantly, block the exploit path at your reverse proxy. For Nginx:

# Strip Brotli request encoding at the edge
proxy_set_header Accept-Encoding "";
if ($http_content_encoding ~* "br") {
    return 415;
}

For Cloudflare or an AWS WAF, deploy a rule matching requests where Content-Encoding contains br and the path hits your Node.js origin, then action = block.

Step 4 — Hunt for prior compromise

Node2Shell exploitation leaves fingerprints. Check for:

# Quick process-tree check
ps -eo pid,ppid,cmd | grep -E "node|sh -c"
# Recent file changes in temp dirs
find /tmp -mtime -2 -type f -ls

If anything looks off, treat the host as compromised: isolate it, rotate all environment secrets, API keys, and database credentials, and rebuild from a clean image.

Step 5 — Harden permanently

Common Issues, Alternatives, and What You Should Know

“My package manager still installs the old version.” NodeSource and distro repos lag by days. Verify with apt-cache policy nodejs or dnf info nodejs; if the patched build isn’t there yet, use the official tarball or nvm.

“We use Deno/Bun.” Neither shares Node’s Brotli/HTTP2 implementation, so this specific CVE doesn’t apply — but audit your own HTTP/2 stack, since the underlying Brotli library bug may affect other runtimes.

“We terminate TLS at a load balancer.” Good news: if your LB decodes HTTP/2 and re-encodes to HTTP/1.1 upstream, your Node origin isn’t directly reachable via the exploit path. Verify your ALB/NLB protocol settings — don’t assume.

“Is disabling Brotli enough?” It’s a mitigation, not a fix. The overflow can also be triggered through crafted response-side decompression in some configurations. Patch the runtime — the edge rule is a stopgap.

Cost of downtime vs. patch: A rolling restart of a typical Node.js fleet takes minutes. A breach from an RCE in a KEV-listed flaw costs orders of magnitude more in incident response, legal, and reputational damage. Patch first, optimize later.

Frequently Asked Questions (FAQ)

What is the Node2Shell vulnerability?

Node2Shell (also called Broccoli2Shell and HTTP2Shell) is a critical heap-overflow flaw in Node.js’s Brotli decompression handling when combined with HTTP/2 request processing. It allows unauthenticated remote code execution on servers that accept Brotli-encoded request bodies over HTTP/2.

Which Node.js versions are affected by Node2Shell?

All Node.js 18.x, 20.x, 22.x, and 23.x releases before 18.20.5, 20.18.2, 22.11.1, and 23.2.1 respectively. Check your version with node -v and upgrade to the matching patched release.

Is Node2Shell being exploited in the wild?

Yes. CISA confirmed active exploitation and added the flaw to its Known Exploited Vulnerabilities catalog, which means federal agencies must patch on a deadline — and private organizations should treat it as urgent too.

How do I know if my server was already compromised by Node2Shell?

Look for unexpected child processes spawned by node, outbound connections to unknown IPs, new files in /tmp or node_modules, and crash logs. If you find any, isolate the host and rotate all credentials.

Does disabling Brotli fix Node2Shell?

Disabling Brotli request decompression at your reverse proxy or WAF blocks the primary exploit path, but it is a temporary mitigation. You must still upgrade Node.js to a patched version to fully close the vulnerability.

Final Verdict

Treat Node2Shell as a same-day emergency, not a backlog item. Patch to Node.js 22.11.1 (or your line’s patched release) within hours, add the Content-Encoding: br block at your edge as an immediate stopgap, and run the compromise-hunt commands above before you close the ticket. CISA’s KEV listing means attackers already have working exploits — the only question is whether your fleet is exposed. If you manage more than a handful of hosts, automate version checks in CI so the next KEV entry doesn’t catch you flat-footed.