Stack Exhaustion Vulnerability in Expat (libexpat)

expat Updated 02 Oct 2025

Summary

18/02/2022
N/A
Yes i
Medium
6.5

CVE-2022-25313: In Expat (aka libexpat) before 2.4.5, an attacker can trigger stack exhaustion in build_model via a large nesting depth in the DTD element. 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 Your last release was probably never penetration tested 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 widely used in various applications and programming languages. It provides a set of functions and APIs for parsing XML documents and extracting data. The library is known for its efficiency and portability, making it a popular choice for developers. However, a vulnerability has been discovered in Expat that can lead to stack exhaustion, potentially allowing an attacker to cause a denial-of-service (DoS) condition. This vulnerability exists in versions prior to 2.4.5.

Vulnerability Detail

The vulnerability, identified as CVE-2022-25313, arises from a stack exhaustion issue in the 'build_model' function of Expat. By exploiting a large nesting depth in the Document Type Definition (DTD) element, an attacker can trigger the exhaustion of the stack. This can result in the application crashing or becoming unresponsive, leading to a DoS condition. The impact of this vulnerability can vary depending on the context in which Expat is used, but it has the potential to disrupt the normal operation of affected systems.

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

No specific workaround has been provided for this vulnerability. It is advised to apply the recommended fix by updating Expat to the latest version.

Conclusion

The stack exhaustion vulnerability in Expat (libexpat) can be mitigated by updating to the latest version. It is crucial for developers and system administrators to promptly apply the recommended fix to ensure the security and stability of their systems. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for expat →

Share this vulnerability

FAQ

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

The vulnerability can lead to stack exhaustion, potentially causing a denial-of-service (DoS) condition. This can result in the application crashing or becoming unresponsive.

Versions of Expat prior to 2.4.5 are affected by this vulnerability.

No specific workaround has been provided. It is recommended to update Expat to the latest version.

To fix this vulnerability, update Expat to version 2.4.5 or later.

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