DVWA之 File Inclusion

DVWA之 File Inclusion

1.LOW级别

1.PHP代码分析

我们可以通过 View Source获得代码如下

<?php
// The page we wish to display
$file = $_GET[ 'page' ];
?> 

服务器获取 page 的值,没有进行任何过滤。
在这里插入图片描述

二 MEDIUM级别

1.PHP代码分析

我们可以通过 View Source获得代码如下

<?php

// The page we wish to display
$file = $_GET[ 'page' ];

// Input validation
$file = str_replace( array( "http://", "https://" ), "", $file );
$file = str_replace( array( "../", "..\"" ), "", $file );

?> 

在这里插入图片描述
1、使用绝对路径绕过。

2、使用的是 str_replace() 函数,可以使用重写的方式绕过
htthttp://p:// -> http://

三 HIGH级别

1.PHP代码分析

我们可以通过 View Source获得代码如下

<?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;
}

?> 

使用了fnmatch()函数检查page参数,要求page参数的开头必须是file,服务器才会去包含相应的文件。可配合文件上传漏洞利用。
?page=file:///F:/phpStudy/PHPTutorial/WWW/dvwa/php.ini

四 IMPOSSIBLE级别

<?php

// The page we wish to display
$file = $_GET[ 'page' ];

// Only allow include.php or file{1..3}.php
if( $file != "include.php" && $file != "file1.php" && $file != "file2.php" && $file != "file3.php" ) {
    // This isn't the page we want!
    echo "ERROR: File not found!";
    exit;
}

?> 

固定了文件名,无解

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值