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

相关推荐
aqi005 分钟前
FFmpeg开发笔记(九十五)国产的开源视频美颜工具VideoEditorForAndroid
android·ffmpeg·音视频·直播·流媒体
sanggou41 分钟前
基于Java实现的简易规则引擎(日常开发难点记录)
android·java
farewell-Calm1 小时前
Android Studio 添加第三方库
android·ide·android studio
fatiaozhang95272 小时前
移动高清微型盒子1A_TBX2-2_海思MV320_安卓9_2+16G_有蓝牙没无线_优盘强刷固件包
android·电视盒子·刷机固件·机顶盒刷机·tbx2-2_海思mv320
李坤林2 小时前
Android DMA-BUF HEAP
android
TAEHENGV2 小时前
关于应用模块 Cordova 与 OpenHarmony 混合开发实战
android·javascript·数据库
程序员码歌2 小时前
短思考第265天,小红书起号3周怎么样?实操总结这3点!
android·ai编程
小徐Chao努力3 小时前
【Langchain4j-Java AI开发】05-对话记忆管理
android·java·人工智能
大白要努力!3 小时前
Android 项目历史提交远程仓库资源过大,如何清理历史提交中无用的大文件
android·git