HighGHSA-wp53-j4wj-2cfgCVE-2026-24486PYSEC-2026-1852

Python-Multipart has Arbitrary File Write via Non-Default Configuration

Published 26 Jan 2026 · Updated 10 Sept 2026

Is your project on an affected python-multipart?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
<0.0.22
Fixed in
0.0.22
Update to the fixed version for your release line, for example:pip install 'python-multipart>=0.0.22'

Details

Summary

A Path Traversal vulnerability exists when using non-default configuration options UPLOAD_DIR and UPLOAD_KEEP_FILENAME=True. An attacker can write uploaded files to arbitrary locations on the filesystem by crafting a malicious filename.

Details

When UPLOAD_DIR is set and UPLOAD_KEEP_FILENAME is True, the library constructs the file path using os.path.join(file_dir, fname). Due to the behavior of os.path.join(), if the filename begins with a /, all preceding path components are discarded:

os.path.join("/upload/dir", "/etc/malicious") == "/etc/malicious"

This allows an attacker to bypass the intended upload directory and write files to arbitrary paths.

Affected Configuration

Projects are only affected if all of the following are true:

  • UPLOAD_DIR is set
  • UPLOAD_KEEP_FILENAME is set to True
  • The uploaded file exceeds MAX_MEMORY_FILE_SIZE (triggering a flush to disk)

The default configuration is not vulnerable.

Impact

Arbitrary file write to attacker-controlled paths on the filesystem.

Mitigation

Upgrade to version 0.0.22, or avoid using UPLOAD_KEEP_FILENAME=True in project configurations.

Is GHSA-wp53-j4wj-2cfg in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected python-multipart, and gives you the command that fixes it.

More advisories for python-multipart

  • HighCVE-2026-53539python-multipart: Quadratic-time querystring parsing with semicolon separators causes CPU denial of service · 15 Jun 2026
  • LowCVE-2026-53540python-multipart: Negative Content-Length in parse_form buffers the entire body in memory · 15 Jun 2026
  • LowCVE-2026-53538python-multipart: Semicolon treated as querystring field separator enables parameter smuggling · 15 Jun 2026
  • LowCVE-2026-53537python-multipart: Content-Disposition parameter smuggling via RFC 2231/5987 extended parameters · 15 Jun 2026
  • HighCVE-2026-42561python-multipart has Denial of Service via unbounded multipart part headers · 6 May 2026
  • MediumCVE-2026-40347python-multipart affected by Denial of Service via large multipart preamble or epilogue data · 15 Apr 2026
All 9 advisories for python-multipart

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.