Skip to main content
EPSS 0.3%top 72%

CVE-2026-53540: CWE-1284: Improper Validation of Specified Quantity in Input in Kludex python-multipart

0
Low
Published: 08/13/2026 (08/13/2026, 17:01:40 UTC)
Source: CVE Database V5
Vendor/Project: Kludex
Product: python-multipart

Description

### Summary `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. ### Details `parse_form()` reads the input stream in chunks, never reading more than the remaining `Content-Length` at a time. The per-chunk size is computed as `min(content_length - bytes_read, chunk_size)`. The header value was parsed to an integer without checking its sign, so a `Content-Length` of `-1` made this expression negative, and `input_stream.read(-1)` reads until end of stream. The intended bounded, chunked read therefore collapsed into a single unbounded read of the whole stream. The amount read is still bounded by what the client actually sends. ### Impact This only affects code that calls `parse_form()` directly with a `Content-Length` header taken from attacker-controlled input and without normalizing a negative value first. No known package is affected: * Starlette and FastAPI drive `MultipartParser` directly from the ASGI `receive()` stream and do not call `parse_form()`. * Known `parse_form()` consumers either do not forward `Content-Length` to it, recompute it from the already-read body, or run behind a layer (such as Werkzeug) that normalizes a negative `Content-Length` to `0`. The realistic exposure is limited to bespoke WSGI or `http.server` handlers that forward raw client headers into `parse_form()`. In that case a crafted request buffers the body in memory at once, degrading availability under concurrent requests rather than causing a complete denial of service. ### Mitigation Upgrade to version `0.0.31` or later, which rejects a negative `Content-Length` with a `ValueError` before reading the stream.

CVSS v3.1

Score 3.7low

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L

Affected software

Kludex

python-multipart

Affected versions
<0.0.31
python-multipart
pkg:pypi/python-multipart
Affected versions
<0.0.31

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 06/22/2026, 18:09:21 UTC

Technical Analysis

Python-Multipart is a streaming multipart parser for Python. Versions before 0.0.31 do not validate the Content-Length header before using it to limit chunked reads of the request body. If the Content-Length header is negative, the bounded read logic fails, resulting in reading until EOF and loading the entire body into memory in a single operation. This can lead to increased memory usage. The vulnerability is addressed in version 0.0.31.

Potential Impact

The vulnerability causes the parser to load the entire request body into memory when a negative Content-Length header is provided, potentially leading to increased memory consumption and degraded performance. There is no impact on confidentiality or integrity. The CVSS score is 3.7 (low), reflecting limited impact and the requirement for network access with high attack complexity.

Mitigation Recommendations

Upgrade python-multipart to version 0.0.31 or later, where the Content-Length header is properly validated to prevent this issue. No other mitigations are indicated or necessary.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-06-09T18:13:07.263Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 6a39735aeed863c81e396236

Added to database: 06/22/2026, 17:39:38 UTC

Last enriched: 06/22/2026, 18:09:21 UTC

Last updated: 09/21/2026, 12:42:59 UTC

Views: 167

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses