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

相关推荐
ANYOUZHEN6 小时前
bugku shell
android
南宫码农9 小时前
我的电视 - Android原生电视直播软件 完整使用教程
android·开发语言·windows·电视盒子
道亦无名9 小时前
音频数据特征值提取 方法和步骤
android·音视频
Lancker9 小时前
定制侠 一个国产纯血鸿蒙APP的诞生过程
android·华为·智能手机·鸿蒙·国产操作系统·纯血鸿蒙·华为鸿蒙
2601_9498095911 小时前
flutter_for_openharmony家庭相册app实战+通知设置实现
android·javascript·flutter
液态不合群11 小时前
【面试题】MySQL 中 count(*)、count(1) 和 count(字段名) 有什么区别?
android·数据库·mysql
雪球Snowball13 小时前
【Android关键流程】资源加载
android
2501_9159184113 小时前
常见 iOS 抓包工具的使用,从代理抓包、设备抓包到数据流抓包
android·ios·小程序·https·uni-app·iphone·webview
墨月白14 小时前
[QT]QProcess的相关使用
android·开发语言·qt
enbug15 小时前
编译安卓内核:以坚果R1、魔趣MK100(Android 10)系统为例
android·linux