VulnWatch by ve1ve2
medium 6.3 EPSS 0.65%

GHSA-x8r7-mg3g-74hg / CVE-2026-129501: Double free during DOM XML serialization

Source:
PHP releases (GitHub php/php-src tags)
Published:
Fetched:
Updated:
Affects:
php ext-dom

https://github.com/php/php-src/security/advisories/GHSA-x8r7-mg3g-74hg ↗

repo-advisoryphpCWE-415CWE-416securityrepo:php/php-src

Double free during DOM XML serialization ### Summary PHP's modern DOM XML serializer can incorrectly share ownership of a generated namespace prefix between an element and its descendant. An application that calls `saveXml()` on attacker-controlled XML or HTML can consequently use and free the same allocation more than once, which can crash the PHP process. ### Details `Dom\XMLDocument` and `Dom\HTMLDocument` maintain a namespace-prefix map while serializing a document as XML. The serializer can generate a prefix for an attribute whose namespace has no usable prefix. Descendants initially share the ancestor's map and use copy-on-write when adding another candidate prefix for an existing namespace URI. The vulnerable copy-on-write path duplicates the candidate list but leaves the copied pointers marked as owned. Destroying the descendant's map therefore frees a generated prefix that remains referenced by the ancestor. A later sibling can access that freed value, and destroying the ancestor's map frees the same allocation again. The fix marks generated-prefix pointers copied into descendant lists as borrowed. Valid input can establish this state by combining namespaced attributes, nested namespace declarations and a later sibling. The input does not need to be malformed. The HTML path requires only a crafted document followed by `Dom\HTMLDocument::saveXml()`. For `Dom\XMLDocument`, the same state can arise when ordinary application code adds a namespaced attribute and the supplied document declares another prefix for that namespace. ### Impact A remote attack requires an application to parse attacker-controlled XML or HTML using the modern DOM API and then serialize it with `saveXml()`. Applications that do not XML-serialize untrusted documents are not affected by that attack path. The demonstrated impact is memory corruption and denial of service through a PHP process crash. Corrupting ZendMM's free list may allow later allocations in the same request to alias, but turning that into type confusion or code execution requires application-specific allocation control and has not been demonstrated through realistic application code. No confidentiality or integrity impact has been established. Repeated requests can terminate PHP workers and reduce or exhaust an application's worker pool. ### Affected versions The affected code was introduced in PHP 8.4.0 together with the `Dom\XMLDocument` and `Dom\HTMLDocument` classes and their XML serializer. The legacy `DOMDocument` class does not use this serializer. PHP 8.3 and earlier are not affected. ### Mitigation Upgrade to the fixed release for your PHP branch when it becomes available. Until then, avoid calling `saveXml()` on attacker-controlled `Dom\XMLDocument` or `Dom\HTMLDocument` instances. For HTML documents where XML output is not required, `saveHtml()` avoids the affected XML serializer. Process isolation and worker restart limits can contain individual crashes but do not remove the vulnerable behavio Affected packages: php:ext-dom Patched: ext-dom 8.4.28, ext-dom 8.5.13

Linked vulnerabilities (2)

CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N

Double free during DOM XML serialization

CWE: CWE-415, CWE-416Aliases: CVE-2026-129501
CVE-2026-129501 medium 6.3 EPSS 0.65% (p52) NVDCVE.orgGHSA
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Double free during DOM XML serialization

CWE: CWE-415, CWE-416, CWE-1341Aliases: GHSA-x8r7-mg3g-74hg, CVE-2026-115560, CVE-2026-126714, CVE-2026-127960, CVE-2026-128064, CVE-2026-128090, CVE-2026-129289, CVE-2026-129291, CVE-2026-129292, CVE-2026-129481, CVE-2026-129496, CVE-2026-129506, CVE-2026-129538, CVE-2026-15353NVD: Awaiting Analysis