Critical Vulnerability in Expat Package: Encoding Validation Flaw

expat Updated 02 Oct 2025

Summary

15/02/2022
N/A
Yes i
Critical
9.8

UBUNTU-CVE-2022-25235: xmltok_impl.c in Expat (aka libexpat) before 2.4.5 lacks certain validation of encoding, such as checks for whether a UTF-8 character is valid in a certain context. Affects expat versions < 2.1.0-4ubuntu1.4+esm4. Fixed in 2.1.0-4ubuntu1.4+esm4. 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

Expat is an XML parsing library widely used in various applications for its efficiency and ease of use. It provides a fast and lightweight way to parse XML documents, making it a popular choice among developers. However, a critical vulnerability has been identified in Expat, specifically in versions prior to 2.4.5, which affects its ability to validate UTF-8 character encoding. This flaw can lead to potential security risks, including denial of service and data corruption.

Vulnerability Detail

The vulnerability, identified as CVE-2022-25235, originates from the xmltok_impl.c file in Expat. It lacks adequate validation of encoding, particularly checks for whether a UTF-8 character is valid in a specific context. This oversight can allow attackers to exploit the library, potentially leading to severe consequences such as application crashes or unexpected behavior. The CVSS score for this vulnerability is 9.8, indicating a critical severity level.

How To Fix

Minimum fixed version

2.1.0-4ubuntu1.4+esm4

This is the first release that contains the fix.

sudo apt-get install --only-upgrade expat

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

Workaround

As a temporary workaround, users can avoid using the affected features of the Expat library until the package is updated. Additionally, implementing input validation on XML data before processing it with Expat can help mitigate some risks associated with this vulnerability.

Conclusion

The Expat package has a critical vulnerability that can severely impact applications using it. It is crucial for users to update to the patched version to safeguard their systems. Regular monitoring and validation practices should be implemented to prevent potential exploitation of such vulnerabilities.

See every vulnerability recorded for expat →

Share this vulnerability

FAQ

CVE-2022-25235 is a critical vulnerability in the Expat XML parsing library that arises from inadequate validation of UTF-8 character encoding.

You can use Vulert, which monitors and alerts in real-time for open-source vulnerabilities. By uploading your manifest file like package-lock.json, you can check if your application is affected.

The vulnerability can lead to denial of service, data corruption, and unexpected application behavior, posing significant security risks.

Yes, a patched version of the Expat package is available. Users should update to version 2.4.5 or later to mitigate the vulnerability.

Using tools like Vulert can help you monitor and receive alerts for open-source vulnerabilities in your software without requiring access to the code.

Related vulnerabilities

Recent vulnerabilities recorded for expat.

How To Fix

Minimum fixed version

2.1.0-4ubuntu1.4+esm4

This is the first release that contains the fix.

sudo apt-get install --only-upgrade expat

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

Follow Vulert in Google

Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.