CVE-2026-24486 Overview
CVE-2026-24486 is a Path Traversal vulnerability affecting Python-Multipart, a streaming multipart parser library for Python. This vulnerability exists in versions prior to 0.0.22 when the application uses non-default configuration options UPLOAD_DIR combined with UPLOAD_KEEP_FILENAME=True. An attacker can exploit this flaw to write uploaded files to arbitrary locations on the filesystem by crafting a malicious filename containing directory traversal sequences.
Critical Impact
Attackers can write arbitrary files to any location on the filesystem, potentially leading to remote code execution through webshell uploads, configuration file overwrites, or compromise of sensitive system files.
Affected Products
- Python-Multipart versions prior to 0.0.22
- Applications using UPLOAD_DIR with UPLOAD_KEEP_FILENAME=True configuration
- Python web frameworks utilizing python-multipart for file uploads (including FastAPI and Starlette)
Discovery Timeline
- 2026-01-27 - CVE CVE-2026-24486 published to NVD
- 2026-01-27 - Last updated in NVD database
Technical Details for CVE-2026-24486
Vulnerability Analysis
This Path Traversal vulnerability (CWE-22) occurs due to insufficient sanitization of user-supplied filenames during multipart file upload processing. When an application is configured with UPLOAD_DIR to specify an upload destination and UPLOAD_KEEP_FILENAME=True to preserve original filenames, the library fails to properly validate and sanitize the filename before constructing the destination path. This allows an attacker to include directory traversal sequences (such as ../) in the filename, enabling file writes outside the intended upload directory.
The vulnerability is exploitable over the network without requiring authentication or user interaction. An attacker who successfully exploits this vulnerability can achieve high impact on system integrity by writing files to sensitive locations, potentially overwriting configuration files, injecting malicious scripts, or planting webshells for persistent access.
Root Cause
The root cause lies in the File class initialization within multipart.py, where the original filename from the multipart request is processed without extracting the basename first. The code directly uses os.path.splitext(file_name) on the user-supplied filename, preserving any path components including traversal sequences. This allows filenames like ../../../etc/cron.d/malicious to escape the designated upload directory.
Attack Vector
The attack vector is network-based, requiring an attacker to send a specially crafted multipart HTTP request to a vulnerable application. The malicious request contains a file upload with a manipulated filename field that includes path traversal sequences. When the vulnerable application processes this request with the affected configuration options enabled, the file is written to the attacker-controlled path relative to the upload directory.
# Security patch from python_multipart/multipart.py
# Source: https://github.com/Kludex/python-multipart/commit/9433f4bbc9652bdde82bbe380984e32f8cfc89c4
# Split the extension from the filename.
if file_name is not None:
- base, ext = os.path.splitext(file_name)
+ # Extract just the basename to avoid directory traversal
+ basename = os.path.basename(file_name)
+ base, ext = os.path.splitext(basename)
self._file_base = base
self._ext = ext
The patch introduces os.path.basename() to extract only the filename component, stripping any directory path elements including traversal sequences before processing the filename.
Detection Methods for CVE-2026-24486
Indicators of Compromise
- Uploaded files appearing outside the configured UPLOAD_DIR directory
- Web server logs showing multipart requests with filenames containing ../ or ..\\ sequences
- Unexpected files in system directories such as /etc/cron.d/, web root directories, or configuration folders
- New or modified files in sensitive locations with timestamps correlating to file upload activity
Detection Strategies
- Implement web application firewall (WAF) rules to detect and block multipart requests containing path traversal sequences in filename fields
- Monitor file system activity for file creation events outside designated upload directories
- Deploy SentinelOne endpoint protection to detect and alert on suspicious file writes to sensitive system paths
- Enable detailed logging of multipart request parameters including filenames at the application layer
Monitoring Recommendations
- Configure file integrity monitoring (FIM) on critical system directories to detect unauthorized file modifications
- Set up alerts for HTTP requests containing encoded or raw path traversal patterns (../, ..%2f, %2e%2e/)
- Monitor python-multipart library versions across your application inventory to identify vulnerable deployments
- Review application configurations for instances of UPLOAD_KEEP_FILENAME=True combined with UPLOAD_DIR settings
How to Mitigate CVE-2026-24486
Immediate Actions Required
- Upgrade Python-Multipart to version 0.0.22 or later immediately
- Audit existing applications for usage of the vulnerable configuration combination (UPLOAD_DIR with UPLOAD_KEEP_FILENAME=True)
- Review uploaded files for evidence of path traversal exploitation attempts
- Implement additional input validation at the application layer as defense-in-depth
Patch Information
The vulnerability has been addressed in Python-Multipart version 0.0.22. The fix introduces basename extraction using os.path.basename() before processing filenames, effectively stripping any directory components from user-supplied filenames. Users should upgrade using pip:
For detailed information about the patch, see the GitHub Security Advisory GHSA-wp53-j4wj-2cfg and the GitHub Release Version 0.0.22.
Workarounds
- Disable UPLOAD_KEEP_FILENAME=True in project configurations and use randomly generated filenames instead
- Implement application-level filename sanitization using os.path.basename() before passing filenames to python-multipart
- Use a separate restricted filesystem or container for file uploads to limit the impact of potential traversal attacks
- Apply strict file permission controls on the upload directory to prevent writes to parent directories
# Configuration example
# Upgrade python-multipart to patched version
pip install python-multipart>=0.0.22
# Verify installed version
pip show python-multipart | grep Version
# Alternative: If upgrade is not immediately possible, modify application configuration
# Set UPLOAD_KEEP_FILENAME=False to use generated filenames instead of user-supplied ones
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

