CVE-2026-25896: fast-xml-parser Entity Encoding Bypass via Regex Injection
Summary
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 ↓
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.
No signup required · Results in about 60 seconds
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 →
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.
References
Related vulnerabilities
Recent vulnerabilities recorded for fast-xml-parser.