CVE-2024-24762

7.5 HIGH

📋 TL;DR

CVE-2024-24762 is a regular expression denial of service (ReDoS) vulnerability in python-multipart, a streaming multipart parser for Python. Attackers can send specially crafted Content-Type headers that cause excessive CPU consumption, stalling the main event loop and preventing the server from handling requests. This affects any Python application using vulnerable versions of python-multipart or frameworks like Starlette that depend on it.

💻 Affected Systems

Products:
  • python-multipart
  • Starlette
  • FastAPI (if using vulnerable python-multipart)
  • Any Python application using python-multipart
Versions: python-multipart versions < 0.0.7
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Applications using form data parsing with python-multipart are vulnerable. Starlette versions before the fix that depend on python-multipart are also affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability for minutes or longer due to CPU exhaustion, potentially affecting all users of the vulnerable application.

🟠

Likely Case

Temporary service degradation or denial of service for affected endpoints, requiring process restart to recover.

🟢

If Mitigated

Minimal impact with proper rate limiting, request validation, and updated dependencies.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Exploitation requires sending HTTP requests with malicious Content-Type headers, which is straightforward. No authentication is needed if the endpoint is accessible.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: python-multipart 0.0.7

Vendor Advisory: https://github.com/Kludex/python-multipart/security/advisories/GHSA-2jv5-9r88-3w3p

Restart Required: Yes

Instructions:

1. Update python-multipart to version 0.0.7 or later using pip: 'pip install --upgrade python-multipart>=0.0.7'. 2. Update Starlette if using it: 'pip install --upgrade starlette'. 3. Restart the application to apply changes.

🔧 Temporary Workarounds

Rate Limiting

all

Implement rate limiting on endpoints that accept multipart/form-data to reduce impact of repeated attacks.

Request Validation

all

Add middleware to validate or sanitize Content-Type headers before they reach python-multipart.

🧯 If You Can't Patch

  • Implement web application firewall (WAF) rules to block suspicious Content-Type patterns.
  • Isolate vulnerable services behind reverse proxies with request filtering capabilities.

🔍 How to Verify

Check if Vulnerable:

Check the installed version of python-multipart: 'pip show python-multipart' and verify if version is < 0.0.7.

Check Version:

pip show python-multipart | grep Version

Verify Fix Applied:

After updating, run 'pip show python-multipart' to confirm version is 0.0.7 or higher, and test form data endpoints for functionality.

📡 Detection & Monitoring

Log Indicators:

  • Unusually high CPU usage on servers handling HTTP requests
  • Increased request timeouts or errors on form submission endpoints
  • Log entries showing malformed or unusually long Content-Type headers

Network Indicators:

  • HTTP requests with Content-Type headers containing complex or repetitive patterns
  • Sudden spikes in traffic to endpoints accepting multipart/form-data

SIEM Query:

source="web_server_logs" AND (content_type="*;*" OR content_type="*\"*" OR content_type="*'*") AND response_time > 5000

🔗 References

📤 Share & Export