CVE-2024-37388

9.1 CRITICAL

📋 TL;DR

This XXE vulnerability in ebookmeta's lxml library allows attackers to read sensitive files from the server or cause denial of service by processing malicious XML input. It affects applications using ebookmeta's get_metadata function with vulnerable lxml versions. Any system processing untrusted XML through this function is at risk.

💻 Affected Systems

Products:
  • ebookmeta
  • lxml
Versions: lxml versions before 4.9.1
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects ebookmeta's get_metadata function usage, not all lxml usage. Requires processing untrusted XML input.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server file system disclosure including sensitive configuration files, credentials, and system files leading to full compromise.

🟠

Likely Case

Partial file disclosure from web-accessible directories and potential DoS through resource exhaustion.

🟢

If Mitigated

Limited impact with proper XML parsing restrictions and input validation in place.

🌐 Internet-Facing: HIGH - Directly exploitable via XML input to affected endpoints.
🏢 Internal Only: MEDIUM - Requires internal access to trigger but still dangerous if exploited.

🎯 Exploit Status

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

Simple XXE payloads work directly. Proof of concept available in GitHub issue.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: lxml 4.9.1

Vendor Advisory: https://github.com/dnkorpushov/ebookmeta/issues/16

Restart Required: No

Instructions:

1. Update lxml: pip install --upgrade lxml>=4.9.1
2. Verify ebookmeta uses updated lxml
3. Test XML parsing functionality

🔧 Temporary Workarounds

Disable XXE in lxml

all

Configure lxml parser to disable external entity resolution

parser = etree.XMLParser(resolve_entities=False, no_network=True)

Input validation

all

Reject XML containing DOCTYPE declarations or external entities

if '<!DOCTYPE' in xml_input: raise ValueError('DOCTYPE not allowed')

🧯 If You Can't Patch

  • Implement WAF rules to block XML with DOCTYPE declarations
  • Isolate ebookmeta processing to container with minimal file access

🔍 How to Verify

Check if Vulnerable:

Check lxml version: python -c "import lxml; print(lxml.__version__)" and verify if <4.9.1

Check Version:

python -c "import lxml; print(lxml.__version__)"

Verify Fix Applied:

Test with known XXE payload after update - should not disclose files

📡 Detection & Monitoring

Log Indicators:

  • XML parsing errors
  • File access attempts from XML parser
  • Large XML file processing

Network Indicators:

  • HTTP requests with XML containing DOCTYPE or SYSTEM entities
  • Outbound connections from XML parser

SIEM Query:

source="web_logs" AND ("<!DOCTYPE" OR "SYSTEM" OR "ENTITY") AND dest_port=80

🔗 References

📤 Share & Export