CVE-2022-22822
📋 TL;DR
CVE-2022-22822 is an integer overflow vulnerability in Expat's XML parser that can lead to heap buffer overflow. This allows attackers to execute arbitrary code or cause denial of service by processing specially crafted XML files. Any application using vulnerable versions of libexpat (2.4.2 and earlier) is affected.
💻 Affected Systems
- Expat (libexpat)
- Any software using libexpat library
📦 What is this software?
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, potentially leading to service disruption.
If Mitigated
Limited impact if proper input validation and memory protections are in place.
🎯 Exploit Status
Proof-of-concept available in security advisories. Exploitation requires attacker to supply malicious XML to vulnerable parser.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Expat 2.4.3 and later
Vendor Advisory: https://github.com/libexpat/libexpat/blob/R_2_4_3/expat/Changes
Restart Required: Yes
Instructions:
1. Update libexpat to version 2.4.3 or later. 2. For Linux systems: Use package manager (apt-get update && apt-get upgrade libexpat1, yum update expat, etc.). 3. For embedded systems: Recompile with patched library. 4. Restart affected services.
🔧 Temporary Workarounds
Input Validation
allValidate and sanitize XML input before parsing
Memory Protection
linuxEnable ASLR and other memory protection mechanisms
sysctl -w kernel.randomize_va_space=2
🧯 If You Can't Patch
- Implement strict XML schema validation to reject malformed documents
- Use network segmentation to isolate vulnerable systems from untrusted networks
🔍 How to Verify
Check if Vulnerable:
Check libexpat version: expat --version or check package version (dpkg -l | grep expat, rpm -q expat)
Check Version:
expat --version 2>/dev/null || dpkg -l | grep expat || rpm -q expat || find /usr -name '*expat*' -exec strings {} \; | grep -i 'expat version'
Verify Fix Applied:
Confirm version is 2.4.3 or higher and test with known malicious XML samples
📡 Detection & Monitoring
Log Indicators:
- Application crashes with segmentation faults
- Unusual XML parsing errors
- Memory allocation failures
Network Indicators:
- Unusually large XML payloads
- XML with malformed element structures
SIEM Query:
source="application.log" AND ("segmentation fault" OR "SIGSEGV") AND process="*expat*"
🔗 References
- http://www.openwall.com/lists/oss-security/2022/01/17/3
- https://cert-portal.siemens.com/productcert/pdf/ssa-484086.pdf
- https://github.com/libexpat/libexpat/pull/539
- https://security.gentoo.org/glsa/202209-24
- https://www.debian.org/security/2022/dsa-5073
- https://www.tenable.com/security/tns-2022-05
- http://www.openwall.com/lists/oss-security/2022/01/17/3
- https://cert-portal.siemens.com/productcert/pdf/ssa-484086.pdf
- https://github.com/libexpat/libexpat/pull/539
- https://security.gentoo.org/glsa/202209-24
- https://www.debian.org/security/2022/dsa-5073
- https://www.tenable.com/security/tns-2022-05