Lab fix verification · body-parser

Do the tests body-parser's fix added fail on 2.3.0 and pass on 2.4.0?

  • should not crash on trailing bytes after a gzip body: 2.3.0 fails, 2.4.0 passes
  • should not crash when an unsupported charset rejects a compressed body: 2.3.0 fails, 2.4.0 passes

Measured Nov 26, 2026 on our own machine. How we tested · Raw data (JSON)

On this page · 5 sections
  1. body-parser 2.3.0: Both Crash Tests Fail
  2. Two Tests Pass on Both Versions
  3. Self-Test: 2.4.0 Gave the Same Outcome Twice
  4. Why the Crash Happens: Upgrade or Set inflate to false
  5. Sources

TL;DR

In our test, two of the tests that body-parser's fix commit added or changed fail on 2.3.0 and pass on 2.4.0. Both cover compressed request bodies. The advisory's vulnerable range runs from 2.0.0 through 2.3.0, and our test covered only the 2.3.0 line.

body-parser 2.3.0: Both Crash Tests Fail #

Trailing-Bytes Gzip Test #

The test "should not crash on trailing bytes after a gzip body" failed on 2.3.0 and passed on 2.4.0 in our test. The code is in body-parser test/json.js at commit f7075ea. Its name is consistent with the trailing-bytes scenario that the Express.js advisory on CVE-2026-111181 describes. We did not verify the test payload against the advisory's reproduction, so this result shows the failing behaviour only for the test as written.

On 2.4.0 the same test passes, and 2.4.0 is the fixed version that the advisory lists. For 2.3.0 with request decompression enabled, the advisory describes that crash as a single-request denial of service.

Note

Background: The Express.js advisory explains that the decompression stream keeps receiving data after body-parser has already called next(). The decoder reaches the end of the valid gzip member but does not close. Trailing bytes then emit an error, and with no error listener left, Node raises an uncaught exception and the process crashes.

Unsupported-Charset Test #

The test "should not crash when an unsupported charset rejects a compressed body" also failed on 2.3.0 and passed on 2.4.0 in our test. Its code is in the same body-parser test/json.js at commit f7075ea. The result is a pass or fail outcome per version, which is what our test records for this check.

Two Tests Pass on Both Versions #

The tests "should finish the request when the decompressor finishes early" and "should preserve other consumers of the request body" passed on 2.3.0 and on 2.4.0 in our test. Because they pass on both, they do not separate the two versions. They are still part of the set that the fix commit added or changed, as shown in the body-parser test/json.js file at commit f7075ea.

Self-Test: 2.4.0 Gave the Same Outcome Twice #

Our self-test ran the fix's tests twice on 2.4.0, each run in its own container, and every test had the same outcome both times. All four tests passed in both runs.

Why the Crash Happens: Upgrade or Set inflate to false #

The Express.js advisory, written by Gavin Stuart and published October 28, 2026, lists body-parser 2.0.0 through 2.3.0 as vulnerable, fixed in 2.4.0. It also lists 1.20.8 and earlier as vulnerable, fixed in 1.20.9. Our test covered only the 2.3.0 and 2.4.0 lines, so our test did not show the 1.20.9 fix.

The advisory's workaround is to set inflate to false, which rejects encoded requests before a decompression stream is created. The advisory warns that this rejects compressed bodies, so it fits only applications that do not need them. The advisory's snippet is shown below, limited to its two lines.

JavaScript
import bodyParser from 'body-parser';
app.use(bodyParser.json({ inflate: false }));

The Sentinel’s Call

Any deployment on body-parser 2.0.0 through 2.3.0, or 1.20.8 and earlier, should move to 2.4.0 or 1.20.9 as the advisory directs. Our test found the trailing-bytes and unsupported-charset tests failing on 2.3.0 and passing on 2.4.0, and it did not cover the 1.x line. If compressed request bodies are not needed, set inflate to false first while the upgrade is planned.

Our judgement, drawn only from the facts and sources above.

How we tested

  • ProcessorAMD Ryzen 7 7800X3D (8 cores, 16 threads)
  • Memory32 GB RAM
  • SystemWindows 11 Pro, Docker Desktop (WSL 2)
  • ContainersDocker Engine 29.9.3

What we ran

  • 2.3.0 body-parser 2.3.0 on node:22-slim sha256:e9f565d32859…
  • 2.4.0 body-parser 2.4.0 on node:22-slim sha256:e9f565d32859…

Self-test 2.4.0 against 2.4.0: the fix's tests twice: every test had the same outcome both times.

Method

  • The tests that commit f7075ea added or changed (test/json.js), read from expressjs/body-parser at that commit and run unchanged with mocha against each published version
  • Which tests it added or changed: each test's name and code at the commit against the commit before it, listed with mocha --dry-run
  • Each version in its own container: installed from npm without install scripts, then the network cut
  • Before the vendor's tests went in, each container was read back: no mount, network or device, no added rights, not root; it was removed after
  • 2.4.0 ran the tests twice, in two containers (the self-test)
Reproduce it
Commands
docker run --rm -it node:22-slim bash
npm install --ignore-scripts [email protected] mocha@^11.7.6 [email protected] (and 2.4.0 in a second container)
Copy test/ from https://github.com/expressjs/body-parser/tree/f7075eae3a84c3473ab4bf0a777da28db208e916 into node_modules/body-parser/ (with its helpers)
npx mocha --check-leaks node_modules/body-parser/test/json.js

Limits

  • Only the tests that the fix commit added or changed count; the package's other tests are not part of this check.
  • The published package from npm is tested, not the repository's source, on Node.js 22 only.
  • A passing test shows the fixed behaviour on our machine; it is not a security audit of the package.

Raw data (JSON) · How we test

Sources

  1. CVE-2026-111181: Denial of service in body-parser · Express.js expressjs.com · Oct 28, 2026

Next reading

Edited and approved by Jarosław Krzemiński. Spotted a mistake? Report a correction or read the corrections policy.