CVE-2026-12590: body-parser vulnerable to denial of service when invalid limit value silently disables size enforcement
Impact
When body-parser is configured with an invalid limit option value, such as an unparseable string or NaN, bytes.parse() returns null and the request body size check is silently skipped. Applications that rely on limit as their primary safeguard against oversized request bodies will accept arbitrarily large payloads, leading to excessive memory and CPU usage and denial of service.
This issue affects applications that pass a programmatically computed or user-configurable value to the limit option without validating it first.
Patches
This issue is fixed in body-parser@2.3.0 and body-parser@1.20.6 via #698. After the fix, invalid limit values throw a clear error at parser construction time instead of silently disabling enforcement. null and undefined continue to fall back to the default limit (100kb).
Workarounds
Validate limit before passing it to body-parser. For example, parse the value with bytes.parse() at startup and reject any configuration where it returns null or a non-finite number.
References
- #698: fix PR - bytes.js: limit parser
Other sources
Impact: In body-parser versions prior to 1.20.6 (1.x line) and 2.3.0 (2.x line), when the parser is configured with an invalid limit option value such as an unparseable string or NaN, bytes.parse returns null and the request body size check is silently skipped. Applications that rely on limit as their primary safeguard against oversized request bodies will accept arbitrarily large payloads, leading to excessive memory and CPU usage and denial of service. Patches: This issue is fixed in body-parser 1.20.6 and 2.3.0. After the fix, invalid limit values throw a clear error at parser construction time instead of silently disabling enforcement, while null and undefined continue to fall back to the default limit of 100kb. Workarounds: Validate the limit value before passing it to body-parser. For example, parse the value at startup and reject any configuration where the result is null or a non-finite number.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/body-parserto a version that resolves this vulnerability.Fixed in 2.3.0 - Upgrade
Upgrade
npm/body-parserto a version that resolves this vulnerability.Fixed in 1.20.6 - Upgrade
Upgrade
body-parserto a version that resolves this vulnerability.Fixed in 1.20.6 - Upgrade
Upgrade
body-parserto a version that resolves this vulnerability.Fixed in 2.3.0 - Configuration
Before passing the `limit` option to body-parser, parse the configured value at startup with bytes.parse() and reject the configuration if it returns `null` or a non-finite number (e.g., NaN). Note: `null` and `undefined` should continue to fall back to the default limit (`100kb`).
body-parser limit = validated bytes.parse(limit) is not null and is finite (non-NaN); reject invalid values
Event History
Frequently Asked Questions
What is the severity of CVE-2026-12590?
The severity of CVE-2026-12590 is rated as low at 3.7.
How do I fix CVE-2026-12590?
To fix CVE-2026-12590, update body-parser to version 1.20.6 or higher in the 1.x line, or 2.3.0 or higher in the 2.x line.
What impact does CVE-2026-12590 have on applications?
CVE-2026-12590 can lead to a denial of service by bypassing the request body size limit when invalid limit values are used.
Which versions of body-parser are affected by CVE-2026-12590?
Versions of body-parser prior to 1.20.6 in the 1.x line and 2.3.0 in the 2.x line are affected by CVE-2026-12590.
What should I monitor for due to CVE-2026-12590?
Monitor your applications for potential denial of service issues related to request body size checks if using the vulnerable versions of body-parser.