The vulnerability is a two-stage XML injection. It begins with the Document.createProcessingInstruction function, which fails to validate its data input. This allows a string containing the processing instruction closing delimiter ?> to be stored in a ProcessingInstruction node. The second stage occurs in XMLSerializer.serializeToString. When serializing the document, this function does not escape the ?> sequence within the ProcessingInstruction's data. Instead, it writes the data verbatim to the output. This causes the XML parser to interpret the ?> as the end of the processing instruction, and any subsequent content in the data string is injected into the main XML structure as active markup. The fix is opt-in, meaning that calls to serializeToString without the { requireWellFormed: true } option remain vulnerable.