当前位置:网站首页>[GXYCTF2019] ban dolls
[GXYCTF2019] ban dolls
2022-07-29 20:45:00 【Wei Xiaosheng lost his mind】
Test site:
git leak
No parameters rce
Start:
Use dirsearch to scan the flag and it should be read
Then use github to find the source code leak
";if(isset($_GET['exp'])){if (!preg_match('/data:\/\/|filter:\/\/|php:\/\/|phar:\/\//i', $_GET['exp'])) {if(';' === preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'])) {if (!preg_match('/et|na|info|dec|bin|hex|oct|pi|log/i', $_GET['exp'])) {// echo $_GET['exp'];@eval($_GET['exp']);}else{die("Almost!");}}else{die("Think about it!");}}else{die("I still want to read flag, stinky brother!");}}// highlight_file(__FILE__);?>Using exp to pass parameters also has many filtering restrictions, can not read with pseudo-protocol, but also use regular matching
There is no parameter rce
First bypass the pseudo-protocol and then execute if ';' ===preg_replace
The (?R)? in the if represents the current expression, which is /[a-z,_]+((?R)?/), so it is a kind of recursion, ?Represents recursive current expression 1 or 0 times (if (?R)* represents recursive current expression 0 or more times, it can match a(b(c()d())))
There are three general bypassing postures for no-parameter RCE:
gettallheaders()
get_defined_vars()
·session_id()
Then some keywords are bypassed, and those with get functions cannot be used
There is also a scandir to scan files in the current directory
1.exp:
exp=highlight_file(next(array_reverse(scandir(pos(localeconv())))));The highlight_file() function performs syntax highlighting on files, this function is an alias of show_source()
Next() outputs the value of the current element and the next element in the array
The array_reverse() function returns the array in the reverse element order. (mainly can return values)
The scandir() function returns an array of files and directories in the specified directory
pos() outputs the value of the current element in the array
The localeconv() function returns an array containing local number and currency format information. The first element of the array is ".".
is that the loacleconv function returns a . and then pos will get the . Return to the payload we constructed and let scandir return the array in the current directory, which is the file in the current directory array_reverse() outputs in reverse order (the purpose is to output the queried content in positive order)Then next extract the second element (filter .) and finally display the flag with hightlight_file()
2.exp:
?exp=highlight_file(session_id(session_start()));The above regular filter does not filter out session_id()
We can use session_id to get flag
You also need to use session_start() to start a session when you are using it because php does not actively use session by default
session_id() can get the current session id.

It's ready to go

边栏推荐
- "Additional price" can not exchange for safety, the death of Lexus LM, whose fault is it?
- 【体系结构 四 存储结构】
- 本科毕业六年,疫情期间备战一个月,四面阿里巴巴定级P7
- The ambition of glory: "high-end civilians" in a smart world
- 单核浏览器和双核浏览器有什么区别,哪个好用?
- Build your own image search system (1): 10 lines of code to search images by image
- easyExce模板填充生成Excel的实际操作,多sheet页处理
- PostgreSQL语句大全
- GNOME将在Secure Boot被禁用时向用户发出警告 并准备提供安全帮助
- Chrome - Plugin Recommendations
猜你喜欢

8.2实训任务 Sqoop的安装与配置

sad rock

Flink1.15源码阅读flink-clients之GenericCLI、flinkYarnSessionCLI和DefaultCLI

如何使用TDengine Sink Connector?
![[数学基础]概率论与数理统计相关概念学习](/img/bc/d3a246240ff7aca2b84c3766383758.png)
[数学基础]概率论与数理统计相关概念学习
![Chapter 01 Installation and use of MySQL under Linux [1. MySQL Architecture] [MySQL Advanced]](/img/f6/8c513ab62c8d3259c9c8ef13887276.png)
Chapter 01 Installation and use of MySQL under Linux [1. MySQL Architecture] [MySQL Advanced]

“加价”都换不来安全保障,雷克萨斯LM之殇,到底是谁的错?

【Autosar vLinkGen 链接器脚本生成器】

【AutoSAR 六 描述文件】

regular expression
随机推荐
【目标检测】Generalized Focal Loss V2
2022中国物流产业大会暨企业家高峰论坛在杭州举办!
【体系结构 一 概述】
欧盟计划斥资百亿欧元补贴,吸引台积电、英特尔、三星等赴欧盟建厂
Answer these 3 interview questions correctly, and the salary will go up by 20K
[数学]线性代数复习总结
Chrome - Plugin Recommendations
Neo4j Open Source NoSQL Database
mnist有多少张图片(怎么读取图片文字)
updatexml, extractvalue and floor error injection principle
PromptBERT: Improving BERT Sentence Embeddings with Prompts
Is Apifox free?Completely free, unlimited team size, unlimited functions
C language advanced enumeration and joint
PyQt5快速开发与实战 7.2 信号与槽再细分 && 7.3 信号与槽的高级玩法
Verilog的时间格式系统任务----$printtimescale、$timeformat
[数学基础]高等数学相关概念学习
经验分享|编写简单易用的在线产品手册小妙招
cv2 imread()函数[通俗易懂]
【AutoSAR 十二 模式管理】
全渠道电商 | 国内知名的药妆要如何抓住风口实现快速增长?