CVE-2026-142213: xml2js through 0.6.2 XML Injection via Builder CDATA Escaping
xml2js through 0.6.2 contains an XML injection vulnerability that allows attackers to break out of CDATA sections because escapeCDATA() in lib/builder.js only escapes the first ]]> sequence. Attackers controlling string values serialized with the cdata option can include a second ]]> to inject arbitrary elements and attributes, altering downstream XML parsing.
Affected Software
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using npm/xml2js through 0.6.2 are exposed when they serialize attacker-controlled string values with the builder's cdata option enabled. The impact occurs when the resulting XML is subsequently parsed or consumed by a downstream component.
What does an attacker need to exploit it?
An attacker must be able to control a string value that the application serializes into a CDATA section. The supplied value must contain a second ]]> sequence, allowing the attacker to close the CDATA section and inject XML elements or attributes.
Is a default xml2js configuration affected?
The described vulnerable path specifically requires use of the cdata option during serialization. The provided information does not establish that applications not using this option are affected.
How can I determine whether my application is affected?
Check whether your dependency uses xml2js version 0.6.2 or earlier and whether calls to its XML builder enable the cdata option for values influenced by external input. Review downstream XML consumers to determine whether injected elements or attributes could alter processing.