NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

CVE-2026-111181: body-parser vulnerable to Denial of Service via trailing bytes after a compressed request body

highCVSS 3.1 7.5GHSA-27r3-jxmh-p828

body-parser, the Express request-body middleware, lets one unauthenticated HTTP request crash a Node.js process. A compressed body followed by trailing bytes makes the decompression stream throw an uncaught error. Versions 2.0.0 up to 2.4.0, and everything before 1.20.9, are affected. Upgrade to 2.4.0 or 1.20.9.

Published Oct 23, 2026 · Analysis Nov 1, 2026

What an attacker can do

When a request carries a Content-Encoding such as gzip, body-parser pipes the body into a decompression stream. After it reads the body, it leaves that stream piped and attaches no error listener. If the payload is one valid compressed frame plus extra bytes, the app decodes it and answers normally. The extra bytes then reach the finished decoder, which emits an error. Node re-throws it as an uncaught exception and the process exits.

The attacker needs only network access to the server. No login and no matching route is required, because body parsing runs before routing. Default options are enough. A single small request can take down an Express service, and a loop of requests keeps it down until the process supervisor gives up. The CVSS vector shows availability impact only: no data is read or changed.

Who is affected

Affected: body-parser >= 2.0.0, < 2.4.0 and < 1.20.9. Any app that uses express.json(), express.urlencoded() or body-parser directly with default options is exposed, because inflate defaults to true. Express pulls body-parser in as a dependency, so check the installed tree, not just your own package.json.

npm ls body-parser

body-parser

Ecosystem
npm
Affected
>= 2.0.0, < 2.4.0
Fixed in
2.4.0
Check
npm ls body-parser

body-parser

Ecosystem
npm
Affected
< 1.20.9
Fixed in
1.20.9
Check
npm ls body-parser

How to fix it

Upgrade to body-parser 2.4.0 (2.x line) or 1.20.9 (1.x line).

npm install [email protected]

If Express pins an older copy, update Express or use an overrides entry for body-parser in package.json. The fix, in lib/read.js, unpipes and destroys the decoder once the body is read, adds a no-op error listener, and calls req.resume() to drain trailing bytes. It also moves the unsupported-charset 415 check ahead of stream creation.

Workaround: pass inflate: false to the middleware if you do not need compressed request bodies. Encoded requests are then rejected before any decompression stream exists.

How to tell if you were hit

Look for Node processes that exit or restart without a normal shutdown, with an uncaught exception from a zlib stream in the stack trace, right after a request that had a Content-Encoding header. Check access logs for POST requests with Content-Encoding: gzip or deflate just before each restart, especially from one source address. Repeated crash loops under a process manager or container restart count are a strong sign. Compare the installed body-parser version against the fixed ones to confirm exposure.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

A single request can crash any application using body-parser with default options. When a request carries a Content-Encoding (for example gzip), body-parser pipes it into a decompression stream and, after reading the body, leaves that stream piped with no error listener. A payload of one valid compressed frame followed by trailing bytes decodes and the application responds normally, but the trailing bytes then reach the already-finished decoder, which emits an error that is re-thrown as an uncaught exception and terminates the process. No authentication or matching route is required, since parsing runs before routing.

Patches

Fixed in body-parser 2.4.0 and 1.20.9. Upgrade to one of these versions.

Workarounds

Pass inflate: false to the body-parser middleware if the application does not need to accept compressed request bodies. This rejects encoded requests before any decompression stream is created.

Credited to blue2cat, UlisesGascon, bjohansebas, Phillip9587.

Questions

Does CVE-2026-111181 need authentication?

No. The request is parsed before routing, so no login and no valid route is needed. Any client that can reach the HTTP port can send the crafted compressed body.

Can I avoid the crash without upgrading?

Yes, if you do not need compressed request bodies. Set inflate: false on the body-parser middleware and encoded requests are rejected before a decompression stream is created. Upgrading is still the recommended fix.

Is this exploited in the wild?

The sources do not report exploitation, and it is not in CISA's KEV catalog. The advisory describes a simple one-request crash, so a proof of concept is easy to build.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More npm vulnerabilities

All npm entries