任意文件下载

任意文件下载

知识点

  • 目录扫描
  • 任意文件下载

打开网页后,未发现任何提示信息,直接上扫描(其实是想了很久才想出来的),扫描后发现有以下几个目录。

首先打开robots.txt,发现提示download777.php

打开download777.php,发现提示filename不能为空,直接输入get变量filename

输入filename后,发现直接将index.php下载下来了。

果断先将download777.php下载下来,代码如下

<?php

$filename = $_GET['filename'];

$file = $filename;
if(!empty($file)){
    //First, see if the file exists
if (!is_file($file)) { die("<b>404 File not found!</b>"); }

//Gather relevent info about file
//$len = filesize($file);
//此处为任意文件下载漏洞
$filename = basename($file);
$file_extension = strtolower(substr(strrchr($filename,"."),1));

$content = file_get_contents($file);
header("Content-Disposition: inline; filename=$filename");
header("Content-type: application/".$file_extension."");
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
echo $content;
}else{
    echo "filename can't null";
}
?>

代码审计后发现只有一个任意文件下载的代码,没有其他可用信息了,再次下载其他的php,想到之前的扫描信息,info.php,发现代码为

<?php
//include "testconfig.inc.php";
?>

发现还有一个文件testconfig.inc.php,下载testconfig.inc.php,获得flag

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值