...

Node2Shell – A Malformed Brotli Body That Crashes, and Can Shell, a Node.js Service

Securify

9.2

CVSS 4.0

CRITICAL

Severity

CWE-787

OOB Heap Write

22·24·26

Affected Lines

CISA KEV

In the Wild

Oct 21

Patch Released

TL;DR — What You Need to Know Right Now

CVE-2026-111497 (“Node2Shell”) is an out-of-bounds heap write in the Brotli decompressor that ships compiled inside Node.js. Any service that decompresses attacker-controlled Brotli — an Express / body-parser route that accepts a Content-Encoding: br body, or a fetch() reading a Brotli response from an upstream you don’t control — can be crashed with a single request, and on the right build, driven to execute code. It’s CISA-KEV listed, actively exploited, with a 10 November federal deadline. The only complete fix is upgrading Node.js to 22.23.4 / 24.22.1 / 26.12.1. Critically: the vulnerable code is in the runtime, not an npm package — npm audit will not see it.

  1. Context: Why Node2Shell Is Different

Most critical CVEs are a bug in one product. Node2Shell is a bug in one library that happens to live inside dozens of them. The flaw is in Google’s Brotli decoder, and Brotli is everywhere modern software moves compressed data — so the same defect surfaced in Node.js, Bun, .NET, PowerShell, Python’s Brotli bindings, Envoy, and Istio within days of each other.

For a Node.js shop, the dangerous part is where the code lives. The Brotli decoder is compiled into the Node binary under deps/brotli — it is not a dependency in your package.json. That single fact defeats the control most teams rely on: a clean npm audit tells you nothing, your SBOM probably lists your packages but not the interpreter underneath them, and the vulnerability sits below the line your tooling looks at.

The business exposure is straightforward. If you run Node 22, 24, or 26 below the fixed patch level, and any request path or outbound call decompresses Brotli you didn’t produce, an unauthenticated attacker on the network can take the process down on demand — and, as researchers have demonstrated on stock Node images, potentially run code as the service account. CISA has already recorded exploitation in the wild.

What makes this attractive to attackers, and dangerous to defenders, is that it needs nothing special. No credentials, no user interaction, no custom application bug — just a network path to a service that decompresses Brotli, and a stock, unmodified Node build. That combination is what turns a single library flaw into mass-scannable, cross-runtime exposure, and it’s why the same week saw coordinated patches from Node.js, Microsoft, and Python package maintainers rather than a quiet point release.

  1. The Vulnerability — Root Cause

2.1 How the decoder becomes reachable

A bare Node HTTP server does not decode an incoming Brotli body just by receiving it. The decoder only runs when something hands it Brotli to decompress, which in practice means three paths — and knowing which ones you have is how you scope the whole response:

›  Inbound bodies. Express 5 / body-parser 2.x transparently decode a Content-Encoding: br request body before your handler runs. This is the internet-facing path being probed right now.

›  Outbound responses. Code using fetch() / undici to read a Brotli-compressed response from a third-party API, webhook target, or user-supplied URL.

›  Out-of-band. Workers or jobs that Brotli-decompress attacker-supplied blobs directly through zlib.

2.2 The vulnerable code — one unchecked return value

Brotli streams are built from typed blocks, and the decoder is supposed to validate a block-type-and-length field before acting on it. In the vulnerable versions that validation function returns a boolean instead of a proper error code, so an invalid block-type switch — declaring one type, then switching mid-stream — is never rejected. The decoder keeps running in a state it should have refused, then performs a 16-byte copy whose destination is its ring buffer plus an attacker-shaped signed displacement: a classic out-of-bounds write (CWE-787) caused by an unchecked return value (CWE-252).

Here is the defect in shorthand, from Google’s Brotli fix (commit 0ed4268):

// deps/brotli — c/dec/decode.c
 
// [VULNERABLE]  returns BROTLI_BOOL, so an invalid block-type
// switch is accepted and decoding continues in a bad state
DecodeBlockTypeAndLength(...) -> BROTLI_BOOL
 
// the resulting 16-byte out-of-bounds write primitive:
movdqu (%r8), %xmm0     ; src: ring buffer (attacker-controlled prefix)
movups %xmm0, (%rdi)    ; dst: ring buffer + signed 32-bit displacement
 
