Node2Shell CVE-2026-111497: How to Check and Patch Node.js
Node2Shell (CVE-2026-111497) is a Brotli decoder flaw in Node.js. Upgrade to 22.23.4, 24.22.1 or 26.12.1, or block br request bodies at the proxy until you can.
Node2Shell (CVE-2026-111497) is an out-of-bounds write in the Brotli decoder bundled with Node.js, triggered by malformed compressed input. The fix is to upgrade to 22.23.4, 24.22.1 or 26.12.1, released on 2026-10-21. "Node2Shell" is a nickname used by security vendors and the press; the official Node.js advisory and the CVE record use only the number.
The Node.js October 21, 2026 security release states the condition: an attacker who can supply Brotli data that an application decompresses with node:zlib can corrupt process memory, leading to a crash, disclosure of process memory, or remote code execution. It affects 26.x, 24.x and 22.x, and Node.js rates it high. The CVE record files the same number against the Google Brotli library 1.0.3 through 1.2.0 and carries a CVSS v4.0 score of 9.2 (Critical).
The other nine Node.js CVEs fixed that day are covered in Check your version against the Node.js October security releases. The Ubuntu libbrotli1 side is in Ubuntu 24.04 Brotli USN-8956-1.
[1] Compare the running Node.js version with the fixed releases. Run node -v on the host, or the same command inside the container image.
| Line | Fixed in |
|---|---|
| 22.x | 22.23.4 |
| 24.x | 24.22.1 |
| 26.x | 26.12.1 |
The advisory shipped fixes for 26.x, 24.x and 22.x only. It also says End-of-Life versions are always affected when a security release occurs, so move 20.x and older to 22.x or later.
Versions printed from the official image tags:
$ for t in 22.23.3 22.23.4 24.22.0 24.22.1 26.12.0 26.12.1; do docker run --rm --network none node:$t-alpine node -p "process.versions.node + ' brotli ' + process.versions.brotli + ' zlib ' + process.versions.zlib"; done22.23.3 brotli 1.1.0 zlib 1.3.1-e00f70322.23.4 brotli 1.1.0 zlib 1.3.1-e00f70324.22.0 brotli 1.2.0 zlib 1.3.2.1-motley-285e94b24.22.1 brotli 1.2.0 zlib 1.3.2.1-motley-285e94b26.12.0 brotli 1.2.0 zlib 1.3.2.1-motley-456ae7326.12.1 brotli 1.2.0 zlib 1.3.2.1-motley-456ae73The brotli value is the same before and after the fix. Decide by the Node.js version, not by process.versions.brotli.
[2] Find out whether your app decompresses Brotli data that someone else controls. This tells you how urgent the upgrade is.
| Path | Source |
|---|---|
| Express 5 / body-parser 2.x request bodies | README: all parsers inflate gzip, br, deflate and zstd bodies automatically, and inflate defaults to true. The changelog adds Brotli support in 2.0.0 |
fetch() responses | undici decodes Content-Encoding: br responses with zlib.createBrotliDecompress (except HEAD, CONNECT, null-body statuses and redirects it follows) |
| Direct calls in your code or a dependency | zlib.brotliDecompress, brotliDecompressSync, createBrotliDecompress |
Check the body-parser version with npm ls and search for decompression call sites. This is an empty project with only Express 5 installed:
$ npm ls body-parser$ grep -rnE "createBrotliDecompress|brotliDecompress" node_modulesapp@1.0.0 /srv/app`-- express@5.3.0 `-- body-parser@2.4.0 node_modules/body-parser/lib/read.js:224: return zlib.createBrotliDecompress()An Express 5 service that accepts JSON or forms runs request bodies from anyone through this path. A service that calls outside URLs with fetch() can receive the same kind of data in a response. An empty grep result does not mean you are safe: it misses renamed calls and bundled files.
[3] Upgrade. Install the new release the way you installed Node.js, then restart the processes. A process that is already running keeps using the old binary.
- Official binaries or a version manager: get the release above from Node.js downloads.
- Containers: a loose tag such as
FROM node:24builds from the old image if one is still cached. Rundocker pull, rebuild the image, then confirm withdocker run --rm <image> node -v. If something breaks, roll back by running the previous image tag. - Bun: upgrade to 1.4.4 or later. The Bun v1.4.4 release notes (2026-10-22) list Brotli among the areas touched by security fixes but do not name a CVE.
[4] If you cannot upgrade right away, cut down the request-body exposure first. The flaw lives in the runtime, so this is a stopgap until you upgrade, and it does nothing for fetch() responses.
If nginx sits in front, answer 415 to any request whose Content-Encoding contains br. The two parts go in different places: per the nginx docs, map is allowed only in the http context, and if only in server or location.
First put the map in the http block. The stock nginx.conf reads conf.d/*.conf inside http, so a new file /etc/nginx/conf.d/reject-br-map.conf works.
map $http_content_encoding $reject_br { default 0; "~*(^|[\s,])br([\s,;]|$)" 1;}Then add only the if inside the existing server block of the site you want to protect, outside any location. The location / below is just for the test; keep your real location blocks as they are.
server { listen 8080; server_name localhost; if ($reject_br) { return 415; } location / { return 200 "ok\n"; }}Check syntax with nginx -t and, if it passes, apply with nginx -s reload. If the map also ends up inside server, the test fails as below; as long as you did not reload, the running configuration is untouched.
$ nginx -t2026/10/27 01:52:24 [emerg] 1#1: "map" directive is not allowed here in /etc/nginx/conf.d/default.conf:5nginx: [emerg] "map" directive is not allowed here in /etc/nginx/conf.d/default.conf:5nginx: configuration file /etc/nginx/nginx.conf test failedTo remove it, delete the if block and reject-br-map.conf, then run the same two commands again. Legitimate clients that upload Brotli-compressed bodies will also get 415.
Results from an nginx:stable container with both files in place, sending a plain hello body and changing only the header:
$ nginx -tnginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is successful$ curl -s -o /dev/null -w "%{http_code}\n" -H "Content-Encoding: gzip" -d hello http://127.0.0.1:8080/200$ curl -s -o /dev/null -w "%{http_code}\n" -H "Content-Encoding: br" -d hello http://127.0.0.1:8080/415$ curl -s -o /dev/null -w "%{http_code}\n" -H "Content-Encoding: gzip, br" -d hello http://127.0.0.1:8080/415$ curl -s -o /dev/null -w "%{http_code}\n" -H "Content-Encoding: BR" -d hello http://127.0.0.1:8080/415$ curl -s -o /dev/null -w "%{http_code}\n" -H "Content-Encoding: gzip" -H "Content-Encoding: br" -d hello http://127.0.0.1:8080/415The request with the header split across two lines also got 415. Without a proxy, turn off inflate in the app, for example express.json({ inflate: false }). The body-parser README says compressed bodies are then rejected, which includes gzip bodies.
[5] Check distribution packages and images separately. The Ubuntu 24.04 nodejs package uses a different version scheme from upstream and loads Brotli from the system library.
nodejs: Candidate: 18.19.1+dfsg-6ubuntu5---18.19.1 brotli 1.1.0 libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x000079153fd70000)If ldd /usr/bin/node | grep brotli shows libbrotlidec.so.1, the fix arrives through a libbrotli1 package update. For the package version and restarting processes that hold the old library, follow the USN-8956-1 post and Find processes that still need a restart with needrestart. If the line is missing, the build carries its own Brotli; judge it by the Node.js version as in step [1].
Where checks get confusing
process.versions.brotlidid not change across the fix (1.1.0on 22.x,1.2.0on 24.x and 26.x). Compared with the Brotli fixed versions in the CVE record (1.0.10, 1.1.1, 1.2.1), even a patched Node.js looks unpatched.- Bun puts a Node.js-like value in
process.versions.node. Both 1.4.3 and 1.4.4 report26.3.0, so a script that checks the Node.js version will misjudge Bun. Usebun --version.
1.4.3 node-compat 26.3.0 brotli undefined1.4.4 node-compat 26.3.0 brotli undefined- The nginx rule matches only the token
br.Content-Encoding: brotlipassed with 200. body-parser decodes the namebr, so the rule still covers that path.