CVE-2010-4657

7.5 HIGH

📋 TL;DR

This vulnerability in PHP5 allows attackers to pass invalid UTF-8 strings to xmlTextWriterWriteAttribute, causing libxml2 to misparse them and leak memory into the output. This affects PHP applications using XML writing functionality before version 5.4.4.

💻 Affected Systems

Products:
  • PHP
Versions: PHP5 versions before 5.4.4
Operating Systems: All operating systems running affected PHP versions
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using xmlTextWriterWriteAttribute function with invalid UTF-8 input.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Memory exhaustion leading to denial of service, potential information disclosure through memory contents in output, or application crashes.

🟠

Likely Case

Denial of service through memory exhaustion or application instability when processing malicious XML input.

🟢

If Mitigated

Minimal impact if input validation and proper error handling are implemented.

🌐 Internet-Facing: MEDIUM - Web applications processing XML from untrusted sources are vulnerable.
🏢 Internal Only: LOW - Internal systems with controlled XML input sources face minimal risk.

🎯 Exploit Status

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

Exploitation requires sending specially crafted invalid UTF-8 strings to XML processing functions.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: PHP 5.4.4 and later

Vendor Advisory: https://bugs.php.net/bug.php?id=65544

Restart Required: Yes

Instructions:

1. Update PHP to version 5.4.4 or later. 2. Restart web server and PHP-FPM services. 3. Test XML functionality after update.

🔧 Temporary Workarounds

Input Validation

all

Validate and sanitize all UTF-8 strings before passing to xmlTextWriterWriteAttribute.

Disable Vulnerable Function

all

Avoid using xmlTextWriterWriteAttribute with untrusted input if patching isn't immediate.

🧯 If You Can't Patch

  • Implement strict input validation for all XML-related functions
  • Use WAF rules to block malformed UTF-8 sequences in XML payloads

🔍 How to Verify

Check if Vulnerable:

Check PHP version with 'php -v' and verify it's below 5.4.4.

Check Version:

php -v | grep 'PHP'

Verify Fix Applied:

Confirm PHP version is 5.4.4 or higher and test XML writing functionality.

📡 Detection & Monitoring

Log Indicators:

  • Memory allocation errors
  • PHP segmentation faults
  • XML parsing errors with invalid UTF-8

Network Indicators:

  • HTTP requests with malformed UTF-8 in XML payloads

SIEM Query:

source="php_error.log" AND ("memory" OR "segmentation" OR "xml")

🔗 References

📤 Share & Export