Skip to content

Commit e0ca519

Browse files
committed
Merge branch 'PHP-5.6' into PHP-7.0
2 parents cc9893e + 6477bb7 commit e0ca519

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
--TEST--
2+
Bug #69425: Use After Free in unserialize()
3+
--FILE--
4+
<?php
5+
6+
// POC 1
7+
class test
8+
{
9+
var $ryat;
10+
11+
function __wakeup()
12+
{
13+
$this->ryat = 1;
14+
}
15+
}
16+
17+
$data = unserialize('a:2:{i:0;O:4:"test":1:{s:4:"ryat";R:1;}i:1;i:2;}');
18+
var_dump($data);
19+
20+
// POC 2
21+
$data = unserialize('a:2:{i:0;O:12:"DateInterval":1:{s:1:"y";R:1;}i:1;i:2;}');
22+
var_dump($data);
23+
24+
?>
25+
--EXPECT--
26+
int(1)
27+
array(2) {
28+
[0]=>
29+
object(DateInterval)#1 (15) {
30+
["y"]=>
31+
int(-1)
32+
["m"]=>
33+
int(-1)
34+
["d"]=>
35+
int(-1)
36+
["h"]=>
37+
int(-1)
38+
["i"]=>
39+
int(-1)
40+
["s"]=>
41+
int(-1)
42+
["weekday"]=>
43+
int(-1)
44+
["weekday_behavior"]=>
45+
int(-1)
46+
["first_last_day_of"]=>
47+
int(-1)
48+
["invert"]=>
49+
int(0)
50+
["days"]=>
51+
int(-1)
52+
["special_type"]=>
53+
int(0)
54+
["special_amount"]=>
55+
int(-1)
56+
["have_weekday_relative"]=>
57+
int(0)
58+
["have_special_relative"]=>
59+
int(0)
60+
}
61+
[1]=>
62+
int(2)
63+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
Bug #70513: GMP Deserialization Type Confusion Vulnerability
3+
--SKIPIF--
4+
<?php if (!extension_loaded('gmp')) die('skip requires gmp');
5+
--FILE--
6+
<?php
7+
8+
class obj
9+
{
10+
var $ryat;
11+
12+
function __wakeup()
13+
{
14+
$this->ryat = 1;
15+
}
16+
}
17+
18+
$obj = new stdClass;
19+
$obj->aa = 1;
20+
$obj->bb = 2;
21+
22+
$inner = 's:1:"1";a:3:{s:2:"aa";s:2:"hi";s:2:"bb";s:2:"hi";i:0;O:3:"obj":1:{s:4:"ryat";R:2;}}';
23+
$exploit = 'a:1:{i:0;C:3:"GMP":'.strlen($inner).':{'.$inner.'}}';
24+
$x = unserialize($exploit);
25+
var_dump($x);
26+
var_dump($obj);
27+
28+
?>
29+
--EXPECT--
30+
array(1) {
31+
[0]=>
32+
int(1)
33+
}
34+
object(stdClass)#1 (2) {
35+
["aa"]=>
36+
int(1)
37+
["bb"]=>
38+
int(2)
39+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #72731: Type Confusion in Object Deserialization
3+
--FILE--
4+
<?php
5+
6+
class obj {
7+
var $ryat;
8+
function __wakeup() {
9+
$this->ryat = 0x1122334455;
10+
}
11+
}
12+
13+
$poc = 'O:8:"stdClass":1:{i:0;O:3:"obj":1:{s:4:"ryat";R:1;}}';
14+
var_dump(unserialize($poc));
15+
16+
?>
17+
--EXPECT--
18+
int(73588229205)

0 commit comments

Comments
 (0)