Python-Multipart Path Traversal Vulnerability Allowing Arbitrary File Write

Vulnerability

A path traversal vulnerability allowing arbitrary file writes has been identified in Python-Multipart versions prior to 0.0.22. This issue arises when the `UPLOAD_DIR` option is set and `UPLOAD_KEEP_FILENAME` is enabled. Under these conditions, an attacker can craft a filename that exploits the way file paths are constructed, bypassing the intended upload directory and writing files to arbitrary locations on the filesystem. The vulnerability is triggered when the uploaded file exceeds the `MAX_MEMORY_FILE_SIZE` limit, causing it to be flushed to disk.

Impact

Exploitation of this vulnerability allows for arbitrary file writes to locations controlled by the attacker on the filesystem.

Reproduction

To reproduce this vulnerability, configure Python-Multipart with a custom upload directory (`UPLOAD_DIR`) and set `UPLOAD_KEEP_FILENAME` to true. Upload a file with a filename that includes a leading slash, which will be interpreted as an absolute path, allowing the file to be written outside the intended directory.

Remediation

Users should upgrade to Python-Multipart version 0.0.22 or later. If an upgrade is not possible, avoid using `UPLOAD_KEEP_FILENAME=True` in project configurations.

Added: Jan 27, 2026, 1:20 AM
Updated: Jan 27, 2026, 1:20 AM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
3.1
exploitability
7.7
remediation
0.0
relevance
2.4
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.