Summary
PHP's modern DOM XML serializer can reuse and double-free a generated namespace prefix, crashing the PHP process. Remote exploitation requires an application to call saveXml() on attacker-controlled Dom\XMLDocument or Dom\HTMLDocument content. Repeated requests can exhaust the worker pool. Code execution has not been demonstrated in realistic application code. Affects PHP 8.4.0 through 8.4.27 and 8.5.0 through 8.5.12; fixed in 8.4.28 and 8.5.13. PHP 8.3 and earlier and the legacy DOMDocument serializer are unaffected. Until upgraded, avoid XML serialization of untrusted documents; saveHtml() avoids this path when HTML output is sufficient.
Disclosure timeline
- Public disclosure
Credits
Reported by EliseZeroTwo, VincentCassiau, and christos-cantina-security; remediation by ndossche, review by devnexen, and analysis by bukka, as credited in PHP's advisory.