// [PATCHED]  returns an error code; the invalid switch is rejected
// Fixed in Brotli 1.0.10 / 1.1.1 / 1.2.1; shipped in Node 22.23.4 / 24.22.1 / 26.12.1

What makes this more than a crash is the shape of the write. The destination is computed from the ring buffer base plus a signed 32-bit displacement the attacker influences through the malformed stream, so the corruption isn’t a fixed one-byte overflow — it’s a 16-byte copy that can be steered across a wide range of heap memory. Whether that lands on an unmapped page (crash) or on a useful object (exploitation) comes down to heap layout, which is why the same bug produces a guaranteed DoS for everyone and a conditional RCE for an attacker who does the grooming.

  1. Exploitation — From Malformed Body to Crash to Shell

Nothing exotic reaches the decoder. The attacker sends an ordinary HTTP request whose only unusual property is a Brotli content encoding and a body that decompresses badly. If the receiving middleware decodes Brotli request bodies, the malformed stream hits the vulnerable decoder before the application’s own code ever runs.

# Representative request (malformed Brotli bytes omitted)
POST /api/ingest HTTP/1.1
Host: target
Content-Type: application/json
Content-Encoding: br        # tells Express/body-parser to Brotli-decode
Content-Length: <n>
 
<Brotli stream that declares one block type, then switches mid-stream>
# body-parser decodes it before the route handler runs -> OOB write

The guaranteed result is a crash. A single request carrying the crafted stream drives the decoder out of bounds and the process takes a SIGSEGV (exit 139) — no auth, no groundwork, no retries. Point it at any exposed Brotli-decoding endpoint and the service goes down; for a stateless API behind a load balancer that means a crash loop, and for a singleton worker it means an outage.

The same memory-write primitive can be steered into code execution. The exploit shapes the Brotli stream so the out-of-bounds write lands a ROP chain, then runs a command as the service account. In a lab this needs the stars to align — a non-PIE Node binary, a Worker-thread heap layout, and application-specific heap grooming — and on the internet-facing Express path, turning the reliable crash into a shell requires per-application heap profiling, the same wall independent researchers (Imperva, ELLIO) hit before demonstrating code execution on official Node images. The honest reading is that DoS is free and RCE is proven-but-conditional; since CISA lists this as exploited, defend as if RCE is on the table. In practice an attack runs recon first (mass scanners mapping which hosts decode Brotli at all), then a benign probe to confirm a vulnerable, reachable endpoint, then the malformed stream — the plain variant to crash, or the groomed variant to execute code. Where execution succeeds it runs as the service account, so the blast radius is whatever that account can reach: environment secrets, mounted credentials, internal services, and lateral movement from there.

  1. Impact — Who’s Exposed and How Badly

Exposure is a function of two things: the runtime version, and whether anything feeds it attacker-controlled Brotli. The version picture:

Runtime / line

Vulnerable

Fixed

Node.js 22.x

22.0.0 – 22.23.3

22.23.4

Node.js 24.x

24.0.0 – 24.22.0

24.22.1

Node.js 26.x

26.0.0 – 26.12.0

26.12.1

Node.js 20.x / 23.x / 25.x & older

All (EOL)

No fix — migrate off

Bun

< 1.4.4

1.4.4

Brotli library (upstream)

1.0.3 – 1.2.0

1.0.10 / 1.1.1 / 1.2.1

Imperva, who did much of the public analysis, tested the two routes that matter most in practice: an application using fetch() to read a Brotli-compressed response from an upstream, and an Express 5 / body-parser 2 service decoding a Brotli-compressed request body. Both reach the vulnerable decoder. A useful rule of thumb: you are exposed wherever your code decompresses Brotli it did not produce itself — and note that a CDN or proxy that adds Brotli for clients does not shield an origin that independently decodes attacker-supplied Brotli.

One library, many badges. The same decoder ships in .NET, PowerShell, Python Brotli packages, Envoy, and Istio. If you patch only Node you’ve closed one door in a house with several. Treat this as a cross-runtime sweep driven by your asset inventory, not a Node-only fire drill.

  1. Detection — What to Check Right Now

5.1 Are you running a vulnerable, reachable runtime?

# 1. Version — vulnerable below the fixed patch level
node -v        # < 22.23.4  |  < 24.22.1  |  < 26.12.1   (EOL 20/23/25 = unfixable)
bun --version  # < 1.4.4
 
