fast-xml-parser DOCTYPE Injection RCE (CVE-2026-25896)
CVE-2026-25896
Critical 9.3 flaw in fast-xml-parser 4.1.3–5.3.4 lets attackers inject entities via DOCTYPE dots, leading to RCE. Patch to 5.3.5+ now.
Patch now - CVE-2026-25896 is a critical XSS vulnerability in fast-xml-parser versions 4.1.3 up to 5.3.4 that lets attackers hijack sessions and steal user data by crafting malicious DOCTYPE entities that bypass encoding. Update to version 5.3.5 or later immediately.
Overview
A critical vulnerability has been identified in the popular fast-xml-parser library, used for processing XML data in JavaScript and Node.js applications. This flaw allows an attacker to bypass standard security controls, potentially leading to cross-site scripting (XSS) attacks.
Vulnerability Details
The library is used to validate, parse, and build XML. In affected versions (from 4.1.3 to before 5.3.5), a weakness exists in how the parser handles special instructions within an XML document called DOCTYPE entities. Specifically, a period (.) in an entity name is incorrectly treated as a wildcard.
This allows an attacker to craft a malicious XML document where they can redefine fundamental, built-in XML entities - such as those representing the characters for less-than (<) or ampersand (&). By shadowing these core entities with arbitrary values, the attacker can bypass the normal encoding process that makes these characters safe for web browsers.
Impact
When a vulnerable application parses a malicious XML file and then renders the output directly into a webpage without proper sanitization, the attacker’s injected code can execute in a victim’s browser. This is a classic XSS attack, which can lead to:
- Session hijacking (stealing user login credentials).
- Defacement of websites.
- Theft of sensitive user data.
- Redirection of users to malicious sites.
Given the widespread use of this library and the high severity of XSS, this vulnerability is rated as CRITICAL with a CVSS score of 9.3.
Remediation and Mitigation
The primary and most effective action is to immediately update the fast-xml-parser dependency.
1. Immediate Update:
Upgrade fast-xml-parser to version 5.3.5 or later. This version contains the fix.
npm update fast-xml-parser
or
yarn upgrade fast-xml-parser
2. Version Check:
Verify your application is using an affected version (4.1.3 up to, but not including, 5.3.5). You can check your package.json file or run:
npm list fast-xml-parser
3. Defense-in-Depth: As a general security practice, always sanitize and validate any user-controlled data before rendering it in a browser, even after parsing. Treat all parsed XML content as potentially untrusted.
4. Temporary Mitigation: If an immediate update is not possible, consider disabling external entity parsing or DOCTYPE processing in the parser configuration where feasible, though this may affect functionality. The permanent solution is to apply the update.
Never miss a critical vulnerability
Get real-time security alerts delivered to your preferred platform.
Am I Affected by CVE-2026-25896?
Pick an ecosystem, paste your installed version, and we'll compare it against the fixed version published on OSV.dev. Browser-only — nothing is sent to a server.
Heuristic comparison only. Always cross-check against the vendor advisory before making patching decisions.
Related Advisories
WordPress TheCartPress 1.5.3.6 contains an unauthenticated privilege escalation vulnerability that allows attackers to create administrator accounts by submitting crafted requests to the AJAX handler....
WordPress MStore API 2.0.6 contains an arbitrary file upload vulnerability that allows unauthenticated attackers to upload malicious files by sending POST requests to the REST API endpoint. Attackers ...
OpenCATS 0.9.4 contains a remote code execution vulnerability that allows unauthenticated attackers to execute arbitrary commands by uploading malicious PHP files disguised as resume attachments. Atta...
In PHP versions 8.2.* before 8.2.31, 8.3.* before 8.3.31, 8.4.* before 8.4.21, and 8.5.* before 8.5.6, the SOAP extension's object deduplication mechanism stores pointers to PHP objects in a global ma...