CVE-2026-40347·Python vulnerability
Python-Multipart is a streaming multipart parser for Python. Versions prior to 0.0.26 have a denial of service vulnerability when parsing crafted `multipart/form-data` requests with large preamble or epilogue sections. Upgrade to version 0.0.26 or later, which skips ahead to the next boundary candidate when processing leading CR/LF data and immediately discards epilogue data after the closing boundary.
- Severity
- medium
- Software
- Python
- Fixed in
- 0.0.26
- Published
How likely is exploitation
FIRST's Exploit Prediction Scoring System puts the probability of this CVE being exploited in the next 30 days at <0.1% — higher than 14% of all published CVEs. EPSS is an independent forecast of exploitation, not a severity rating: it says nothing about how much damage a successful attack does, which is what a CVSS score measures.
Affected versions
Until: 0.0.26
Fixed in: 0.0.26
How to fix this CVE
Update Python-Multipart to version 0.0.26 or later to resolve a denial-of-service vulnerability triggered by specially crafted multipart form data. Organizations using Python applications that process file uploads or form submissions should prioritize this update to prevent resource exhaustion attacks. The patch optimizes boundary parsing to prevent processing delays caused by oversized preamble or epilogue sections in multipart requests.
sudo dnf update python3-multipart || pip3 install --upgrade python-multipart>=0.0.26Defensia detects this vulnerability
What an exploitation attempt looks like
Sample log line indicative of exploitation attempts:
POST.*multipart/form-data.*Content-Length:\s*\d{7,}|POST.*multipart/form-data.*boundary.*(?:\r?\n){50,}|multipart.*epilogue.*[A-Za-z0-9]{1000,}WAF mitigation (if patching is not yet possible)
Add this rule to your WAF to block exploitation attempts while you schedule the patch.
Implement request size limits for multipart/form-data submissions (e.g., max 10MB). Configure WAF rules to reject requests where the Content-Length header for multipart payloads exceeds typical thresholds or contains excessive CR/LF sequences before the first boundary marker.How to check if you are affected
- Run `pip3 show python-multipart | grep Version` to retrieve the installed version of the python-multipart library
- Check if your application imports multipart or uses frameworks like FastAPI, Django, or Starlette that depend on this library via `grep -r 'from multipart\|import multipart' /path/to/app`
- Search application logs for HTTP requests with large Content-Length values in multipart/form-data headers: `grep -i 'multipart/form-data' /var/log/app.log | grep -E 'Content-Length: [0-9]{7,}'`
- Verify the patch by running `pip3 show python-multipart` again and confirming the version is 0.0.26 or higher
FAQ
What is CVE-2026-40347?
CVE-2026-40347 is a denial-of-service vulnerability in Python-Multipart versions before 0.0.26 where maliciously crafted multipart form requests with abnormally large preamble or epilogue data can cause the parser to consume excessive resources, leading to application unavailability.
Is CVE-2026-40347 being actively exploited?
No, CVE-2026-40347 is not currently listed on the CISA Known Exploited Vulnerabilities catalog, and no public exploit code is available.
What versions of Python-Multipart are affected by CVE-2026-40347?
All versions prior to 0.0.26 are affected. Version 0.0.26 and later contain the necessary protections.
How do I check if my server is vulnerable to CVE-2026-40347?
Run `pip3 list | grep python-multipart` to see the installed version. If the version is below 0.0.26, your system is vulnerable.
Does Defensia detect CVE-2026-40347?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Python-Multipart is installed on a monitored server, CVE-2026-40347 will appear in your dashboard with remediation steps.
Related Python CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2026-40347. Free for 1 server.
Get started free