CVE-2026-25896: fast-xml-parser Entity Encoding Bypass via Regex Injection

fast-xml-parser Updated 20 Feb 2026

Summary

20/02/2026
Yes i
Critical
9.3

CVE-2026-25896: fast-xml-parser has an entity encoding bypass via regex injection in DOCTYPE entity names. Affects fast-xml-parser versions >= 4.1.3, < 5.3.5. Fixed in 5.3.5. 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

fast-xml-parser is a widely used XML parsing library in the npm ecosystem, designed to efficiently convert XML data into JavaScript objects. It is known for its speed and ease of use, making it a popular choice among developers. However, it has a critical vulnerability that allows attackers to bypass entity encoding, leading to potential cross-site scripting (XSS) attacks when untrusted XML is parsed and rendered.

Vulnerability Detail

The vulnerability arises from the handling of DOCTYPE entity names in fast-xml-parser. A dot (.) in an entity name is treated as a regex wildcard, allowing attackers to shadow built-in XML entities such as <, >, &, ", and ' with arbitrary values. This oversight can lead to XSS when the parsed output is rendered in a web application. The issue was introduced because the regex metacharacter '.' was not included in the character blacklist, despite being valid in XML names according to the W3C specification. As a result, attackers can inject malicious scripts into the output, compromising the security of applications that rely on this library.

How To Fix

Latest published version: 5.11.2 as of 23 Oct 2026

npm install fast-xml-parser@5.11.2

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.3.5

This is the first release that contains the fix.

npm install fast-xml-parser@5.3.5

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

Workaround

As a temporary workaround, you can validate and sanitize any XML input before parsing it with fast-xml-parser. This can help mitigate the risk of XSS attacks until the package is updated. Additionally, you can avoid using DOCTYPE declarations in your XML to prevent this vulnerability from being exploited.

Conclusion

CVE-2026-25896 represents a significant security risk for applications using the fast-xml-parser library. By understanding the nature of this vulnerability and implementing the recommended fixes, developers can protect their applications from potential XSS attacks. Regularly updating dependencies and utilizing tools like Vulert can help maintain security in software projects.

See every vulnerability recorded for fast-xml-parser →

Share this vulnerability

FAQ

CVE-2026-25896 is a critical vulnerability in the fast-xml-parser library that allows for entity encoding bypass via regex injection in DOCTYPE entity names.

If your application uses fast-xml-parser to parse untrusted XML, an attacker could exploit this vulnerability to inject malicious scripts, leading to XSS attacks.

Versions prior to 5.3.5 are affected by this vulnerability. It is recommended to upgrade to version 5.3.5 or later to mitigate the risk.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Without requiring access to the code or installation, you can check your package-lock.json file for vulnerabilities.

The CVSS score of CVE-2026-25896 is 9.3, indicating a critical level of severity.

Related vulnerabilities

Recent vulnerabilities recorded for fast-xml-parser.

How To Fix

Latest published version: 5.11.2 as of 23 Oct 2026

npm install fast-xml-parser@5.11.2

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

5.3.5

This is the first release that contains the fix.

npm install fast-xml-parser@5.3.5

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