CVE-2023-30798

7.5 HIGH

📋 TL;DR

This vulnerability in Starlette's MultipartParser allows remote attackers to cause denial of service by sending excessive multipart form data, leading to high memory consumption. It affects unauthenticated users and impacts HTTP services built with vulnerable versions of the Starlette framework.

💻 Affected Systems

Products:
  • Starlette
Versions: Versions before 0.25.0
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Affects any Starlette-based application using multipart form handling; no special configuration required.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability due to memory exhaustion, potentially crashing the server and disrupting all HTTP functionality.

🟠

Likely Case

Degraded performance or temporary service outages under targeted attacks, affecting application responsiveness.

🟢

If Mitigated

Minimal impact with proper rate limiting, input validation, and updated software, though some resource strain may occur.

🌐 Internet-Facing: HIGH, as it is remotely exploitable without authentication and can be triggered via standard HTTP requests.
🏢 Internal Only: MEDIUM, as internal attackers could still exploit it, but network segmentation may reduce exposure.

🎯 Exploit Status

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

Exploitation is straightforward via crafted HTTP requests; public proof-of-concept code is available in advisories.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.25.0 and later

Vendor Advisory: https://github.com/encode/starlette/security/advisories/GHSA-74m5-2c7w-9w3x

Restart Required: Yes

Instructions:

1. Update Starlette using pip: 'pip install --upgrade starlette>=0.25.0'. 2. Restart the application or server to apply changes. 3. Verify the version with 'pip show starlette'.

🔧 Temporary Workarounds

Implement request size limits

all

Configure web server or application to limit multipart request sizes to reduce memory impact.

Example for a reverse proxy like nginx: 'client_max_body_size 10M;' in nginx.conf

Disable multipart parsing if unused

all

If the application does not require multipart form handling, disable or restrict it in Starlette configuration.

In Starlette app, avoid using 'request.form()' or limit its use to specific endpoints.

🧯 If You Can't Patch

  • Deploy rate limiting and input validation at the network or application layer to block excessive requests.
  • Monitor memory usage and set up alerts for unusual spikes to enable rapid response to potential attacks.

🔍 How to Verify

Check if Vulnerable:

Check the Starlette version in your Python environment; if it is below 0.25.0, it is vulnerable.

Check Version:

pip show starlette | grep Version

Verify Fix Applied:

After updating, confirm the version is 0.25.0 or higher and test multipart requests to ensure no memory exhaustion occurs.

📡 Detection & Monitoring

Log Indicators:

  • Unusually large HTTP POST requests, spikes in memory usage logs, or error messages related to multipart parsing.

Network Indicators:

  • High volume of multipart/form-data requests from single sources or abnormal request sizes.

SIEM Query:

Example: 'source=web_logs method=POST content_type=multipart/form-data size>10MB | stats count by src_ip'

🔗 References

📤 Share & Export