CVE-2026-83609: xmldom: Creation-time XML Name/QName validation is bypassable via an embedded line terminator, allowing injection on the default serialization path
xmldom is a pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module. From 0.9.0 until 0.9.12, the shared reg() builder in lib/grammar.js compiles the anchored QNameexact validator with the multiline flag, so ^ and $ validate only one line instead of the complete name. createElementNS, createAttributeNS, createDocumentType, and createAttribute consequently accept a malformed XML name whose first line is valid and whose later text injects markup when serialized through either the default path or requireWellFormed: true. The triggering ECMAScript line terminators are U+000A, U+000D, U+2028, and U+2029. This issue is fixed in @xmldom/xmldom version 0.9.12.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
@xmldom/xmldomto a version that resolves this vulnerability.Fixed in 0.9.12 - Compensating control
If you cannot upgrade immediately, block or remove/escape the ECMAScript line terminators U+000A, U+000D, U+2028, and U+2029 from XML names/QNames before passing them to xmldom createElementNS/createAttributeNS/createDocumentType/createAttribute (to prevent bypass of Creation-time XML Name/QName validation and markup injection during serialization, including when requireWellFormed: true).
Event History
Frequently Asked Questions
Which applications are realistically exposed to this issue?
Applications using @xmldom/xmldom versions 0.9.0 through 0.9.12 are exposed if they construct XML names through createElementNS, createAttributeNS, createDocumentType, or createAttribute using attacker-influenced input and then serialize the resulting DOM.
What does an attacker need to supply to exploit the validation bypass?
The attacker needs control over a name or QName passed to one of the affected creation APIs. The supplied value must begin with a valid XML name on its first line and include later markup-injecting text after an ECMAScript line terminator: U+000A, U+000D, U+2028, or U+2029.
Does enabling requireWellFormed prevent the injection?
No. The malformed name is accepted during DOM creation and injects markup when serialized through both the default serialization path and the requireWellFormed: true path.
What version fixes the issue?
The issue is fixed in @xmldom/xmldom version 0.9.12.