CVE-2026-40347: Python multipart Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-mj87-hwqh-73pj
CVSS 5.3
CWE-834 CWE-400
Published
Advisory Summary

CVE-2026-40347 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-834: Excessive Iteration) affecting Python multipart libraries in the PyPI ecosystem. The issue involves python-multipart affected by denial of service via large multipart preamble or epilogue data. Remediation is available by upgrading affected packages to version 0.0.26.

CVE-2026-40347 at a Glance

CVE Identifier CVE-2026-40347
GHSA Identifier GHSA-mj87-hwqh-73pj
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-834: Excessive Iteration
Affected Product Python multipart
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2026-40347

To remediate this vulnerability, upgrade all affected Python multipart dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

python-multipart fixed: 0.0.26
pip install python-multipart>=0.0.26
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show python-multipart

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-40347, inspect your installed packages using pip:

pip show python-multipart

Analyze the terminal output to locate any version of Python multipart in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.26), your application is affected.

Note: The pip show python-multipart command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-834: Excessive Iteration, where the product performs an iteration or loop without sufficiently limiting the number of times that the loop is executed. In Python multipart, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

CVE-2026-40347 Affected Python multipart Versions

1 component(s)
Fixed Versions:
0.0.26
Product / Package Ecosystem Affected Versions Fixed Version
python-multipart
PyPI
< 0.0.26
0.0.26

References

Frequently Asked Questions

What is CVE-2026-40347?
CVE-2026-40347 is a security vulnerability in Python multipart involving python-multipart affected by Denial of Service via large multipart preamble or epilogue data under CWE-834: Excessive Iteration.
Which Python multipart versions are affected?
Affected versions include releases prior to 0.0.26 across affected packages: python-multipart.
What version fixes CVE-2026-40347?
Upgrading to 0.0.26 (or the latest patched release for your respective branch) resolves the vulnerability.
Is python-multipart affected?
Yes, python-multipart is affected in releases prior to 0.0.26. Upgrade your dependency to 0.0.26 or later.
What is the CVSS score of CVE-2026-40347?
CVE-2026-40347 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-40347?
CVE-2026-40347 is classified under CWE-834: Excessive Iteration (The product performs an iteration or loop without sufficiently limiting the number of times that the loop is executed.).
How can I check PyPI dependencies for CVE-2026-40347?
Run the dependency tree command: 'pip show python-multipart'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-mj87-hwqh-73pj",
  "modified" : "2026-04-24T20:51:11Z",
  "published" : "2026-04-15T19:45:44Z",
  "aliases" : [ "CVE-2026-40347" ],
  "summary" : "python-multipart affected by Denial of Service via large multipart preamble or epilogue data",
  "details" : "### Summary\n\nA denial of service vulnerability exists when parsing crafted `multipart/form-data` requests with large preamble or epilogue sections.\n\n### Details\n\nTwo inefficient multipart parsing paths could be abused with attacker-controlled input.\n\nBefore 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.\n\n### Impact\n\nAn 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.\n\n### Mitigation\n\nUpgrade 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" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "python-multipart"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.0.26"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Kludex/python-multipart/security/advisories/GHSA-mj87-hwqh-73pj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40347"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Kludex/python-multipart"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Kludex/python-multipart/releases/tag/0.0.26"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-834" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-15T19:45:44Z",
    "nvd_published_at" : "2026-04-18T00:16:38Z"
  }
}