python-multipart
Affected
- introduced
0, fixed0.0.22(ecosystem)
Fixed versions
0.0.22
Fix
- Fixed version
0.0.22pip install --upgrade python-multipart==0.0.22
Advisory
Also known as: CVE-2026-24486, GHSA-wp53-j4wj-2cfg
Python-Multipart has Arbitrary File Write via Non-Default Configuration
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 setUPLOAD_KEEP_FILENAME is set to TrueMAX_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.
High Basis: CVSS v3 score 8.6, vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L
0, fixed 0.0.22 (ecosystem)0.0.22
0.0.22pip install --upgrade python-multipart==0.0.22Fix 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
Source: PyPA Advisory Database · CC BY 4.0