File tree Expand file tree Collapse file tree 3 files changed +72
-1
lines changed Expand file tree Collapse file tree 3 files changed +72
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ PHP NEWS
12
12
Out of Bounds). (emmanuel dot law at gmail dot com).
13
13
14
14
- WDDX:
15
+ . Fixed bug #70661 (Use After Free Vulnerability in WDDX Packet Deserialization).
16
+ (taoguangchen at icloud dot com)
15
17
. Fixed bug #70741 (Session WDDX Packet Deserialization Type Confusion
16
18
Vulnerability). (taoguangchen at icloud dot com)
17
19
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #70661 (Use After Free Vulnerability in WDDX Packet Deserialization)
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ("wddx " )) print "skip " ;
6
+ ?>
7
+ --FILE--
8
+ <?php
9
+ $ fakezval = ptr2str (1122334455 );
10
+ $ fakezval .= ptr2str (0 );
11
+ $ fakezval .= "\x00\x00\x00\x00" ;
12
+ $ fakezval .= "\x01" ;
13
+ $ fakezval .= "\x00" ;
14
+ $ fakezval .= "\x00\x00" ;
15
+
16
+ $ x = <<<EOT
17
+ <?xml version='1.0'?>
18
+ <wddxPacket version='1.0'>
19
+ <header/>
20
+ <data>
21
+ <struct>
22
+ <recordset rowCount='1' fieldNames='ryat'>
23
+ <field name='ryat'>
24
+ <var name='php_class_name'>
25
+ <string>stdClass</string>
26
+ </var>
27
+ <null/>
28
+ </field>
29
+ </recordset>
30
+ </struct>
31
+ </data>
32
+ </wddxPacket>
33
+ EOT ;
34
+
35
+ $ y = wddx_deserialize ($ x );
36
+
37
+ for ($ i = 0 ; $ i < 5 ; $ i ++) {
38
+ $ v [$ i ] = $ fakezval .$ i ;
39
+ }
40
+
41
+ var_dump ($ y );
42
+
43
+ function ptr2str ($ ptr )
44
+ {
45
+ $ out = '' ;
46
+
47
+ for ($ i = 0 ; $ i < 8 ; $ i ++) {
48
+ $ out .= chr ($ ptr & 0xff );
49
+ $ ptr >>= 8 ;
50
+ }
51
+
52
+ return $ out ;
53
+ }
54
+ ?>
55
+ DONE
56
+ --EXPECTF--
57
+ array(1) {
58
+ [0]=>
59
+ array(1) {
60
+ ["ryat"]=>
61
+ array(2) {
62
+ ["php_class_name"]=>
63
+ string(8) "stdClass"
64
+ [0]=>
65
+ NULL
66
+ }
67
+ }
68
+ }
69
+ DONE
Original file line number Diff line number Diff line change @@ -978,7 +978,7 @@ static void php_wddx_pop_element(void *user_data, const XML_Char *name)
978
978
979
979
if (ent1 -> varname ) {
980
980
if (!strcmp (ent1 -> varname , PHP_CLASS_NAME_VAR ) &&
981
- Z_TYPE_P (ent1 -> data ) == IS_STRING && Z_STRLEN_P (ent1 -> data )) {
981
+ Z_TYPE_P (ent1 -> data ) == IS_STRING && Z_STRLEN_P (ent1 -> data ) && ent2 -> type == ST_STRUCT ) {
982
982
zend_bool incomplete_class = 0 ;
983
983
984
984
zend_str_tolower (Z_STRVAL_P (ent1 -> data ), Z_STRLEN_P (ent1 -> data ));
You can’t perform that action at this time.
0 commit comments