Use-After-Free Vulnerability in libxml2: Critical Security Flaw

libxml2 Updated 02 Oct 2025

Summary

26/02/2022
N/A
Yes i
Unrated
Not published

DEBIAN-CVE-2022-23308: valid.c in libxml2 before 2.9.13 has a use-after-free of ID and IDREF attributes. Affects libxml2 versions < 2.9.10+dfsg-6.7+deb11u1. Fixed in 2.9.10+dfsg-6.7+deb11u1. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

libxml2 is a widely used XML parsing library that provides a range of functionalities for processing XML and HTML documents. It is known for its performance and compliance with standards. However, prior to version 2.9.13, libxml2 was susceptible to a use-after-free vulnerability, which could lead to potential security risks in applications relying on this library.

Vulnerability Detail

The vulnerability identified as CVE-2022-23308 occurs in the valid.c file of libxml2 versions before 2.9.13. It involves a use-after-free condition affecting ID and IDREF attributes. This flaw can be exploited by attackers to manipulate memory, potentially leading to arbitrary code execution or application crashes. The issue arises from improper handling of memory allocation and deallocation, making it critical for users of the library to address it promptly.

How To Fix

Minimum fixed version

2.9.10+dfsg-6.7+deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade libxml2

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a workaround, users are advised to avoid using the affected features of libxml2 until they can update to the patched version. This may involve modifying the application code to bypass the use of ID and IDREF attributes temporarily.

Conclusion

The CVE-2022-23308 vulnerability in libxml2 poses significant security risks due to a use-after-free condition. It is crucial for users to update to the patched versions to mitigate these risks and ensure the integrity of their applications.

See every vulnerability recorded for libxml2 →

Share this vulnerability

FAQ

CVE-2022-23308 is a security vulnerability in libxml2 that allows for a use-after-free condition, potentially leading to memory corruption and security risks.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Versions of libxml2 prior to 2.9.13 are affected by this vulnerability.

Exploitation of this vulnerability could lead to application crashes, arbitrary code execution, or other security breaches.

You can update libxml2 by running 'sudo apt-get update && sudo apt-get install libxml2' in your terminal.

Related vulnerabilities

Recent vulnerabilities recorded for libxml2.

How To Fix

Minimum fixed version

2.9.10+dfsg-6.7+deb11u1

This is the first release that contains the fix.

sudo apt-get install --only-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