CVE-2026-53540: Python-Multipart Content-Length Validation Bypass (Denial of Service)
Python-Multipart, a streaming multipart parser library, contains a vulnerability in how it handles the Content-Length header when parsing form submissions. Before version 0.0.31, the parser fails to validate whether the Content-Length value is valid. An attacker who can send a request with a negative Content-Length header can force the parser to read the entire request body into memory at once, rather than processing it in manageable chunks. This memory exhaustion condition can cause the application to become unresponsive or crash.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 3.7 LOW · CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
- Weaknesses (CWE)
- CWE-1284
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-22 / 2026-06-26
NVD description (verbatim)
Python-Multipart is a streaming multipart parser for Python. Prior to 0.0.31, parse_form() did not validate the Content-Length header before using it to bound its chunked read of the request body. A negative Content-Length turned the bounded read into a read-until-EOF, so the entire body was loaded into memory in a single read instead of in fixed-size chunks. This vulnerability is fixed in 0.0.31.
1 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability resides in the parse_form() function of Python-Multipart prior to 0.0.31. The function uses the Content-Length header to set bounds on how much data is read during chunked processing of multipart request bodies. The code does not validate that Content-Length is a non-negative integer before using it in read operations. When a negative Content-Length is provided, the read-until-EOF behavior is triggered, causing the entire unbounded request body to be loaded into memory in a single operation rather than in fixed-size chunks. This bypasses the intended chunked streaming design and creates a denial-of-service condition. The issue is classified under CWE-1284 (Improper Validation of Specified Type of Input).
Business impact
Applications using vulnerable versions of Python-Multipart are exposed to denial-of-service attacks that degrade availability. An unauthenticated attacker can send specially crafted form requests that consume excessive server memory, potentially rendering the application unresponsive. While the CVSS score is low (3.7), the practical impact on production systems depends on request rate limits, available memory, and whether the application handles out-of-memory conditions gracefully. For APIs that accept user-submitted forms without strict input validation upstream, this represents a real availability risk.
Affected systems
Python-Multipart versions prior to 0.0.31 are affected. The library is commonly used in FastAPI and other Python web frameworks that need to parse multipart form data and file uploads. Applications that depend on python-multipart indirectly through framework dependencies should be checked, as the vulnerable library may be pulled in transitively. FastAPI users and other frameworks using this parser for form handling are in scope.
Exploitability
Exploitation requires only network access and the ability to send HTTP requests with custom headers—no authentication is needed. The attack is deterministic: sending a single malformed request with a negative Content-Length header will trigger the vulnerability. However, the CVSS vector (AC:H) indicates that attack complexity is considered high, likely because the practical impact depends on server resource availability and application architecture. Exploitation does not require user interaction and can be delivered over the network without special privileges.
Remediation
Upgrade python-multipart to version 0.0.31 or later. This patch version includes validation of the Content-Length header, ensuring only non-negative values are accepted. Organizations should prioritize updating this dependency in environments where user-uploaded forms or multipart requests are processed. Verify the patch through the official repository and release notes to confirm the fix addresses this specific validation issue.
Patch guidance
Update python-multipart to 0.0.31 or later via your package manager (pip: pip install --upgrade python-multipart). If using a framework like FastAPI that depends on python-multipart indirectly, ensure your framework's dependency lock file or requirements include the patched version. Test form submission and file upload functionality after patching to confirm normal operation. No breaking changes are expected from this patch, as it only adds validation that should reject invalid input.
Detection guidance
Monitor application logs for requests containing unusual or negative Content-Length header values in multipart form submissions. Watch for sudden spikes in memory consumption coinciding with form POST requests. If running with memory limits or containerized environments, look for out-of-memory exceptions or process kills during form processing. Network-based detection could identify requests with Content-Length header values that parse as negative integers. Application-level monitoring of request processing time and memory allocation during form parsing may reveal attempts to exhaust memory.
Why prioritize this
This vulnerability should be addressed as part of regular patching cycles for dependencies used in form and file handling. While the CVSS score is low and it is not tracked in CISA's KEV catalog, the simplicity of exploitation and potential to disrupt production services justifies timely remediation. Prioritize environments that accept untrusted form input from external users or APIs. Organizations with strict availability requirements or those operating in resource-constrained environments should move this higher in their patch queue.
Risk score, explained
The CVSS 3.1 score of 3.7 (LOW severity) reflects a network-accessible vulnerability with low complexity to execute, resulting in limited availability impact (A:L). The score does not account for the deterministic nature of the attack or its potential cumulative effect in high-traffic scenarios. The lack of confidentiality or integrity impact limits the overall severity. However, the gap between CVSS score and practical risk is notable: a single unauthenticated attacker can reliably trigger memory exhaustion, making real-world business impact potentially higher than the numeric score suggests.
Frequently asked questions
Does this vulnerability affect my application if I use FastAPI?
If your FastAPI application accepts multipart form data or file uploads, and depends on python-multipart (either directly or indirectly through FastAPI), check your dependency version. FastAPI may have transitive dependency on python-multipart. Verify your installed version and upgrade to 0.0.31 or later if needed.
Can this be exploited without sending actual file data?
Yes. The vulnerability is triggered by the Content-Length header value alone. An attacker does not need to send a valid multipart body or large payload—a request with a negative Content-Length value is sufficient to trigger the memory exhaustion condition.
Why is this not on CISA's KEV catalog if it can cause denial of service?
CISA's KEV catalog prioritizes vulnerabilities with evidence of active exploitation in the wild or high-impact ransomware associations. This vulnerability, while exploitable, may not yet meet those criteria or may be too recent for inclusion. Organizations should not rely solely on KEV status when prioritizing patches; risk to your specific environment is also important.
What is the difference between versions 0.0.30 and 0.0.31?
Version 0.0.31 adds validation to ensure the Content-Length header contains only non-negative integer values before using it to bound read operations. No other significant changes are documented; the patch is narrowly focused on this validation gap.
This analysis is based on publicly available vulnerability data and vendor disclosures current as of June 2026. Exploit code and weaponized proof-of-concept details are not provided. Organizations should verify patch availability and compatibility with their specific Python and framework versions before deployment. Real-world risk depends on your application's architecture, resource limits, and exposure to untrusted input. Consult official vendor advisories and security bulletins for authoritative guidance. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-47329LOWUbuntu Linux AppArmor Notification Validation Flaw
- CVE-2026-11596MEDIUMScreenConnect Host Pass Token Expiration Bypass (MEDIUM, 4.7)
- CVE-2026-12059HIGHCelloOS SSH Command Bypass Vulnerability (CVSS 8.8)
- CVE-2026-49110HIGHUnauthenticated Broken Authentication in Upsell Order Bump Offer for WooCommerce ≤3.1.4
- CVE-2026-49218HIGHImageMagick DCM Decoder DoS Vulnerability – CVSS 7.5
- CVE-2026-52905MEDIUMLinux Kernel DAMON Invalid Region Size Denial of Service
- CVE-2026-53689HIGHlibnfs Integer Overflow in String Validation
- CVE-2026-55392MEDIUMNILFS Utilities Superblock Validation DoS Vulnerability