CVE-2026-24486

8.6 HIGH

📋 TL;DR

Python-Multipart versions before 0.0.22 contain a path traversal vulnerability when configured with UPLOAD_DIR and UPLOAD_KEEP_FILENAME=True. Attackers can write uploaded files to arbitrary filesystem locations by crafting malicious filenames. This affects any Python application using python-multipart with those specific configuration options enabled.

💻 Affected Systems

Products:
  • python-multipart
Versions: All versions before 0.0.22
Operating Systems: All
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when UPLOAD_DIR is configured AND UPLOAD_KEEP_FILENAME=True. Default configuration is not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise via arbitrary file write leading to remote code execution, data destruction, or privilege escalation.

🟠

Likely Case

Unauthorized file writes to sensitive directories, potentially overwriting configuration files or deploying malicious scripts.

🟢

If Mitigated

Limited impact if proper file permissions restrict write access to non-critical directories.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires file upload functionality with vulnerable configuration. No authentication needed if upload endpoint is exposed.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.0.22

Vendor Advisory: https://github.com/Kludex/python-multipart/security/advisories/GHSA-wp53-j4wj-2cfg

Restart Required: Yes

Instructions:

1. Update python-multipart: pip install python-multipart==0.0.22
2. Restart your Python application
3. Verify the version: pip show python-multipart

🔧 Temporary Workarounds

Disable UPLOAD_KEEP_FILENAME

all

Set UPLOAD_KEEP_FILENAME=False in your configuration to prevent filename-based path traversal.

🧯 If You Can't Patch

  • Implement strict filename validation and sanitization before file writes
  • Configure file system permissions to restrict write access to specific directories only

🔍 How to Verify

Check if Vulnerable:

Check if python-multipart version <0.0.22 AND configuration has UPLOAD_DIR set AND UPLOAD_KEEP_FILENAME=True

Check Version:

pip show python-multipart | grep Version

Verify Fix Applied:

Confirm python-multipart version is 0.0.22 or higher

📡 Detection & Monitoring

Log Indicators:

  • Unusual file write patterns outside expected upload directories
  • Filenames containing path traversal sequences (../)

Network Indicators:

  • HTTP requests with filenames containing path traversal sequences in multipart uploads

SIEM Query:

source="web_logs" AND (filename="*../*" OR filename="*..\\*") AND method="POST" AND uri="*/upload*"

🔗 References

📤 Share & Export