Vulnerability in libxml2 - Integer Overflow and Entity Reference Cycle

libxml2 Updated 02 Oct 2025

Summary

05/11/2022
N/A
Yes i
Unrated
Not published

DSA-5271-1: libxml2 - security update. Affects libxml2 versions < 2.9.10+dfsg-6.7+deb11u3. Fixed in 2.9.10+dfsg-6.7+deb11u3. 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 Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

libxml2 is an open-source library that provides support for reading, modifying, and writing XML and HTML files. It is widely used in various applications and systems to handle XML data. However, a recent security update has identified two vulnerabilities in libxml2 that could potentially lead to serious security issues.

Vulnerability Detail

The first vulnerability, identified as CVE-2022-40303, involves missing safety checks in several functions of libxml2. When parsing an XML document with the XML_PARSE_HUGE option enabled, these safety checks are not performed, resulting in integer overflows. An attacker could exploit this vulnerability to cause a denial-of-service (DoS) attack or potentially execute arbitrary code.

The second vulnerability, identified as CVE-2022-40304, relates to the handling of entity reference cycles in libxml2. Due to a flaw in the detection mechanism, dictionary entries may become corrupted. This flaw can lead to logic errors, including memory errors like double free flaws, which can be exploited by an attacker to execute arbitrary code or cause a DoS attack.

How To Fix

Minimum fixed version

2.9.10+dfsg-6.7+deb11u3

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

There are no known workarounds for these vulnerabilities. It is crucial to apply the recommended fix by upgrading the libxml2 package to the latest version.

Conclusion

libxml2 is a widely used library for handling XML and HTML files, but it is not immune to security vulnerabilities. The recent security update has addressed two vulnerabilities that could potentially lead to serious security issues. It is crucial to upgrade the libxml2 package to the latest version to mitigate these risks. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for libxml2 →

Share this vulnerability

FAQ

libxml2 is an open-source library that provides support for reading, modifying, and writing XML and HTML files. It is widely used in various applications and systems.

CVE-2022-40303 is a vulnerability in libxml2 that involves missing safety checks in certain functions. It can result in integer overflows when parsing XML documents with the XML_PARSE_HUGE option enabled.

CVE-2022-40304 is a vulnerability in libxml2 related to the handling of entity reference cycles. It can lead to corrupted dictionary entries and logic errors, including memory errors like double free flaws.

These vulnerabilities can be exploited by attackers to cause a denial-of-service (DoS) attack, execute arbitrary code, or corrupt memory. It is crucial to apply the recommended fix to mitigate these risks.

To fix these vulnerabilities, you should upgrade the libxml2 package to version 2.9.10+dfsg-6.7+deb11u3 or later. This update includes patches that address the identified security issues.

Related vulnerabilities

Recent vulnerabilities recorded for libxml2.

How To Fix

Minimum fixed version

2.9.10+dfsg-6.7+deb11u3

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