CVE-2026-24486: Python-Multipart has Arbitrary File Write via Non-Default Configuration
Summary A Path Traversal vulnerability exists when using non-default configuration options UPLOADDIR and UPLOADKEEPFILENAME=True. An attacker can write uploaded files to arbitrary locations on the filesystem by crafting a malicious filename. Details When UPLOADDIR is set and UPLOADKEEPFILENAME is True, the library constructs the file path using os.path.join(filedir, fname).
Published Jan 26, 2026 · Updated Jan 29, 2026
Affected packages
python-multipart
- Ecosystem
- PyPI
- Affected
- < 0.0.22
- Fixed in
- 0.0.22
- Check
pip show python-multipart
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
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_DIRis setUPLOAD_KEEP_FILENAMEis 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.
Credited to mwlik, imenyoo2, davidsilveiro.
References
- https://github.com/Kludex/python-multipart/security/advisories/GHSA-wp53-j4wj-2cfg
- https://github.com/Kludex/python-multipart/commit/9433f4bbc9652bdde82bbe380984e32f8cfc89c4
- https://github.com/Kludex/python-multipart/releases/tag/0.0.22
- https://nvd.nist.gov/vuln/detail/CVE-2026-24486
- https://github.com/advisories/GHSA-wp53-j4wj-2cfg
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
More PyPI vulnerabilities
All PyPI entriesCVE-2026-53537
python-multipart: Content-Disposition parameter smuggling via RFC 2231/5987 extended parameters
low3.7Jun 15, 2026CVE-2026-53538
python-multipart: Semicolon treated as querystring field separator enables parameter smuggling
low3.7Jun 15, 2026CVE-2026-53539
python-multipart: Quadratic-time querystring parsing with semicolon separators causes CPU denial of service
high7.5Jun 15, 2026CVE-2026-53540
python-multipart: Negative Content-Length in parse_form buffers the entire body in memory
low3.7Jun 15, 2026CVE-2026-42561
python-multipart has Denial of Service via unbounded multipart part headers
high7.5May 6, 2026CVE-2026-40347
python-multipart affected by Denial of Service via large multipart preamble or epilogue data
medium5.3Apr 15, 2026
