Skip to content

Commit 6dc11a5

Browse files
iluuu1994ericmann
authored andcommitted
GHSA-hmxp-6pc4-f3vv: [soap] Fix broken Apache map value NULL check
Fixes GHSA-hmxp-6pc4-f3vv Fixes CVE-2026-7262
1 parent 2b80fd9 commit 6dc11a5

2 files changed

Lines changed: 40 additions & 1 deletion

File tree

ext/soap/php_encoding.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2783,7 +2783,7 @@ static zval *to_zval_map(zval *ret, encodeTypePtr type, xmlNodePtr data)
27832783
}
27842784

27852785
xmlValue = get_node(item->children, "value");
2786-
if (!xmlKey) {
2786+
if (!xmlValue) {
27872787
soap_error0(E_ERROR, "Encoding: Can't decode apache map, missing value");
27882788
}
27892789

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
GHSA-hmxp-6pc4-f3vv: Null pointer dereference on missing Apache map value
3+
--CREDITS--
4+
Ilia Alshanetsky (iliaal)
5+
--EXTENSIONS--
6+
soap
7+
--FILE--
8+
<?php
9+
10+
$request = <<<XML
11+
<?xml version="1.0" encoding="UTF-8"?>
12+
<soap:Envelope
13+
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
14+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
16+
xmlns:apache="http://xml.apache.org/xml-soap">
17+
18+
<soap:Body>
19+
<test>
20+
<map xsi:type="apache:Map">
21+
<item><key>hello</key></item>
22+
</map>
23+
</test>
24+
</soap:Body>
25+
</soap:Envelope>
26+
XML;
27+
28+
$server = new SoapServer(null, [
29+
'uri' => 'urn:test',
30+
'typemap' => [['type_name' => 'anything']],
31+
]);
32+
$server->addFunction('test');
33+
function test($m) { return null; }
34+
$server->handle($request);
35+
36+
?>
37+
--EXPECT--
38+
<?xml version="1.0" encoding="UTF-8"?>
39+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>SOAP-ERROR: Encoding: Can't decode apache map, missing value</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>

0 commit comments

Comments
 (0)