The vulnerability, GHSA-gh4j-gqv2-49f6, exists in the XMLBuilder component of the fast-xml-parser library. The root cause is the improper handling of user-supplied data when creating XML comments and CDATA sections. The XMLBuilder.buildTextValNode function directly embeds content into <!--...--> and <![CDATA[...]]> blocks without escaping the respective closing delimiters (--> and ]]>).
An attacker can exploit this by crafting input where a comment or CDATA value contains a closing delimiter followed by malicious XML. For example, a comment value of --> <injected/> <!-- would close the original comment and inject a new <injected/> element into the XML structure.
The vulnerability is triggered through the public XMLBuilder.build method, which processes the input object and calls buildTextValNode internally. Both functions would appear in a runtime profile during an exploit. The fix was implemented in the fast-xml-builder dependency (patched in v1.1.5) and then integrated into fast-xml-parser in version 5.7.0.