xmldom: XML fragment injection via invalid EntityReference.nodeName during requireWellFormed serialization
An EntityReference node can be created with an invalid, attacker-controlled name through Document.createEntityReference(name). When this node is serialized directly with: serializer.serializeToString(ref, { requireWellFormed: true }) the invalid nodeName is emitted into the serialized XML fragment without validation or escaping. This can produce real XML markup in the serialized output. In the proof of concept below, the serialized fragment contains <injected/>, and reparsing the fragment creates a real injected element.