Critical Use-After-Free Vulnerability in libxml2 Affects Multiple Alpine Versions

libxml2 Updated 02 Oct 2025

Summary

18/05/2021
N/A
Yes i
High
8.8

ALPINE-CVE-2021-3518: There's a flaw in libxml2 in versions before 2.9.11. Affects libxml2 versions < 2.9.9-r5. Fixed in 2.9.9-r5. 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 a range of functionalities for processing XML and HTML documents. It is known for its performance and compliance with standards. However, versions prior to 2.9.11 are vulnerable to a critical use-after-free flaw, which can lead to severe security implications.

Vulnerability Detail

There's a flaw in libxml2 in versions before 2.9.11. An attacker who is able to submit a crafted file to be processed by an application linked with libxml2 could trigger a use-after-free. This vulnerability can compromise confidentiality, integrity, and availability, allowing attackers to exploit the flaw for malicious purposes.

How To Fix

Minimum fixed version

2.9.9-r5

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 an immediate update is not possible, consider implementing input validation to sanitize any XML files before processing them with libxml2. This can help mitigate the risk of exploitation.

Conclusion

The use-after-free vulnerability in libxml2 poses significant risks to applications that rely on this library. It is crucial to update to the patched versions to safeguard against potential exploits. Regular monitoring and validation of dependencies can help maintain security.

See every vulnerability recorded for libxml2 →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 8.8, indicating a high severity level.

All versions of libxml2 prior to 2.9.11 are affected by this vulnerability.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. You can check your application using the Vulert playground without any signup.

The vulnerability can lead to unauthorized access, data corruption, and denial of service, affecting the confidentiality, integrity, and availability of the system.

Yes, implementing input validation to sanitize XML files before processing can help mitigate the risk until an update is applied.

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.9-r5

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