CVE-2026-111181: body-parser vulnerable to Denial of Service via trailing bytes after a compressed request body
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-parserbody-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: falseon 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
Read for this analysis:
- https://github.com/expressjs/body-parser/security/advisories/GHSA-27r3-jxmh-p828
- https://github.com/expressjs/body-parser/commit/1260c3845f54502a05a87594f09a334786bb34d7
- https://nvd.nist.gov/vuln/detail/CVE-2026-111181
- https://github.com/expressjs/body-parser/commit/f7075eae3a84c3473ab4bf0a777da28db208e916
- https://cna.openjsf.org/security-advisories.html
- https://github.com/expressjs/body-parser/releases/tag/1.20.9
- https://github.com/expressjs/body-parser/releases/tag/v2.4.0
- https://github.com/advisories/GHSA-27r3-jxmh-p828
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 entriesCVE-2026-12590
body-parser vulnerable to denial of service when invalid limit value silently disables size enforcement
low3.7Jul 20, 2026CVE-2025-13466
body-parser is vulnerable to denial of service when url encoding is used
medium5.3Nov 25, 2025CVE-2024-45590
body-parser vulnerable to denial of service when url encoding is enabled
high7.5Sep 10, 2024
