xmldom: DocType `name` Injection Bypasses requireWellFormed
xmldom · @xmldom xmldom
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| @xmldom/xmldom npm |
|
|
| xmldom npm |
| No fix yet |
xmldom · @xmldom xmldom
| Product | Affected | Fixed in |
|---|---|---|
| @xmldom/xmldom npm |
|
|
| xmldom npm |
| No fix yet |
xmldom is a pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module. Prior to @xmldom/xmldom versions 0.8.15 and 0.9.12, and in xmldom version 0.6.0 and earlier, the DOCUMENT_TYPE_NODE branch in lib/dom.js validates publicId, systemId, and internalSubset under requireWellFormed: true but emits DocumentType.name verbatim. A name containing > or whitespace can terminate the <!DOCTYPE ...> declaration and inject sibling markup; the value can be supplied through createDocumentType() on the 0.8.x and unscoped lines or through a direct DocumentType.name property write on every affected line. The default path and legacy creation-time behavior remain permissive, while the vulnerable strict path fails to enforce an XML Name. This issue is fixed in @xmldom/xmldom versions 0.8.15 and 0.9.12; no fixed version is available for xmldom.
From the CVE record · GitHub_M
When XML is serialized with requireWellFormed: true, affected xmldom packages emit DocumentType.name without validating it as an XML name. An attacker who can influence that name can use whitespace or > to end the DOCTYPE declaration and inject sibling markup. The input does not specify network access, authentication requirements, or user interaction.
Check applications using @xmldom/xmldom versions >=0.7.0 <0.8.15 or >=0.9.0 <0.9.12, or the unscoped xmldom package version 0.6.0 or earlier.