[极客大挑战 2019]PHP
[极客大挑战 2019]PHP
考点
备份文件
反序列化
__wakeup()绕过
wp
提示的找备份文件,发现www.zip源码泄露
index.php有个反序列化
<?php
include 'class.php';
$select = $_GET['select'];
$res=unserialize(@$select);
?>class.php给了Name类
<?php
include 'flag.php';
error_reporting(0);
class Name{
private $username = 'nonono';
private $password = 'yesyes';
public function __construct($username,$password){
$this->username = $username;
$this->password = $password;
}
function __wakeup(){
$this->username = 'guest';
}
function __destruct(){
if ($this->password != 100) {
echo "</br>NO!!!hacker!!!</br>";
echo "You name is: ";
echo $this->username;echo "</br>";
echo "You password is: ";
echo $this->password;echo "</br>";
die();
}
if ($this->username === 'admin') {
global $flag;
echo $flag;
}else{
echo "</br>hello my friend~~</br>sorry i can't give you the flag!";
die();
}
}
}
?>根据代码,username是admin,password是100。但是__wakeup()会把username重新赋值为guest,修改属性数量绕过。
把Name后表示属性数量的2改成3即可
最后更新于