CVE-2022-25235 in libexpatinfo

Summary

by MITRE • 02/16/2022

xmltok_impl.c in Expat (aka libexpat) before 2.4.5 lacks certain validation of encoding, such as checks for whether a UTF-8 character is valid in a certain context.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 05/20/2025

The vulnerability identified as CVE-2022-25235 affects the Expat XML parser library, specifically within the xmltok_impl.c component that handles tokenization of XML documents. This issue represents a critical weakness in the library's encoding validation mechanisms that can lead to severe security implications for applications relying on Expat for XML processing. The vulnerability exists in versions prior to 2.4.5 and stems from insufficient validation of UTF-8 character encoding during XML parsing operations, creating potential attack vectors that could be exploited by malicious actors.

The technical flaw manifests in the parser's inability to properly validate UTF-8 character sequences within XML documents, particularly when these characters appear in specific contexts where they should be restricted or require additional validation. This weakness allows attackers to craft malicious XML content that may bypass normal encoding checks, potentially leading to memory corruption, denial of service conditions, or in some cases, arbitrary code execution depending on how the parsed XML is subsequently processed by applications. The vulnerability specifically targets the tokenizer's handling of UTF-8 encoding, which is fundamental to XML processing and character data representation.

From an operational impact perspective, this vulnerability affects any application or system that utilizes the Expat library for XML parsing, including web applications, enterprise software, and security tools that process XML data from untrusted sources. The weakness can be exploited through XML external entity (XXE) attacks, where attackers inject malformed UTF-8 sequences that trigger the validation bypass, potentially leading to service disruption or data compromise. The vulnerability's impact is amplified because Expat is widely used across numerous platforms and applications, making it a significant concern for organizations maintaining software supply chains. According to CWE classification, this vulnerability maps to CWE-129, which addresses insufficient validation of character encoding, and aligns with ATT&CK technique T1210 for exploitation of weaknesses in XML parsers.

Organizations should prioritize immediate remediation by upgrading to Expat version 2.4.5 or later, which includes enhanced UTF-8 validation checks and proper encoding context validation. Additionally, implementing proper input sanitization and validation at application layers can provide defense-in-depth protection against exploitation attempts. Security teams should monitor for any instances where XML data from external sources is processed without adequate validation, as these scenarios represent the primary attack surface for this vulnerability. The fix addresses the core issue by strengthening the tokenizer's encoding validation logic to ensure that all UTF-8 characters are properly validated according to RFC standards and XML specification requirements, thereby preventing malformed character sequences from being accepted during parsing operations.

Reservation

02/16/2022

Disclosure

02/16/2022

Moderation

accepted

CPE

ready

EPSS

0.04915

KEV

no

Activities

very low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!