当前位置:网站首页>Xctf attack and defense world web master advanced area unserialize3
Xctf attack and defense world web master advanced area unserialize3
2022-07-28 03:34:00 【l8947943】
0x01. Enter the environment
Display a piece of source code :
class xctf{
public $flag = '111';
public function __wakeup(){
exit('bad requests');
}
?code=
0x02. Problem analysis
0x02_1. Code audit
First , Define a “xctf” class , This class has two member properties , Namely flag and __wakeup. Next is __wakeup Method implementation , Then there is the last line of variables code Not finished , It is estimated that we want to pass in and complete it .
there __wakeup Function is a so-called “ Magic methods ”, It will be called before other functions when deserializing , Execute its statement .
That means , If we construct a string directly , So this __wakeup_ I'll do it first , And directly exit, This is not what we want .
in other words , We constructed it code After the parameter of is passed in , Be first __wakeup Method first calls . So we can find a way to bypass this function .
0x02_2. Try
Read relevant gods WP After just know , A loophole (CVE-2016-7124) Can pass Make the value representing the number of object attributes in the serialized string greater than the actual number of attributes , To skip __wakeup Implementation .
First , Standard format for serializing strings :O:< The length of the class name >:"< Class name >":< Number of member attributes >:{S:< Length of member attribute name >:"< Member property name >";......} The words of this question , If you want to xctf Class is serialized correctly , Then its string should be :O:4:"xctf":1:{S:4:"flag";S:3:"111";}
Online test address :https://www.dooccn.com/php/, Use the following code to verify .
<?php
class xctf{
public $flag = '111';
public function __wakeup(){
exit('bad requests');
}
}
$a = new xctf();
print(serialize($a));
?>
0x02_3. skip __wakeup() function
Modify the serialized string , Modify the number of attributes in the serialized string , And complete string splicing , With get Method outgoing , The address is spliced as follows :
http://61.147.171.105:56068/?code=O:4:“xctf”:2:{s:4:“flag”;s:3:“111”;}
Get the final answer , The answer for :cyberpeace{d0e766c698b67400e771051e6b8301aa}
Reference resources :
边栏推荐
- 20220727 use the Bluetooth module hc-05 of Huicheng technology to pair mobile phones for Bluetooth serial port demonstration
- Response to questions about the balanced beacon group of Hubei University of Arts and Sciences
- CF 7月25日-7月31日做题记录
- 玩一玩WolframAlpha计算知识引擎
- Malloc, free, calloc, realloc dynamic memory development functions in dynamic memory management
- 叶子识别 颜色的特征提取 缺陷检测等
- Billions of asset addresses are blacklisted? How to use the tether address freezing function?
- 过亿资产地址被拉入黑名单?Tether地址冻结功能该怎么用?
- 同时导出多个excel,并且一个excel中包含多个sheet
- Airiot Q & A issue 6 | how to use the secondary development engine?
猜你喜欢

每日练习------实现双色球的彩票功能。规则:从36个红球中随机选择不重复的6个数,从15个篮球中随机选择1个组成一注彩票。可以选择买多注。

How to make the Internet access the intranet IP (used by esp8266 web pages)

Summary of redis classic interview questions

动态内存管理中的malloc、free、calloc、realloc动态内存开辟函数

一键重装win7系统详细教程

Billions of asset addresses are blacklisted? How to use the tether address freezing function?

20220726 at command test of Bluetooth module hc-05 of Huicheng Technology

MySQL事务的ACID特性及并发问题实例分析

图文并茂:JVM 内存布局详解

C -- switch case statement
随机推荐
Mouse operation and response
图文并茂:JVM 内存布局详解
The wonderful use of asemi rectifier bridge GBPC3510 in DC brush motor
Golang gets the tag of the loop nested structure
如何让外网访问内网IP(esp8266网页使用)
C语言实现动态版本的通讯录
Version compatibility issues
Shell:资源监控脚本和高负载报警
如何卸载干净zabbix服务?(超详细)
20条心灵鸡汤唯美句子,句句温情暖心!
bp svm的缺陷检测 树叶缺陷 叶片缺陷检测的系统设计
Acid characteristics of MySQL transactions and example analysis of concurrency problems
一键重装win7系统详细教程
动画(animation)
20220727 use the Bluetooth module hc-05 of Huicheng technology to pair mobile phones for Bluetooth serial port demonstration
Asemi rectifier bridge gbpc5010, gbpc5010 parameters, gbpc5010 size
2022 summary of the latest Android handler related interview questions
Container related concepts
Tensorboard usage record
Leetcode 208. implement trie (prefix tree) (2022.07.27)