Denial of Service Vulnerability in body-parser Package (CVE-2024-45590)
Summary
CVE-2024-45590: body-parser is Node.js body parsing middleware. body-parser. Affects node-body-parser versions < b2695c4450f06ba3b0ccf48d872a229bb41c9bce. No fix is published. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
body-parser is a middleware for Node.js that facilitates the parsing of incoming request bodies in a middleware before your handlers, available under the req.body property. It supports various content types, including JSON and URL-encoded data. This package is widely used in web applications to handle form submissions and API requests. However, versions prior to 1.20.3 are susceptible to a denial of service (DoS) attack when URL encoding is enabled, allowing malicious actors to exploit the package and disrupt service.
Vulnerability Detail
The vulnerability identified as CVE-2024-45590 affects the body-parser package versions below 1.20.3. It allows attackers to send a large number of specially crafted requests that can overwhelm the server, leading to a denial of service. This issue arises from the way the package handles URL-encoded data, making it possible for an attacker to flood the server with excessive requests, ultimately causing it to become unresponsive. The technical aspect of this vulnerability lies in the parsing mechanism that does not adequately limit the number of requests or the size of the payload, creating a potential for resource exhaustion.
How To Fix
No fixed version is published for this vulnerability.
Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →
Workaround
If upgrading is not immediately feasible, consider implementing rate limiting on your server to mitigate the impact of potential DoS attacks. You can use middleware such as express-rate-limit to limit repeated requests to public APIs and endpoints. Here’s an example of how to set it up:
const rateLimit = require('express-rate-limit');
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100 // limit each IP to 100 requests per windowMs
});
app.use(limiter);
Conclusion
The CVE-2024-45590 vulnerability in the body-parser package poses a significant risk of denial of service for applications using versions prior to 1.20.3. It is crucial to upgrade to the patched version to ensure the security and stability of your application. Additionally, consider implementing rate limiting as a temporary measure to protect against potential attacks.
See every vulnerability recorded for node-body-parser →
FAQ
CVE-2024-45590 is a vulnerability in the body-parser package that allows for denial of service attacks when URL encoding is enabled.
Versions of body-parser prior to 1.20.3 are vulnerable to this issue.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
If exploited, this vulnerability can lead to a denial of service, making your application unresponsive and potentially impacting user experience.
Yes, implementing rate limiting on your server can help mitigate the effects of potential denial of service attacks.
Related vulnerabilities
Recent vulnerabilities recorded for node-body-parser.