CVE-2022-22823 Overview
CVE-2022-22823 is a critical integer overflow vulnerability in the build_model function within xmlparse.c of Expat (libexpat) versions prior to 2.4.3. This vulnerability affects the widely-used XML parsing library that is embedded in numerous applications and systems across the software ecosystem.
Critical Impact
This integer overflow vulnerability in libexpat can be exploited remotely over the network without authentication, potentially leading to complete system compromise including confidentiality, integrity, and availability impacts.
Affected Products
- libexpat_project libexpat (versions before 2.4.3)
- Tenable Nessus
- Debian Linux 10.0 and 11.0
- Siemens SINEMA Remote Connect Server
Discovery Timeline
- 2022-01-10 - CVE CVE-2022-22823 published to NVD
- 2025-05-05 - Last updated in NVD database
Technical Details for CVE-2022-22823
Vulnerability Analysis
The vulnerability resides in the build_model function located in xmlparse.c within the Expat XML parsing library. This function is responsible for constructing content models during XML document type definition (DTD) processing. The integer overflow condition (CWE-190) occurs when the function performs arithmetic operations on integer values without proper bounds checking.
When processing specially crafted XML content with complex or deeply nested DTD structures, the function can experience an integer wraparound condition. This occurs because the calculations used to determine memory allocation sizes or array indices can exceed the maximum value representable by the integer type, causing the value to wrap around to a small or negative number.
The exploitation path requires no authentication and can be triggered over the network by submitting maliciously crafted XML data to any application that uses the vulnerable libexpat library for XML parsing. Given libexpat's widespread use as a foundational XML parsing component, the attack surface is substantial across various platforms and applications.
Root Cause
The root cause is an integer overflow vulnerability (CWE-190) in the build_model function. When processing XML documents with specially crafted document type definitions, arithmetic operations performed during content model construction can overflow their integer boundaries. This can lead to undersized memory allocations, buffer overflows, or other memory corruption conditions that attackers can leverage for exploitation.
Attack Vector
The attack vector is network-based, requiring an attacker to send malicious XML content to a vulnerable application. The attack can be executed remotely without user interaction and without requiring any privileges or authentication. An attacker crafts an XML document with DTD content specifically designed to trigger the integer overflow in build_model during parsing.
Applications that accept XML input from untrusted sources—such as web services, API endpoints, file processors, or any network-facing service using libexpat—are particularly at risk. The vulnerability can be triggered through various XML delivery mechanisms including HTTP requests, file uploads, SOAP messages, or any other XML-based communication protocol.
Detection Methods for CVE-2022-22823
Indicators of Compromise
- Unusual XML parsing errors or crashes in applications using libexpat
- Unexpected memory consumption spikes during XML processing operations
- Application crashes with stack traces referencing build_model or xmlparse.c
- Anomalous XML documents with excessively complex or deeply nested DTD structures
- Evidence of memory corruption in libexpat-dependent processes
Detection Strategies
- Inventory all systems and applications using libexpat and verify version numbers are 2.4.3 or later
- Monitor application logs for XML parsing failures or exceptions during DTD processing
- Implement application-layer firewalls or WAFs with rules to detect malformed or oversized DTD content
- Deploy endpoint detection solutions capable of identifying exploitation attempts targeting integer overflow conditions
Monitoring Recommendations
- Enable verbose logging for XML parsing operations in critical applications
- Monitor system resource utilization for abnormal patterns during XML processing
- Track libexpat library versions across the environment using software composition analysis tools
- Set up alerts for crashes or unexpected terminations in services that process XML data
How to Mitigate CVE-2022-22823
Immediate Actions Required
- Update libexpat to version 2.4.3 or later immediately across all affected systems
- Identify all applications embedding or dynamically linking to libexpat and apply vendor patches
- Restrict XML processing from untrusted sources where possible until patches are applied
- Review vendor security advisories for embedded libexpat updates in downstream products
Patch Information
The vulnerability is addressed in libexpat version 2.4.3 and later. Organizations should update their libexpat installations and any applications that bundle the library. Multiple vendors have released security advisories and patches:
- Debian Security Advisory DSA-5073 provides patched packages for Debian Linux
- Tenable Security Notice TNS-2022-05 addresses the vulnerability in Nessus
- Siemens Product Security Advisory provides guidance for SINEMA Remote Connect Server
- GitHub Expat Pull Request contains the upstream fix
- Gentoo GLSA 202209-24 provides guidance for Gentoo users
Workarounds
- Disable DTD processing in XML parsers where the feature is not required
- Implement strict input validation to reject XML documents with complex DTD structures
- Deploy network-level filtering to block potentially malicious XML content
- Consider using alternative XML parsing configurations that minimize DTD processing exposure
# Configuration example - Check libexpat version on Linux systems
dpkg -l | grep libexpat # Debian/Ubuntu
rpm -qa | grep expat # RHEL/CentOS
# Update libexpat on Debian-based systems
sudo apt-get update && sudo apt-get install libexpat1
# Update libexpat on RHEL-based systems
sudo yum update expat
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


