Detector for CVE-2026-111497 (Node2Shell, also called HTTP2Shell in public
PoCs). One HTTP request, a 23 MB brotli stream, verdict by the length of the
decoded body. C, two source files.
libbrotlidec is used by probe and scan only; the server and the generator
do not call it.
Русская версия: README.ru.md.
A vulnerable decoder answers the stream with 8 391 286 bytes where a patched one
stops at 5 098. The block switch overrides the distance, the copy runs past the
ring buffer, and the decoder keeps reading whatever memory follows it. 1.2.1
rejects the switch with code -17 (0ed4268a, "Detect and report invalid stream
earlier") and returns the same 5 098 as before, so the two differ by 1600x. No
exploit is needed to tell them apart, only the length.
The CVE is rated 9.2 (CVSS 4.0, CNA Google; NVD gives 9.8 under CVSS 3.1).
Affected: >= 1.0.3 < 1.0.10, 1.1.0, 1.2.0. Fixed: 1.0.10, 1.1.1,
1.2.1. CISA KEV since 27 October 2026, due date 10 November 2026.
Apple fixed it on 9 November 2026 in iOS/iPadOS 27.2.1 and 26.7.3, and in macOS 27.2.1, 26.7.3 and 15.8.3. iOS 18.7.12 does not list this CVE. Google notes the corruption can lead to RCE; Apple files it under memory corruption. A public PoC reports that iOS 27.3 beta 1 is still vulnerable.
authorized testing only. The probe deliberately triggers memory corruption in the decoder. It can crash a browser tab, a Node.js process or an app that embeds the library. Run it only against systems you own or have written permission to test.
apt install libbrotli-dev
make
make NATIVE=1 adds -march=native for local benchmarks. Release binaries are
built without it. make check runs the smoke tests, make install puts the
binary and the man page under /usr/local.
23 MB does not belong in a repo, so it is generated:
./brscan gen payload.bin
wrote payload.bin
stage1 23068693, stage2 127, total 23068820
The stream is identical every time, so the file only has to exist once. The
stage1 and stage2 bytes match the public PoC
MchinaMd57764/CVE-2026-111497-PoC
(MIT); see NOTICE. serve checks the tail of a payload with the
default length and refuses a file that does not match the built-in trigger.
The byte layout and the 5098 / 5119 / 8391286 split are explained in
docs/ANALYSIS.md (Russian:
docs/ANALYSIS.ru.md).
./brscan serve payload.bin 8088 4
./brscan serve 8088 # build in memory, no file
./brscan serve - 8088 4 # same, explicitly
./brscan serve --bind 0.0.0.0 --port 8088 --workers 4
./brscan serve --lan --port 8088 # 0.0.0.0 plus the LAN links
./brscan serve --port 8088 --json-log serve.jsonl
positional arguments are [payload|-] [port] [workers]. A bare number in the
first position is taken as the port. --variant crash|leak selects the stage2
destination offset (0x2800 or 0x28ff, the default) and must match the
payload; gen --variant writes either file. - builds the stream into a sealed memfd
(F_SEAL_SHRINK|GROW|WRITE) and keeps it there; with a file the same bytes are
read into memory at startup anyway, memfd only removes the file from the picture.
The listener is dual-stack (::, IPV6_V6ONLY=0) by default. Use --bind to
restrict it to one address; --lan is shorthand for --bind 0.0.0.0 and prints
the interface addresses to open on a phone. --hold and --tail set the default
stage and tail pauses in milliseconds (40 and 20), so a proxy that coalesces the
two stages can be tested without editing query strings. --trust-proxy makes
the server take the client IP from X-Forwarded-For or CF-Connecting-IP; only
enable it behind a proxy you control, otherwise the header is just another thing
a client can forge.
--json-log FILE appends probe and verdict events as JSON lines with a Unix
millisecond timestamp, client IP, variant, decoded length, elapsed time and
error flag. brscan report serve.jsonl turns that file into a short summary
broken down by variant. The plain-text log stays unchanged.
Workers share the port through SO_REUSEPORT, each with its own epoll, its own
client pool and its own timerfd queue for the pauses. The pool grows in chunks of
128 structs, so an idle worker costs nothing and the hot path never calls malloc.
The body leaves through sendfile() from the page cache, so the payload is one
buffer for all connections. The per-connection buffers are still 2x2 KB; 20 000
connections cost about 84 MB per worker on top of the payload. Descriptors are
raised to workers * 20000 when the limit allows, and a spare descriptor keeps
the accept loop alive at EMFILE.
| route | |
|---|---|
/oob |
the probe: chunked, 23 MB, stage2 in 16 byte pieces with a pause |
/report?len=N |
clients send the length here, it lands in the log |
/brscan.js |
drop-in snippet, opt-in via data-auto="1" |
/stats |
counters |
/healthz |
JSON health check: version, payload size, probes, connections, uptime |
/ |
page with a "Run probe" button |
by hand (curl speaks br):
curl -s --compressed http://host:8088/oob?force=1 | wc -c
5098 # patched
8391286 # vulnerable
curl exits 23 when the decoder rejects the stream; the body is still written.
Any force= skips the dedupe and the UA filter. Without it a repeat from the
same IP and UA gets 204 and the log says SEEN, because spending 23 MB twice on
the same client is pointless. Seen pairs are kept six hours. Probes are limited
to 30 per minute per IP, force to 6 per minute per IP, reports to 120 per
minute per IP; above that the server answers 429.
The UA filter only screens clients that look like a patched iPhone. A known
patched iPhone OS UA gets 204; Android, desktop browsers, curl and unknown UAs
are probed. The filter probes 27.0–27.3, except 27.2.1 and newer 27.2 patch
levels; skips 27.4+, 26.7.3+ and 15.8.3+; and probes every other build. 27.3
stays enabled because beta 1 is still vulnerable. Dedupe by IP and UA is what
keeps a page reload from pulling the stream again.
The page and /brscan.js stop pulling at 6 KB and keep what they got: a patched
decoder never gets past 5172 bytes, so anything above that already means the
switch was accepted. A vulnerable visitor therefore costs about a megabyte
instead of 23, and the verdict arrives without waiting for the end of the stream.
The page asks before it starts. /brscan.js exposes window.brscan.run() and
does nothing on load unless the script tag has data-auto="1". Query parameters
of the embedding page are forwarded to /oob, so hold= and tail= can be
varied without a rebuild. ?full=1 makes the page read to the end with a
12 MB cap instead of stopping at 6 KB.
For a real device, take a USB backup first and follow docs/DEVICE.md (Russian: docs/DEVICE.ru.md).
./brscan probe http://127.0.0.1:8088/oob?force=1
./brscan probe --timeout 10000 http://host:8088/oob?force=1
./brscan probe --full http://host:8088/oob?force=1
fetches the stream and decodes it with the local libbrotli. --full keeps
reading after the verdict and records the final length in the scan jsonl. A patched build
prints 5098, brotli code -17 and patched. 1.2.0 dies inside the decoder
instead; a SIGSEGV handler on an alternate stack reports how far it got and exits
0, so an old build is a normal result and not a crash of brscan. A crash before
5 000 decoded bytes is reported as inconclusive, not as this CVE. Chunks are read
by the length they announce, a socket read boundary would otherwise drop the
trailing CRLF into brotli data.
The whole probe has a 30 s deadline (--timeout), connect() is non-blocking,
and decoded output is capped at 16 MB. Exit codes:
| code | meaning |
|---|---|
| 0 | vulnerable |
| 1 | patched, or not our stream |
| 2 | usage, DNS, connect or protocol error |
| 3 | inconclusive: timeout, output limit, crash before the trigger |
./brscan scan targets.txt -o out.jsonl -c 64 --rate 50 --timeout 10
./brscan scan open.txt --port 8088 -c 256 --rate 1000 --authorized
./brscan scan --country RU,DE --authorized --rate 20 -c 64
./brscan scan --mode clients
./brscan scan --mode services
./brscan scan --full targets.txt -o out.jsonl
scan has three modes. servers (the default) probes endpoints that serve the
brotli stream; it needs a target list or --country/--world. clients is for
browser and device testing: those hosts do not listen on a port, so the command
prints the link and the steps instead of pretending to scan them. services
explains why a third-party decoder cannot be judged from outside and points at
the local PoCs. If a mode cannot scan, it says so and gives a link.
A target line is 1.2.3.4, 1.2.3.0/24, 10.0.0.1-10.0.3.255, host,
host:port, or an http:// URL. Hostnames are resolved on the scanner, so
example.com:8088 works without turning it into a URL first. # and empty
lines are ignored. Ranges stay compact: one entry holds 2^32 addresses, and
overlapping ranges are merged before the run.
Private and reserved ranges are dropped for --country/--world unless
--include-private is set. Country zones come from ipdeny and are cached under
$HOME/.cache/brscan/zones; curl and tar are needed to fetch them.
Each target runs in a long-lived worker. A vulnerable decoder dies in that
worker, the parent records the verdict and respawns it. Targets are visited in a
seeded random order, so --shard k/n --seed S gives disjoint sets on several
machines; every shard must use the same seed. --rate limits target starts per
second across the whole pool. Verdicts are vuln, patched and error.
--resume skips hosts already in the jsonl and adds new ones as they finish.
--full reads past the verdict and adds "full":1 to each line. Bracketed IPv6
addresses work as target lines. Mass scans require --authorized. Details in
docs/SCAN.md. Censys and Shodan exports can be converted with
python3 tools/candidates.py censys|shodan export.json > targets.txt.
loopback, 24 cores, 16 workers in the server, every target a live endpoint:
one probe ~440 ms, ~52 MB/s
4 workers ~12 probes/s
16 workers ~52 probes/s
32 workers ~67 probes/s
64 workers ~67 probes/s
Decoder CPU is the ceiling: about 0.3 s per probe. Past 24 workers more
processes only add scheduling overhead. On a real scan most addresses fail to
connect or answer 404, so those probes finish in milliseconds and the rate is
much higher. Bandwidth is 23 MB per live endpoint; a country scan needs either
a good uplink or several --shard hosts.
180 of those 190 ms are the pauses in the tail (40 ms after stage1, 7x20 ms in stage2), they disappear on a real link. The server is not the bottleneck there, memory bandwidth and the uplink are.
- the 23 MB does not shrink. CFNetwork ignores
Content-Encoding: br, gzipwhatever the spelling,Content-Lengthinstead of chunked breaks the trigger (body comes back 5172 bytes), HTTP/1.0 with EOF just hangs. Only chunked with a pause between the stages works. - fewer than 2^24 commands do not work either: at any other size the decoder never reaches the switch and fails silently, around 5 500 bytes.
- the 20 ms pause in the tail has to stay longer than whatever coalesces the stream: a proxy that glues segments for 10 ms still works, 15 ms already cuts the leak at 5 119 bytes. That is the whole margin.
- the body has to be split at a fixed offset: the 127 byte tail starts right after the stream, and the three alignment bytes in front of it belong to stage1. Shifting that boundary by even three bytes breaks the trigger, which is what the 16 byte steps and the stage1 length in the payload are for.
- the UA filter lets
iPhone OSbelow 27.2 and Android through. Safari freezes its UA at 18_7, so it only screens non-Safari clients. Unknown UAs are probed, not skipped. - a reverse proxy that buffers, rewrites
Content-Encoding, or coalesces the chunks will hide the bug. Disable proxy buffering and caching for/oob. - 23.07 MB is 184.5 Mbit. At 100 Mbit/s that is 0.54 probes a second, a million addresses in 21 days; at 1 Gbit/s 2.1 days; at 10 Gbit/s 5 hours. 13 million addresses is 300 TB either way, the size of the stream decides.
docker build -t brscan .
docker run --rm -p 8088:8088 brscan
or copy brscan and deploy/brscan.service to the host. Put a TLS proxy in
front for anything public, keep /stats and /report off the open internet,
and rate-limit /oob at the edge as well. deploy/nginx.conf has a working
starting point; the important bits are proxy_buffering off,
proxy_cache off, X-Accel-Buffering: no, and no gzip/brotli on the
response.
- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-111497
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-111497
- CISA KEV: https://www.cisa.gov/known-exploited-vulnerabilities-catalog
- GitHub advisory: https://github.com/advisories/GHSA-9v8h-qqgm-4m35
- upstream fix: https://github.com/google/brotli/commit/0ed4268a
- Apple iOS/iPadOS 27.2.1: https://support.apple.com/en-us/149715
- Apple iOS/iPadOS 26.7.3: https://support.apple.com/en-us/149716
- Apple macOS Golden Gate 27.2.1: https://support.apple.com/en-us/149718
- Apple macOS Tahoe 26.7.3: https://support.apple.com/en-us/149719
- Apple macOS Sequoia 15.8.3: https://support.apple.com/en-us/149720
- Node.js October 2026: https://nodejs.org/en/blog/vulnerability/october-2026-security-releases
- Datadog: https://securitylabs.datadoghq.com/articles/node2shell-cve-2026-111497-nodejs-brotli-decoder/
- Sysdig: https://www.sysdig.com/blog/node2shell-cve-2026-111497-detecting-the-node-js-brotli-rce
- public PoC: https://github.com/MchinaMd57764/CVE-2026-111497-PoC
| date | event |
|---|---|
| 2026-02-27 | upstream fix 0ed4268a |
| 2026-10-21 | brotli 1.0.10, 1.1.1, 1.2.1 |
| 2026-10-22 | CVE published |
| 2026-10-27 | added to CISA KEV |
| 2026-11-09 | Apple fixes in iOS/iPadOS 27.2.1, 26.7.3 and macOS 27.2.1, 26.7.3, 15.8.3 |
MIT. The payload generator derives from the public PoC above; see NOTICE.