CVE-2026-129506
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
PHP is a general-purpose scripting language used mostly for web development. It runs behind web servers through server APIs such as Apache mod_php and PHP-FPM, and powers content management systems and frameworks such as WordPress, Drupal, Moodle and Laravel. The SOAP extension implements SOAP clients and servers. It parses SOAP messages, WSDL files and imported schemas with libxml2 and cleans up each parsed document before using it.
A Use After Free vulnerability (CVE-2026-129506) has been identified in how the SOAP extension cleans up a parsed XML document that contains a document type definition (DTD), which allows an unauthenticated attacker who can send a crafted request to an exposed SOAP endpoint to make PHP read freed memory and crash the process handling the request. Applications that load attacker-controlled WSDL or imported schema documents can also be affected. The PHP project tracks this issue as GHSA-4646-p932-gw34.
Per MITRE CWE-416: The product reuses or references memory after it has been freed.
This issue affects all versions of PHP before 8.2.36, PHP 8.3 before 8.3.37, PHP 8.4 before 8.4.28 and PHP 8.5 before 8.5.13, which includes the End-of-Life release lines PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 through their final releases.
Details
Module Info
- Product: PHP
- Affected packages: php-src (ext/soap)
- Affected versions: <8.2.36, >=8.3.0 <8.3.37, >=8.4.0 <8.4.28, >=8.5.0 <8.5.13
- GitHub repository: https://github.com/php/php-src
- Published packages: https://www.php.net/downloads
- Package manager: N/A
- Fixed in:
- OSS PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13
- NES for PHP
Vulnerability Info
This Medium-severity vulnerability is found in the soap extension of all versions of PHP before 8.2.36, PHP 8.3 before 8.3.37, PHP 8.4 before 8.4.28 and PHP 8.5 before 8.5.13, which includes the End-of-Life release lines PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 through their final releases. The PHP project scores it 6.3 under CVSS 4.0 (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).
After parsing, cleanup_xml_node() walks the document and removes blank text nodes and every other node that is not an element or a CDATA section. In PHP 8.5.12, the code reads:
if (trav->type == XML_TEXT_NODE) {
if (is_blank(trav->content)) {
xmlUnlinkNode(trav);
xmlFreeNode(trav);
}
} else if ((trav->type != XML_ELEMENT_NODE) &&
(trav->type != XML_CDATA_SECTION_NODE)) {
xmlUnlinkNode(trav);
xmlFreeNode(trav);
} else if (trav->children != NULL) {
This frees the DTD node. An attribute value that contains an entity reference can still refer to content the DTD owns, so later processing of those attributes reads freed memory. Removing the DTD also bypasses the SOAP server's normal rejection of documents that contain a DTD.
Exploitation requires the SOAP extension and an application that processes attacker-controlled SOAP XML, WSDL or schema content. Authentication does not protect an endpoint if the application parses the SOAP request before authenticating it. A crafted document can crash the PHP worker or process, and repeated requests can disrupt service. The original report also described corrupted type information after freed memory was reused. Disclosure of sensitive process memory and code execution have not been confirmed.
The advisory states that the issue predates the changes made for CVE-2026-91765 and affects earlier releases in all supported branches. The same cleanup logic is present in the final releases of the End-of-Life PHP 5.6 through 8.1 lines.
The fix keeps the DTD alive for as long as the document needs it, which also restores the existing SOAP DTD check:
if (trav->type == XML_TEXT_NODE) {
if (is_blank(trav->content)) {
xmlUnlinkNode(trav);
xmlFreeNode(trav);
}
} else if (trav->type == XML_DTD_NODE) {
/* Attribute-value entity references can share content with the DTD.
* Keep it alive until the document itself is freed. */
} else if ((trav->type != XML_ELEMENT_NODE) &&
(trav->type != XML_CDATA_SECTION_NODE)) {
xmlUnlinkNode(trav);
xmlFreeNode(trav);
} else if (trav->children != NULL) {
Mitigation
The PHP project publishes security fixes only for its supported release lines. PHP 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0 and 8.1 are End-of-Life and will not receive any public updates to address this issue.
Until an upgrade is possible, restrict access to affected SOAP endpoints or disable them where practical, and load WSDL files and imported schemas only from trusted sources. If untrusted SOAP requests must be accepted, reject documents that contain a DTD before they reach the SOAP extension. Such a filter has to handle the XML encodings and request body transformations the application accepts; a simple text search is not a complete mitigation.
Users of the affected components should apply one of the following mitigations:
- Upgrade to PHP 8.2.36, 8.3.37, 8.4.28, 8.5.13, or later.
- Leverage a commercial support partner like HeroDevs (NES for PHP) for post-EOL security support.
Credits
- NetKingJ (finder)
- Jakub Zelenka (remediation)