CVE-2025-12084

5.3 MEDIUM

📋 TL;DR

CVE-2025-12084 is a denial-of-service vulnerability in Python's xml.dom.minidom module where building deeply nested XML documents triggers quadratic time complexity, causing excessive CPU consumption and potential service unavailability. This affects any Python application using xml.dom.minidom methods like appendChild() to process untrusted XML input. The vulnerability impacts availability but does not allow code execution or data compromise.

💻 Affected Systems

Products:
  • Python
  • Applications using Python's xml.dom.minidom module
Versions: Python versions before the fix (specific version depends on patch release)
Operating Systems: All operating systems running affected Python versions
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using xml.dom.minidom methods like appendChild() with nested element operations. Other XML parsing methods are not affected.

📦 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 unavailability due to CPU exhaustion when processing maliciously crafted deeply nested XML documents, leading to denial of service for legitimate users.

🟠

Likely Case

Degraded performance or temporary service disruption when processing unusually complex XML documents, particularly in applications handling user-generated XML content.

🟢

If Mitigated

Minimal impact with proper input validation and resource limits, though performance degradation may still occur with legitimate complex documents.

🌐 Internet-Facing: MEDIUM - Internet-facing applications accepting XML input could be targeted for DoS attacks, but requires specific XML structure and may be mitigated by other controls.
🏢 Internal Only: LOW - Internal systems typically process trusted XML and are less likely to encounter malicious nested structures.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW - Attack requires crafting deeply nested XML documents but no special authentication needed.

Exploitation requires the attacker to supply XML input to vulnerable applications. No public exploit code is known at this time.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Check Python security releases for specific version - patches are in CPython commits 027f21e, 08d8e18, 27648a1, 41f4687, 57937a8

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

Restart Required: Yes

Instructions:

1. Identify Python version in use. 2. Update to latest Python security release. 3. Restart all Python applications and services. 4. Test XML processing functionality after update.

🔧 Temporary Workarounds

Input Validation and Depth Limiting

all

Implement XML document depth validation before processing to prevent excessively nested structures.

# Python example: Validate XML depth before processing
import xml.etree.ElementTree as ET
from xml.dom import minidom

def validate_xml_depth(xml_string, max_depth=100):
    root = ET.fromstring(xml_string)
    def check_depth(elem, current=1):
        if current > max_depth:
            raise ValueError(f"XML depth exceeds limit of {max_depth}")
        for child in elem:
            check_depth(child, current+1)
    check_depth(root)
    return True

Use Alternative XML Parsers

all

Replace xml.dom.minidom usage with xml.etree.ElementTree or lxml which are not affected by this specific vulnerability.

# Replace minidom with ElementTree
# Instead of: from xml.dom import minidom
# Use: import xml.etree.ElementTree as ET

🧯 If You Can't Patch

  • Implement strict input validation to reject XML documents with excessive nesting depth
  • Deploy rate limiting and resource quotas to prevent CPU exhaustion from malicious requests

🔍 How to Verify

Check if Vulnerable:

Check if application uses xml.dom.minidom methods like appendChild() with potentially untrusted XML input. Review code for imports from xml.dom.minidom.

Check Version:

python --version or python -c "import sys; print(sys.version)"

Verify Fix Applied:

After patching, test with sample deeply nested XML documents to ensure performance remains stable and no CPU exhaustion occurs.

📡 Detection & Monitoring

Log Indicators:

  • High CPU usage spikes during XML processing
  • Application timeouts or crashes when handling XML input
  • Unusually long processing times for XML documents

Network Indicators:

  • Multiple large XML payloads sent to XML processing endpoints
  • Repeated XML submissions to trigger resource exhaustion

SIEM Query:

source="application_logs" AND ("xml.dom.minidom" OR "appendChild") AND (cpu_usage>90 OR duration>30s)

🔗 References

📤 Share & Export