dvwa v1.10 文件包含high级别的一个思路

我们先来看一下dvwa文件包含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;
}
 
?> 
因此page参数必须要以file开头,其中的一路绕过的思路是利用file协议,例如要读取D盘的testfile.txt文件,则url应该写为http://127.0.0.1/dvwa/vulnerabilities/fi/?page=file:///D:/testfile.txt,详情大家可以去参考一下一下这篇文章点击打开链接。
但是这毕竟只是一种特殊情况,如果不是文件名开头恰好为file,这根本无法利用。

经测试发现在php有个有意思的特性,代码如下:

<?php 
include("werew/../cookie.txt");
?>
这里当前目录存在一个cookie.txt的文件,但是目录werew是不存在的,但是按照这种方式仍然能访问到当前目录的cookie.txt文件,因此按照这种思路我们可以构造url如下:
http://127.0.0.1/dvwa/vulnerabilities/fi/?page=filesfwe/../file1.php

这种url仍然可以成功包含file1.php

原文链接: dvwa v1.10 文件包含high级别的一个思路 版权所有,转载时请注明出处,违者必究。
注明出处格式:流沙团 ( http://www.gyarmy.com/post-536.html )

发表评论

0则评论给“dvwa v1.10 文件包含high级别的一个思路”