NULL Pointer Dereference in libxml2 and lxml
Summary
CVE-2022-2309: NULL Pointer Dereference allows attackers to cause a denial of service (or application crash). Affects libxml2 versions < 2.9.14-r1. Fixed in 2.9.14-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 XML parsing library that provides various functionalities for processing XML documents. lxml is a Python library that wraps the libxml2 and libxslt libraries, providing an easy-to-use interface for XML processing in Python. This vulnerability affects versions 2.9.10 through 2.9.14 of libxml2 when used together with lxml. It is caused by a NULL pointer dereference in the iterwalk function, which can be triggered by processing untrusted input data. The vulnerability can lead to a denial of service or application crash.
Vulnerability Detail
The vulnerability arises due to a code sequence in the iterwalk function, which is also used by the canonicalize function. While this code sequence is not commonly used, certain scenarios, such as XML converters that serialize to C14N, can be vulnerable. If an application processes untrusted input via the iterwalk function, an attacker can exploit this vulnerability to trigger a crash. The impact of the vulnerability is limited to applications that use lxml in conjunction with libxml2 versions 2.9.10 through 2.9.14.
How To Fix
Minimum fixed version
2.9.14-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
If updating the libraries is not immediately feasible, a possible workaround is to avoid processing untrusted input via the iterwalk function. Applications can consider using alternative functions like iterparse, which is more efficient and not affected by this vulnerability.
Conclusion
The NULL Pointer Dereference vulnerability in libxml2 and lxml can result in a denial of service or application crash. It is crucial to update the affected libraries to the recommended versions to mitigate this vulnerability. If you need further assistance or support in addressing this vulnerability, please contact DevNack.com.
See every vulnerability recorded for libxml2 →
FAQ
The vulnerability affects libxml2 versions 2.9.10 through 2.9.14 when used in conjunction with lxml. Earlier versions of libxml2 and lxml are not affected.
The vulnerability can lead to a denial of service or application crash when processing untrusted input via the iterwalk function.
At the time of this report, there are no known exploits for this vulnerability.
Yes, updating libxml2 to version 2.9.14-r1 or later, and lxml to version 4.9.2-r0 or later, will fix this vulnerability.
One possible workaround is to avoid processing untrusted input via the iterwalk function and consider using iterparse instead.
Related vulnerabilities
Recent vulnerabilities recorded for libxml2.