# 2. Reachability — do you actually decode attacker Brotli?
#   - Express 5 / body-parser 2.x on body-accepting routes
#   - fetch() / undici reading responses from untrusted upstreams
#   - any zlib Brotli decompression of untrusted input in workers

5.2 Hunt in your logs

Two cheap queries tell you whether anyone has tried, and whether anything fell over:

# Requests carrying a Brotli-encoded body reaching the origin
#   (log $http_content_encoding in your log_format if you don't already)
grep -i 'content-encoding: br' /var/log/nginx/access.log
 
# The post-exploitation tell: Node workers dying on SIGSEGV / exit 139
journalctl -u your-node-svc | grep -E 'SIGSEGV|signal 11|code=dumped'
pm2 logs --err | grep -i 'code 139'
kubectl get pods | grep CrashLoopBackOff

5.3 Non-destructive remote probe

For assets you can’t inventory from the inside, confirm reachability without a weaponized payload: send a valid Brotli request and a malformed/truncated one, watch for a divergence in how the endpoint responds, then a benign control to confirm it stayed up. No exploit stream, no command — safe against your own exposed surface, and how public scanners (e.g. Assetnote’s) operate.

5.4 What the SOC should alert on

Signal

What to look for

Request pattern

POST/PUT with Content-Encoding: br to endpoints with no reason to accept compressed bodies

Oversized probe

Brotli bodies with a very large declared/decompressed size (public probes stream ~23 MB); Expect: 100-continue abuse

Post-exploit crash

Node workers exiting SIGSEGV / code 139; pm2 / systemd / Kubernetes CrashLoopBackOff

Egress anomaly

Unexpected outbound connections from a web/worker process right after a compressed-body request

  1. Remediation — Prioritized and Practical

If You’re Running a Vulnerable Node.js Version Right Now

Upgrade to 22.23.4 / 24.22.1 / 26.12.1 immediately — this is the only complete fix. If you can’t patch within hours, strip or reject Content-Encoding: br at your edge for endpoints that have no business accepting it. KEV remediation is due 10 November.

6.1 Immediate (do today)

›  Upgrade Node.js to 22.23.4 / 24.22.1 / 26.12.1+ across hosts, base images, CI runners, and serverless layers — then rebuild and redeploy. Patching the host package isn’t enough if images bundle their own Node.

›  Migrate off EOL lines (20/23/25 and older) — confirmed vulnerable, never patched. Update Bun to ≥ 1.4.4.

›  Sweep the other runtimes that bundle Brotli — .NET, PowerShell, Python packages, Envoy/Istio — per each vendor’s advisory.

6.2 If upgrading is delayed

›  Strip or reject Content-Encoding: br on inbound requests at the CDN / WAF / reverse proxy, and cap maximum decompressed size.

›  Disable Brotli request-body decoding in middleware; avoid decompressing Brotli from untrusted upstreams until patched.

# Nginx — reject Brotli-encoded request bodies at the edge
location /api/ {
    if ($http_content_encoding ~* "br") { return 415; }
    client_max_body_size 1m;
    proxy_pass http://node_backend;
}

6.3 Structural (and the audit angle)

›  Extend SBOM / vulnerability scanning to cover the runtime itself, not just npm packages — this bug class lives below the dependency tree.

›  Stand up a KEV-triggered emergency-patch SLA that runs outside your monthly cadence; make edge normalization of compression headers a standing control.

For the audit and the security questionnaire: patching every Node runtime to the fixed version with before/after evidence (version output, change ticket, redeploy record) and the KEV item closed on time satisfies SOC 2 CC7.1, ISO 27001 A.8.8, PCI DSS 6.3.3, and NIST CSF ID.RA/PR.PS-02. That’s enough to pass the audit and unblock the deal. The emergency-patch lane above is the mature-posture step that stops the next KEV from being a fire drill.

  1. Lab Validation — Reproducing CVE-2026-111497 Locally

To validate both ends of the impact spectrum firsthand, we stood up an isolated Docker lab on loopback: an Express body-parser target (Node 24.22.0, port 3001) for the denial-of-service path, and a Worker record-transform target (Node 24.9.0, port 3000) for code execution. Everything below is real captured output, not illustration — and nothing is pointed at a system we don’t own.

7.1 Lab environment setup

# bring up both intentionally-vulnerable targets
cd lab && docker compose up -d express-dos worker-rce
 
