CVE-2024-53981: Python multipart Denial of Service Vulnerability
HIGHCVE-2024-53981 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Python multipart libraries in the PyPI ecosystem. The issue involves denial of service (dos) via deformation `multipart/form-data` boundary. Remediation is available by upgrading affected packages to version 0.0.18.
CVE-2024-53981 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2024-53981
To remediate this vulnerability, upgrade all affected Python multipart dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install python-multipart>=0.0.18
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show python-multipart
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2024-53981, inspect your installed packages using pip:
pip show python-multipart
Analyze the terminal output to locate any version of Python multipart in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.18), your application is affected.
Note: The pip show python-multipart command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Python multipart, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-53981 Affected Python multipart Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
python-multipart
|
PyPI |
< 0.0.18
|
0.0.18
|
References
Frequently Asked Questions
What is CVE-2024-53981?
Which Python multipart versions are affected?
What version fixes CVE-2024-53981?
Is python-multipart affected?
What is the CVSS score of CVE-2024-53981?
What CWE is associated with CVE-2024-53981?
How can I check PyPI dependencies for CVE-2024-53981?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-59g5-xgcq-4qw3",
"modified" : "2024-12-02T21:37:04Z",
"published" : "2024-12-02T21:37:04Z",
"aliases" : [ "CVE-2024-53981" ],
"summary" : "Denial of service (DoS) via deformation `multipart/form-data` boundary",
"details" : "### Summary\n\nWhen parsing form data, `python-multipart` skips line breaks (CR `\\r` or LF `\\n`) in front of the first boundary and any tailing bytes after the last boundary. This happens one byte at a time and emits a log event each time, which may cause excessive logging for certain inputs.\n\nAn attacker could abuse this by sending a malicious request with lots of data before the first or after the last boundary, causing high CPU load and stalling the processing thread for a significant amount of time. In case of ASGI application, this could stall the event loop and prevent other requests from being processed, resulting in a denial of service (DoS).\n\n### Impact\n\nApplications that use `python-multipart` to parse form data (or use frameworks that do so) are affected. \n\n### Original Report\n\nThis security issue was reported by:\n- GitHub security advisory in Starlette on October 30 by @Startr4ck\n- Email to `python-multipart` maintainer on October 3 by @mnqazi",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
}, {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "python-multipart"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.0.18"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/Kludex/python-multipart/security/advisories/GHSA-59g5-xgcq-4qw3"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-53981"
}, {
"type" : "WEB",
"url" : "https://github.com/Kludex/python-multipart/commit/c4fe4d3cebc08c660e57dd709af1ffa7059b3177"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Kludex/python-multipart"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-770" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-12-02T21:37:04Z",
"nvd_published_at" : "2024-12-02T16:15:14Z"
}
}