CVE-2022-23852
📋 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
- Expat (libexpat)
- Any software using vulnerable libexpat versions
- Siemens products listed in advisory
- NetApp products listed in advisory
📦 What is this software?
Communications Metasolv Solution by Oracle
Libexpat by Libexpat Project
Nessus by Tenable
Nessus by Tenable
⚠️ 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.
🎯 Exploit Status
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
allConfigure 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
allIf 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
- https://cert-portal.siemens.com/productcert/pdf/ssa-484086.pdf
- https://github.com/libexpat/libexpat/pull/550
- https://lists.debian.org/debian-lts-announce/2022/03/msg00007.html
- https://security.gentoo.org/glsa/202209-24
- https://security.netapp.com/advisory/ntap-20220217-0001/
- https://www.debian.org/security/2022/dsa-5073
- https://www.oracle.com/security-alerts/cpuapr2022.html
- https://www.tenable.com/security/tns-2022-05
- https://cert-portal.siemens.com/productcert/pdf/ssa-484086.pdf
- https://github.com/libexpat/libexpat/pull/550
- https://lists.debian.org/debian-lts-announce/2022/03/msg00007.html
- https://security.gentoo.org/glsa/202209-24
- https://security.netapp.com/advisory/ntap-20220217-0001/
- https://www.debian.org/security/2022/dsa-5073
- https://www.oracle.com/security-alerts/cpuapr2022.html
- https://www.tenable.com/security/tns-2022-05