Use-After-Free Vulnerability in libxml2: Critical XML Schema Processing Flaw
Summary
CVE-2024-56171: libxml2 before 2.12.10 and 2.13.x before 2.13.6 has a use-after-free in xmlSchemaIDCFillNodeTables and xmlSchemaBubbleIDCNodeTables in xmlschemas.c. Affects libxml2 across 2 version ranges.
< 2.11.8-r1
>= 4b637079f26d8f5879ed45eb18cd249cad261951, < 02d577715e1951cf114ca4e9adaf5605156c4f4c
Fixed in 2.11.8-r1. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
libxml2 is a widely used open-source library for parsing XML documents. It provides a range of functionalities including validation of XML against schemas, XPath support, and more. The library is integral to many applications that rely on XML data processing. However, certain versions of libxml2 are vulnerable to a use-after-free condition, which can lead to potential exploitation if an attacker crafts a malicious XML document or schema.
Vulnerability Detail
The vulnerability, identified as CVE-2024-56171, exists in libxml2 versions prior to 2.12.10 and 2.13.x before 2.13.6. It arises from a use-after-free condition in the functions xmlSchemaIDCFillNodeTables and xmlSchemaBubbleIDCNodeTables within the xmlschemas.c file. This flaw can be exploited by validating a specially crafted XML document against an XML schema that contains specific identity constraints, or by using a crafted XML schema. Successful exploitation may lead to application crashes or arbitrary code execution, posing significant risks to affected systems.
How To Fix
Minimum fixed version
2.11.8-r1
This is the first release that contains the fix.
sudo apk add --upgrade libxml2
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid processing untrusted XML documents or schemas until the library is updated to a secure version. Additionally, consider implementing input validation to filter out potentially malicious content.
Conclusion
CVE-2024-56171 represents a significant risk for applications using vulnerable versions of libxml2. It is crucial for users to update their libraries promptly to mitigate potential exploitation. By following the recommended steps for updating and implementing workarounds, users can protect their systems from this vulnerability.
See every vulnerability recorded for libxml2 →
FAQ
CVE-2024-56171 is a vulnerability in libxml2 that allows for a use-after-free condition, potentially leading to application crashes or code execution.
libxml2 versions before 2.12.10 and 2.13.x before 2.13.6 are vulnerable to this issue.
You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
If an immediate update is not possible, avoid processing untrusted XML documents and implement input validation as a temporary measure.
More details can be found in the official CVE database or through the provided source link in the vulnerability details.
References
Related vulnerabilities
Recent vulnerabilities recorded for libxml2.