Intel

AIKIDO-2026-784472

@xmldom/xmldom is vulnerable to XML Injection

XML InjectionGHSA-4w3w-2rp5-g8jm Published Aug 14, 2026

87

High Risk

This Affects:

JS@xmldom/xmldom
0.7.0 - 0.8.13
Fixed in 0.8.14
0.9.0 - 0.9.10
Fixed in 0.9.11
Are you affected? Scan for Free

TL;DR

Element.setAttribute() creates attribute nodes through a private helper that performs no validation, unlike the public createAttribute() which rejects invalid names. The serializer escapes attribute values but writes attribute names verbatim, so a name containing quote and space characters can terminate one attribute and inject additional attributes into the output. The requireWellFormed serialization option did not check attribute names, leaving applications that used it as a mitigation exposed to injected event handlers and overridden security attributes. The fix makes the requireWellFormed serializer validate each serialized attribute's qualified name and throw before emitting it.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and you call setAttribute() with user-controlled attribute names and serialize the result, including when you rely on the requireWellFormed: true option to reject invalid names.

Background info

@xmldom/xmldom is vulnerable to XML Injection in versions 0.9.0 - 0.9.10 and 0.7.0 - 0.8.13.

How to fix this

Upgrade the @xmldom/xmldom library to the patch version and pass { requireWellFormed: true } to serializeToString().