CVE-2021-25951

7.5 HIGH

📋 TL;DR

CVE-2021-25951 is an XML External Entity (XXE) vulnerability in XML2Dict version 0.2.2 that allows attackers to cause denial of service by parsing malicious XML files. This affects applications using the vulnerable XML2Dict library to process untrusted XML input. Developers and systems using XML2Dict 0.2.2 for XML parsing are at risk.

💻 Affected Systems

Products:
  • XML2Dict
Versions: 0.2.2
Operating Systems: All platforms running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications that parse XML from untrusted sources using XML2Dict 0.2.2

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system unavailability through resource exhaustion or crash when processing malicious XML payloads

🟠

Likely Case

Application denial of service causing service disruption and potential data loss

🟢

If Mitigated

Minimal impact with proper input validation and XML parser configuration

🌐 Internet-Facing: HIGH - XML parsing of user-supplied data is common in web applications
🏢 Internal Only: MEDIUM - Internal systems may still process XML from untrusted sources

🎯 Exploit Status

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

XXE vulnerabilities are well-understood with readily available exploit techniques

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 0.2.3 and later

Vendor Advisory: https://github.com/amirziai/xml2dict

Restart Required: No

Instructions:

1. Update XML2Dict: pip install --upgrade xml2dict
2. Verify version: pip show xml2dict
3. Restart any services using the library

🔧 Temporary Workarounds

Disable external entity processing

all

Configure XML parser to disable external entity resolution

Modify code to use defusedxml library or set resolve_entities=False in parser configuration

Input validation and sanitization

all

Validate and sanitize XML input before processing

Implement XML schema validation or strip dangerous XML constructs

🧯 If You Can't Patch

  • Implement network segmentation to isolate vulnerable systems
  • Deploy web application firewall with XXE protection rules

🔍 How to Verify

Check if Vulnerable:

Check installed version: pip show xml2dict | grep Version

Check Version:

pip show xml2dict | grep Version

Verify Fix Applied:

Confirm version is 0.2.3 or higher: pip show xml2dict | grep Version

📡 Detection & Monitoring

Log Indicators:

  • Unusual XML parsing errors
  • Memory exhaustion alerts
  • Process crashes during XML processing

Network Indicators:

  • Large XML payloads with external entity references
  • Unusual outbound connections from XML parsers

SIEM Query:

source="application.logs" AND ("XML parsing error" OR "memory exhaustion" OR "xml2dict")

🔗 References

📤 Share & Export