Advisory

PYSEC-2026-3038

Also known as: CVE-2026-40347, GHSA-mj87-hwqh-73pj

Summary

python-multipart affected by Denial of Service via large multipart preamble or epilogue data

Details

Summary

A denial of service vulnerability exists when parsing crafted multipart/form-data requests with large preamble or epilogue sections.

Details

Two inefficient multipart parsing paths could be abused with attacker-controlled input.

Before the first multipart boundary, the parser handled leading CR and LF bytes inefficiently while searching for the start of the first part. After the closing boundary, the parser continued processing trailing epilogue data instead of discarding it immediately. As a result, parsing time could grow with the size of crafted data placed before the first boundary or after the closing boundary.

Impact

An attacker can send oversized malformed multipart bodies that consume excessive CPU time during request parsing, reducing request-handling capacity and delaying legitimate requests. This issue degrades availability but does not typically result in a complete denial of service for the entire application.

Mitigation

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 Basis: CVSS v3 score 5.3, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Dates

Published
2026-07-13 15:02 UTC
Modified
2026-07-13 16:33 UTC

Affected packages and fixes

python-multipart

PyPI · All systems

Affected

  • introduced 0, fixed 0.0.26 (ecosystem)

Fixed versions

0.0.26

Fix

  • Fixed version 0.0.26
    pip install --upgrade python-multipart==0.0.26

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: PyPA Advisory Database · CC BY 4.0

Sources & licences