Integer Overflow in Expat (libexpat) - CVE-2022-25314

expat Updated 02 Oct 2025

Summary

18/02/2022
N/A
Yes i
High
7.5

CVE-2022-25314: In Expat (aka libexpat) before 2.4.5, there is an integer overflow in copyString. Affects expat across 2 version ranges.

< 2.2.10-r2 < 97a4840578693a346e79302909b67d97492e1880

Fixed in 2.2.10-r2. 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Expat (libexpat) is an open-source XML parsing library that is widely used in various applications and programming languages. It provides a set of functions and APIs for parsing XML documents. The library is known for its simplicity, efficiency, and cross-platform compatibility. However, a vulnerability has been discovered in Expat that could lead to an integer overflow.

Vulnerability Detail

The vulnerability, identified as CVE-2022-25314, is an integer overflow in the copyString function of Expat. This vulnerability occurs when copying a string with a length that exceeds the maximum value that can be represented by an integer. An attacker could exploit this vulnerability by crafting a malicious XML document that triggers the integer overflow, potentially leading to a heap-based buffer overflow or other memory corruption issues. This could result in remote code execution or denial of service attacks.

How To Fix

Minimum fixed version

2.2.10-r2

This is the first release that contains the fix.

sudo apk add --upgrade expat

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

Workaround

There is no known workaround for this vulnerability. It is essential to apply the official patch or update the Expat library to the latest version as soon as possible.

Conclusion

The integer overflow vulnerability in Expat (libexpat) can have severe consequences, including remote code execution and denial of service attacks. It is crucial to update the Expat library to the latest version (2.4.5 or later) to mitigate this vulnerability. Regularly checking for updates and staying informed about security advisories is essential to ensure the continued security of applications using Expat.

See every vulnerability recorded for expat →

Share this vulnerability

FAQ

Expat (libexpat) is an open-source XML parsing library used for processing XML documents in various applications and programming languages.

This vulnerability could potentially allow an attacker to execute arbitrary code or cause a denial of service by exploiting the integer overflow in Expat.

To fix this vulnerability, update the Expat library to version 2.4.5 or later, as it contains a patch for this issue.

No, there are no known workarounds for this vulnerability. It is crucial to update the Expat library to the latest version.

You can find more information about this vulnerability in the CVE-2022-25314 JSON report available at the following source: https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-25314.json

Related vulnerabilities

Recent vulnerabilities recorded for expat.

How To Fix

Minimum fixed version

2.2.10-r2

This is the first release that contains the fix.

sudo apk add --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