# CVE-2026-53540: Python-Multipart: Negative Content-Length in parse_form buffers the entire body in memory

> An attacker can cause memory exhaustion and denial of service by sending a request with a negative Content-Length header to applications using the vulnerable parser.

- **Severity:** Low 3.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 22 Jun 2026
- **Updated:** 22 Jun 2026
- **Also known as:** CLEANSTART-2026-BI75805, CLEANSTART-2026-WK76849, CLSA-2026-1782781170, DEBIAN-CVE-2026-53540, ECHO-f040-8b65-1cc0, GHSA-v9pg-7xvm-68hf, MINI-2hp7-4f7p-p2hh, MINI-3frh-p6h3-wm7p, MINI-3q5j-fmgf-v883, MINI-53xp-8722-9947, MINI-58xh-jq4g-rrw6, MINI-7hff-x4rc-g53c, MINI-7xjx-fxmm-765f, MINI-8252-6wxf-jpjc, MINI-8qq6-fh3c-h5qm, MINI-95fr-pf45-334j, MINI-fhg5-959w-c74m, MINI-gwpm-ff78-8hjc, MINI-j4wg-p9rc-p4hp, MINI-mjm9-758v-fgq6, MINI-rhqv-32cv-9xqp, MINI-wv24-9h62-hwqf, PYSEC-2026-3040, UBUNTU-CVE-2026-53540

## What is CVE-2026-53540?

CVE-2026-53540 is a low-severity denial of service vulnerability in Kludex python-multipart, published on 22 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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.

Weakness: CWE-1284 (Improper Validation of Specified Quantity in Input)

## Which versions are affected by CVE-2026-53540?

3 open source packages ship an affected version, including python-multipart. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `python-multipart` | PyPI | All versions | 0.0.31 |
| `python-multipart` | PyPI | All versions | 0.0.31 |
| `python-multipart` | PyPI | All versions | 0.0.31 |

Products: Fastapiexpert Python-Multipart.

## How do I fix CVE-2026-53540?

Upgrade python-multipart to 0.0.31 or later.

## Is CVE-2026-53540 being exploited?

There is no known exploitation of CVE-2026-53540 in the wild and no public exploit code.

## Other vulnerabilities in Kludex python-multipart

- [CVE-2026-24486](https://insights.sbomify.com/CVE-2026-24486/): Python-Multipart has Arbitrary File Write via Non-Default Configuration (high 8.6)
- [CVE-2026-53539](https://insights.sbomify.com/CVE-2026-53539/): Python-Multipart: Quadratic-time querystring parsing with semicolon separators causes CPU denial of service (high 7.5)
- [CVE-2024-24762](https://insights.sbomify.com/CVE-2024-24762/): python-multipart vulnerable to content-type header Regular expression Denial of Service (high 7.5)
- [CVE-2026-40347](https://insights.sbomify.com/CVE-2026-40347/): Python-Multipart affected by Denial of Service via large multipart preamble or epilogue data (medium 5.3)
- [CVE-2026-53537](https://insights.sbomify.com/CVE-2026-53537/): Python-Multipart: Content-Disposition parameter smuggling via RFC 2231/5987 extended parameters (low 3.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-53540 and fix it if it is affected.

What it is: CVE-2026-53540 is a low-severity denial of service vulnerability in Kludex python-multipart, published on 22 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-53540 in the wild and no public exploit code.

Affected packages and fixed versions:
- python-multipart (PyPI): affected all versions; fixed in 0.0.31
- python-multipart (PyPI): affected all versions; fixed in 0.0.31
- python-multipart (PyPI): affected all versions; fixed in 0.0.31

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-53540/ (Markdown: https://insights.sbomify.com/CVE-2026-53540/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-53540
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-53540
- OSV: https://osv.dev/vulnerability/CVE-2026-53540

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-53540/
Summaries are generated and may contain mistakes; the official description above is the record.