# DoS reproducer  -> Express body-parser on :3001
python3 dos_express.py --target 127.0.0.1 --port 3001
 
# RCE exploit     -> Worker record-transform on :3000
python3 rce_worker.py --target 127.0.0.1 --port 3000 \
    --callback-host host.docker.internal --callback-bind 0.0.0.0 --timeout 60

7.2 Denial of service — Express body-parser (:3001)

Before the payload, the target is alive: a request to the root path returns Express’s own “Cannot GET /” 404, confirming the server is up and routing.


Figure 1 — Target healthy before exploitation: Express answers with “Cannot GET /” on :3001.

A single request carrying the Brotli trigger in a Content-Encoding: br body drives the decoder out of bounds. The process segfaults (exit 139) and dies.

Figure 2 — dos_express.py confirms the crash: PASS, service_down=True (SIGSEGV expected).

After the crash the listener is gone — the same URL no longer resolves and the browser reports connection refused. The runtime segfaulted; it did not throw and recover.

Figure 3 — Target down after exploitation: :3001 refuses the connection (ERR_CONNECTION_REFUSED).

7.3 Remote code execution — Worker record-transform (:3000)

Against the Worker target the exploit converts the same write primitive into execution: it runs the shaped Brotli stream through the decoder, lands a ROP chain, and executes a command on the box, proving it by returning fresh id output over the callback channel.

Figure 4 — rce_worker.py confirms execution: PASS, fresh id output uid=1000(node) gid=1000(node), with a unique proof token.

7.4 What the output confirms

›  DoS path: one Content-Encoding: br request takes the Express process from healthy (Figure 1) to segfaulted and unreachable (Figures 2–3), with no authentication and no prerequisites.

›  RCE path: the Worker exploit returns fresh id output as uid=1000(node) with a unique proof token (Figure 4) — not a canned string, but a command executed on the target and echoed back over the callback channel.

›  Service-account impact: execution runs as the non-root node user, confirming the blast radius is that account’s reach, not the host root.

Lab Validation Summary

Express target (Node 24.22.0): a single Content-Encoding: br request reliably crashes the process — DoS proven, zero prerequisites. Worker target (Node 24.9.0): full code execution as uid=1000(node) with a fresh id proof token — RCE proven, but conditional on a non-PIE binary, Worker heap layout, and application-specific grooming. Guaranteed crash, demonstrated shell. Patch as if RCE is on the table.

7.5 Why the internet-facing path reliably crashes but not always shells

The Express body-parser route is the realistic attack surface, and it dependably crashes — but converting that same route into code execution is harder than the Worker lab suggests. On the Express path the ring buffer and decoder state land in different heap arenas, outside the signed-displacement window; ASLR varies the offsets per process; and Express error responses leak no addresses to anchor a chain. Bridging that gap takes per-application, GDB-assisted heap profiling, which is exactly the limitation upstream researchers reached. For defenders the conclusion is unchanged: the DoS is universal and trivial, the RCE is real where an attacker invests in profiling, and the patch closes both.

  1. Disclosure Timeline

The window between the fix and active exploitation was days, which is why the compiled-dependency blind spot matters so much — teams that couldn’t see the bug lost the head start the patch was supposed to give them.

Date (2026)

Event

Oct 21

Node.js October security release; fixes shipped in 22.23.4 / 24.22.1 / 26.12.1 (Brotli 1.0.10 / 1.1.1 / 1.2.1)

Oct 24

“HTTP2Shell” naming spreads; code execution demonstrated on an official Node.js image

Oct 26

Exploit traffic carrying the public exploit observed in the wild

Oct 27

Added to CISA KEV as a Google Brotli unchecked-return-value flaw; federal remediation due Nov 10

Conclusion

Node2Shell is one unchecked return value in a compression library that happens to be welded into the Node.js runtime. The lab run above shows exactly what the in-the-wild campaign is exercising: an unauthenticated request that decompresses to a crash, and — on the right build — to a shell. The fix is a version bump to 22.23.4 / 24.22.1 / 26.12.1, and the guaranteed denial-of-service alone clears the bar for emergency change.

The broader lesson is operational. The vulnerable code sat below the line your dependency scanning looks at, which is why asset inventory that includes the runtime, a KEV-triggered patch SLA, and edge controls on compression headers matter more than another npm audit. The teams that had those processes patched this in a day. Everyone else is on CISA’s clock.

Leave a Reply