CVE-2026-41650: fast-xml-parser XMLBuilder Comment and CDATA Injection Vulnerability
Summary
CVE-2026-41650: fast-xml-parser XMLBuilder: XML Comment and CDATA Injection via Unescaped Delimiters. Affects fast-xml-parser versions < 5.7.0. Fixed in 5.7.0. 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 popular JavaScript library used for parsing and building XML from JavaScript objects. It provides features like XML validation, customizable options for XML generation, and support for comments and CDATA sections. However, it has a vulnerability in its XMLBuilder component that allows for XML injection through unescaped delimiters in comments and CDATA sections.
Vulnerability Detail
The vulnerability arises from the fact that fast-xml-parser's XMLBuilder does not escape the --> sequence in comments or the ]]> sequence in CDATA sections when generating XML. This oversight can lead to XML injection attacks, allowing an attacker to inject malicious scripts or modify the structure of SOAP messages and RSS feeds. The potential ramifications include Cross-Site Scripting (XSS), SOAP injection, and data manipulation, making it a serious concern for applications that utilize user-controlled data in XML comments or CDATA.
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.7.0
This is the first release that contains the fix.
npm install fast-xml-parser@5.7.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If you cannot update the package immediately, you can implement a workaround by manually escaping the delimiters in your data before passing it to the XMLBuilder. For comments, replace '--' with '--'. For CDATA, split on ']]>' and rejoin with separate CDATA sections. Here is an example of how to do this:
const safeComment = userComment.replace(/--/g, '--');
const safeCdata = userCdata.replace(/]]>/g, ']]]]><![CDATA[>');
Conclusion
The fast-xml-parser library has a significant vulnerability (CVE-2026-41650) that allows for XML injection through unescaped delimiters in comments and CDATA sections. It is crucial to update to the patched version or implement workarounds to mitigate the risks associated with this vulnerability.
See every vulnerability recorded for fast-xml-parser →
FAQ
CVE-2026-41650 is a vulnerability in the fast-xml-parser library that allows for XML injection through unescaped delimiters in comments and CDATA sections.
The vulnerability can lead to XSS attacks, SOAP message manipulation, and data poisoning in RSS feeds, posing significant security risks.
You can use Vulert, which monitors open-source vulnerabilities in real-time. Visit Vulert Scanner to check if your application is affected without any signup.
Update the fast-xml-parser package to version 5.7.0 or later by running 'npm install fast-xml-parser@5.7.0' in your project directory.
Implement a workaround by manually escaping the delimiters in your data before passing it to the XMLBuilder.
References
Related vulnerabilities
Recent vulnerabilities recorded for fast-xml-parser.