NULL Pointer Dereference in libxml2 and lxml

libxml2 Updated 02 Oct 2025

Summary

05/07/2022
N/A
Yes i
High
7.5

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 ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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 →

Share this vulnerability

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.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback