CVE-2022-23852

9.8 CRITICAL

📋 TL;DR

CVE-2022-23852 is a signed integer overflow vulnerability in Expat (libexpat) XML parser that can lead to buffer overflow. When XML_CONTEXT_BYTES is configured to a nonzero value, XML_GetBuffer can overflow, potentially allowing arbitrary code execution. This affects any software using vulnerable versions of libexpat for XML parsing.

💻 Affected Systems

Products:
  • Expat (libexpat)
  • Any software using vulnerable libexpat versions
  • Siemens products listed in advisory
  • NetApp products listed in advisory
Versions: Expat versions before 2.4.4
Operating Systems: Linux, Windows, macOS, BSD, Embedded systems
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when XML_CONTEXT_BYTES is configured to a nonzero value. Many default configurations use XML_CONTEXT_BYTES=0 which is not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or ransomware deployment.

🟠

Likely Case

Denial of service through application crashes, with potential for memory corruption leading to code execution in specific configurations.

🟢

If Mitigated

Application crash without code execution if memory protections (ASLR, DEP) are effective.

🌐 Internet-Facing: HIGH - Many web services and applications use XML parsing, potentially exposing this vulnerability to remote attackers.
🏢 Internal Only: MEDIUM - Internal applications using XML parsing could be exploited by authenticated users or through lateral movement.

🎯 Exploit Status

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

Proof-of-concept code exists in the public domain. Exploitation requires specific XML_CONTEXT_BYTES configuration and may be mitigated by modern OS protections.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Expat 2.4.4 and later

Vendor Advisory: https://github.com/libexpat/libexpat/pull/550

Restart Required: Yes

Instructions:

1. Update libexpat to version 2.4.4 or later. 2. For Linux: Use package manager (apt-get update && apt-get install libexpat1). 3. For Windows: Download from official source. 4. Rebuild any statically linked applications. 5. Restart affected services.

🔧 Temporary Workarounds

Set XML_CONTEXT_BYTES to zero

all

Configure applications to use XML_CONTEXT_BYTES=0 which disables the vulnerable code path

export XML_CONTEXT_BYTES=0
Set environment variable before application start

Disable XML parsing features

all

If possible, disable XML parsing in affected applications or use alternative parsers

🧯 If You Can't Patch

  • Implement network segmentation to isolate vulnerable systems
  • Deploy application allowlisting to prevent unauthorized code execution

🔍 How to Verify

Check if Vulnerable:

Check libexpat version: expat --version or ldd on binary to check linked library version

Check Version:

expat --version 2>/dev/null || strings /usr/lib*/libexpat.so* | grep -i 'expat_' | head -1

Verify Fix Applied:

Verify version is 2.4.4 or later: expat --version | grep -q '2.4.[4-9]\|2.[5-9]'

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults
  • Memory corruption errors in application logs
  • Unexpected process termination

Network Indicators:

  • Malformed XML payloads in network traffic
  • XML parsing errors followed by crashes

SIEM Query:

source="application.log" AND ("segmentation fault" OR "SIGSEGV") AND process="*expat*"

🔗 References

📤 Share & Export