Low
<?php
// The page we wish to display
$file = $_GET[ 'page' ];
?>
没有做任何的现在,可以直接进行文件包含
本地包含:
远程服务器包含 :
Medium
<?php
// The page we wish to display
$file = $_GET[ 'page' ];
// Input validation
$file = str_replace( array( "http://", "https://" ), "", $file );
$file = str_replace( array( "../", "..\\" ), "", $file );
?>
str_replac:替换字符串中的一些字符
通过查看源码,我们可以知道过滤了http://,https://,../ ,..\\。可以使用双写绕过
本地包含
远 程包含
High
<?php
// The page we wish to display
$file = $_GET[ 'page' ];
// Input validation
if( !fnmatch( "file*", $file ) && $file != "include.php" ) {
// This isn't the page we want!
echo "ERROR: File not found!";
exit;
}
?>
规定必须为file开头且不是include.php的文件
使用file://协议绕过 (file:// 只能用于读取本地文件)