一、通過頁面報錯找路徑
1、存在注入時單引號爆路徑
就像測試SQL注入一樣在參數後面加上單引號,若頁面返回內容可能爆出網站路徑
http://www.test.com/xxx.php?id=100'
2、錯誤參數值爆路徑
若第一種方式觸發waf,可通過錯誤參數值爆網站路徑
http://www.test.com/xxx.php?id=-100'
http://www.test.com/xxx.php?id=AbCdE'
3、通過搜索引擎獲取
通過搜索引擎語法搜索頁面報錯內容可能獲取到網站路徑
Site:test.com warning
Site:test.com "fatal error"
4、nginx文件類型錯誤解析爆路徑
要求Web服務器是nginx,且存在文件類型解析漏洞。利用nginx對應版本的解析漏洞,在圖片地址後加/x.php,該圖片不但會被當作php文件執行,還有可能爆出物理路徑
http://www.test.com/xxx.jpg/x.php
…
二、根據一鍵/搭建平臺找路徑
1、搭建平臺測試文件獲取路徑
網站通過XAMPP或者phpstudy等軟件搭建的話,會存在一些測試文件,比如:探針或者phpinfo那一類文件
/test.php
/info.php
/phpinfo.php
/php_info.php
/1.php
/l.php //phpstudy的探針
2、配置文件獲取路徑
如果注入點有文件讀取權限,就可以通過load_file函數讀取配置文件,再從中尋找路徑信息
Windows配置文件
c:\windows\php.ini //php配置文件
c:\windows\system32\inetsrv\MetaBase.xml //IIS虛擬主機配置文件
Linux配置文件
/etc/php.ini // php配置文件
/etc/httpd/conf.d/php.conf
/etc/httpd/conf/httpd.conf //Apache配置文件
/usr/local/apache/conf/httpd.conf
/usr/local/apache2/conf/httpd.conf
/usr/local/apache/conf/extra/httpd-vhosts.conf //虛擬目錄配置文件
XAMPP配置文件
C:\xampp\htdocs //Xampp文件路徑
C:\xampp\apache\conf/httpd.conf //httpd.com配置文件
C:\xampp\apache\onf\extra\httpd-vhosts.conf //vhosts.conf虛擬主機
phpstudy配置文件
C:\phpstudy\www //網站默認路徑
C:\phpStudy\Apache\conf\httpd.conf //httpd.conf配置文件
C:\phpStudy\Apache\conf\extra\httpd-vhosts.conf //vhosts.conf虛擬主機
利用phpmyadmin爆路徑
/phpMyAdmin/libraries/lect_lang.lib.php
/phpMyAdmin/index.php?lang[]=1
/phpMyAdmin/phpinfo.php
/phpMyAdmin/themes/darkblue_orange/layout.inc.php
/phpMyAdmin/libraries/select_lang.lib.php
/phpMyAdmin/libraries/lect_lang.lib.php
/phpMyAdmin/libraries/mcrypt.lib.php
三、利用漏洞
1、配合遠程代碼執行漏洞
比如eval()函數可控的話,直接傳入phpinfo();
,通過phpinfo頁面中Document_Root參數獲取網站絕對路徑
…
GOT IT!
******************************************************
還有更多爆路徑方法,等着慢慢積累吧~