CVE-2025-13836

9.1 CRITICAL

📋 TL;DR

This vulnerability in Python's HTTP client libraries allows a malicious server to cause denial-of-service by forcing clients to read excessively large HTTP responses into memory. Attackers can exploit the default Content-Length handling to trigger out-of-memory conditions. This affects any Python application making HTTP requests to untrusted servers.

💻 Affected Systems

Products:
  • Python
  • Applications using Python's http.client, urllib, or requests libraries
Versions: Python versions before the fix commits (specific versions not specified in CVE, but commits indicate recent versions)
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists in default HTTP client configurations when reading responses without explicit size limits.

📦 What is this software?

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service disruption through memory exhaustion, potentially causing application crashes and system instability.

🟠

Likely Case

Degraded performance or temporary unavailability of affected services due to memory pressure.

🟢

If Mitigated

Minimal impact with proper memory limits and request validation in place.

🌐 Internet-Facing: HIGH - Any Python application making HTTP requests to external servers is vulnerable to malicious responses.
🏢 Internal Only: MEDIUM - Internal services could be compromised if an attacker gains access to internal servers.

🎯 Exploit Status

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

Exploitation requires only a malicious HTTP server; no authentication needed on client side.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Versions containing the referenced GitHub commits

Vendor Advisory: https://github.com/python/cpython/security/advisories

Restart Required: Yes

Instructions:

1. Update Python to version containing the fix commits. 2. Restart all affected applications. 3. Verify no applications are pinned to vulnerable versions.

🔧 Temporary Workarounds

Implement HTTP response size limits

all

Add explicit size limits when reading HTTP responses in application code

# In Python code, set max response size
response = requests.get(url, stream=True)
content = b''
for chunk in response.iter_content(chunk_size=8192):
    content += chunk
    if len(content) > MAX_SIZE:  # e.g., 10MB
        raise ValueError('Response too large')

Use streaming responses

all

Process HTTP responses in chunks rather than reading entire response into memory

# Use streaming mode
import requests
response = requests.get(url, stream=True)
for chunk in response.iter_content(chunk_size=8192):
    process_chunk(chunk)

🧯 If You Can't Patch

  • Implement network-level controls to restrict HTTP traffic to trusted servers only
  • Deploy memory monitoring and alerting to detect abnormal memory consumption patterns

🔍 How to Verify

Check if Vulnerable:

Check Python version and verify if it includes the fix commits (14b1fdb0a94b96f86fc7b86671ea9582b8676628 and related)

Check Version:

python --version

Verify Fix Applied:

Test HTTP requests with large Content-Length headers to ensure memory usage remains bounded

📡 Detection & Monitoring

Log Indicators:

  • Abnormally large HTTP response sizes in application logs
  • Memory exhaustion errors or warnings

Network Indicators:

  • HTTP requests to unknown or suspicious servers
  • Unusually large HTTP response payloads

SIEM Query:

source="application_logs" AND ("out of memory" OR "memory error" OR "response too large")

🔗 References

📤 Share & Export