Skip to main content

python-multipart CVE-2026-53540

| EUVDEUVD-2026-38325 LOW
Improper Validation of Specified Quantity in Input (CWE-1284)
2026-06-15 https://github.com/Kludex/python-multipart GHSA-v9pg-7xvm-68hf
3.7
CVSS 3.1 · Vendor: https://github.com/Kludex/python-multipart
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Identify WSGI endpoint calling parse_form() with raw headers
  2. Delivery
    Craft POST request with Content-Length: -1 and large body
  3. Exploit
    Server parses negative header without sign check
  4. Execution
    input_stream.read(-1) buffers entire body in memory
  5. Persist
    Repeat concurrently to exhaust server memory
  6. Impact
    Availability degraded for legitimate users

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V2 - Validation and Business Logic Input size validation
Exploitation Conditions

Exploitation requires that the target application calls python-multipart's parse_form() function AND supplies it a Content-Length value taken directly from the raw client-controlled HTTP header without prior sign normalization. This combination is absent from all known mainstream frameworks: Starlette and FastAPI bypass parse_form() entirely (using the ASGI receive() stream via MultipartParser), and Werkzeug normalizes negative Content-Length to 0 before it can reach parse_form(). Exploitation is therefore limited to bespoke WSGI handlers or http.server subclasses that explicitly pass raw request headers into parse_form(). What limits exploitation further: the amount of memory consumed per request is bounded by what the client actually transmits (not infinite); the impact is availability degradation under concurrent load, not instant service termination; and the attack requires sustained concurrent connections to produce observable impact.

Impact

The CVSS 3.1 vector (AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L) accurately reflects the limited real-world risk. AC:H captures the non-trivial precondition: a vulnerable target must call parse_form() with raw client-supplied headers, a pattern explicitly absent from all known mainstream consumers. EPSS data is not present in the available intelligence, but the narrow attack surface and absence of both POC exploit code and KEV listing support a low exploitation-probability assessment. The practical impact is memory pressure under concurrent load, not a complete denial of service - the advisory explicitly distinguishes these. This vulnerability is a real priority only for teams operating custom WSGI or http.server applications that forward Content-Length verbatim; for all Starlette, FastAPI, or Werkzeug-backed deployments, risk is negligible without code changes. No conflicting signals are present across the available data sources.

Exploit ScenarioDerived

An attacker targets a custom Python WSGI application that parses multipart form submissions by calling parse_form() with headers sourced directly from the incoming HTTP request. The attacker sends a high volume of concurrent POST requests each carrying a Content-Length: -1 header and a large streaming body; each request causes the server to buffer the entire body in memory in a single read rather than in fixed chunks, steadily consuming available RAM and degrading response times for legitimate users. No public exploit code has been identified at time of analysis.

Monitor Track and reassess. Why: LOW severity (CVSS 0.1-3.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 15, 2026

Memory exhaustion in python-multipart's parse_form() function allows a remote attacker to force unbounded body buffering by supplying a negative Content-Length header, degrading server availability under concurrent load. Affected deployments are narrowly scoped: only bespoke WSGI or http.server handlers that pass raw, unvalidated client-supplied Content-Length values directly into parse_form(). Mainstream consumers such as Starlette, FastAPI, and Werkzeug are not affected. No public exploit code exists and this vulnerability is not listed in the CISA KEV catalog, consistent with the low CVSS base score of 3.7.

RemediationAI

Upgrade python-multipart to version 0.0.31 or later, which rejects a negative Content-Length with a ValueError before any stream read occurs; this is the definitive fix per the vendor advisory at https://github.com/Kludex/python-multipart/security/advisories/GHSA-v9pg-7xvm-68hf. If an immediate upgrade is not feasible, the specific compensating control is to validate and normalize the Content-Length header before passing it to parse_form(): reject or clamp any value less than zero to 0 at the application or middleware layer. This can be implemented as a one-line guard (e.g., content_length = max(0, int(request.headers.get('Content-Length', 0)))) in the handler that calls parse_form(). A secondary control is to enforce server-side request body size limits at the reverse proxy or WSGI server level (e.g., LimitRequestBody in Apache, client_max_body_size in nginx), which caps the memory consumed per request regardless of the header value. The trade-off of the proxy limit approach is that it does not fix the root cause and may reject legitimate large uploads.

Affected VersionsENISA

python-multipart < 0.0.31

Affected Packages

pypi python-multipart fix: 0.0.31

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

python-multipart (pkg:pip/python-multipart) provides multipart form-data and URL-encoded body parsing for Python web applications. The parse_form() function implements a chunked read loop bounded by the Content-Length header: each chunk size is computed as min(content_length - bytes_read, chunk_size). The integer parsed from the Content-Length header was never validated for sign, so a value of -1 makes the expression negative on the first iteration. Python's io.RawIOBase.read() interprets a negative argument as 'read until EOF', collapsing the intended bounded chunked loop into a single unbounded read of the entire request body into memory. The root cause maps to CWE-1284 (Improper Validation of Specified Quantity in Input): the quantity used to bound I/O was accepted without sign checking. The total bytes read is still limited by what the client actually transmits, so this is a memory pressure issue rather than an infinite loop.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/Kludex/python-multipart) PRIMARY 3.7 LOW
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
vuln.today AI 3.7 LOW

AC:H reflects the non-default deployment pattern required; A:L captures memory pressure rather than full service loss; C:N and I:N because no data is disclosed or modified.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

Primary rating from Vendor (https://github.com/Kludex/python-multipart).

CVSS VectorVendor: https://github.com/Kludex/python-multipart

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low

DescriptionCVE.org

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.

Threat Intelligence Overview

EPSS Score
0.2%
Top 88% exploitable
Threat Intel
1
1 source
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity LOW
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
LOW severity (CVSS 0.1-3.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Defer
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Low
Technical Impact
Partial

Priority Score

18
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +18
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy