0x01 事起有因
双十一在淘宝上买了几件衣服,昨天收到短信说快递已发。于是查了下物流订单详情,然后顺便手贱了下。
0x02 安全问题
A 韵达
-------
查看订单的时候,看到有 php 页面,就 google 了一把: site:yundaex测试数据 inurl:php? ,还很发现了注入点。
注入点:
数据库:
B 申通
---------
申通的主页上面直接有新闻,而且都是 asp 的动态页面,就加了个单引号,结果就报错了。
很明显又是一个注入 漏洞 。然后习惯性的 and 1=1 , and 1=2 ,然后就出现了不常见的页面,可以证明是有 waf 在作怪。不过该 waf 没有组织 order by ,通过他可以知道前面的查询有 8 个字段。现在介绍两种绕过该 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 ,然后提交,数据出来了。
解释:即使将 select 等关键字 url 编码后,当请求的链接到达服务端后,服务端容器会先给转码的,然后再交给 asp 脚本处理。所以在源代码审计时经常会找 urldecode 等函数,因为这样可能利用 url 双编码来绕过防注入程序的处理。
Asp 环境添加 %
--------------------
将 and 1=2 union select 1,user(),3,4,5,6,version(),8 变为: an%d 1=2union selec%t 1,user(),3,4,5,6,version(),8 ,然后提交,数据又出来了。
解释: IIS 下的 asp.dll 文件在对 asp 文件后参数串进行 url 解码时,会直接过滤掉 09-0d ( 09 是 tab 键 ,0d 是回车)、 20 (空格)、 %( 下两个字符有一个不是十六进制 ) 字符。
0x03 还是那个 waf
申通这个 waf 当输入有特殊字符时,会将 query 字符串输出来。所以这里就会形成一个 xss 。
不过这个 xss 很 yy ,因为这是在代理下提交的,如果用 浏览器 的,浏览器会先给编码。
0x04 关于 waf 的资料
http://HdhCmsTestdefcon.org/images/defcon-16/dc16-presentations/defcon-16-henrique.pdf
Playing with Web Application Firewalls
http://pauldotcom测试数据/2012/01/real-world-waf-detection-and-b.html
Real World WAF Detection and Bypass Made Easy
https://HdhCmsTestow asp .org/images/0/0a/Appseceu09-Web_Application_Firewalls.pdf
Web Application Firewalls:
What the vendors do NOT want
you to know
[TUT]basic WAF bypassing and intrusiondetection [tut]
http://HdhCmsTest101hacker测试数据/2011/11/sql-injections-part-5-bypassing-waf. html
SQL InjectionPart 5 – Bypassing WAF
http://ptsecurity测试数据/download/PT-devteev-CC-WAF-ENG.pdf
Methods to Bypass a Web ApplicationFirewall
http://HdhCmsTestnethemba测试数据/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://HdhCmsTestandlabs.org/whitepapers/Split_and_Join.pdf
Split_and_Join
http://HdhCmsTestsectechno测试数据/2010/05/23/detecting-bypassing-web-application-firewalls-part-1/
DETECTING & BYPASSING WEB APPLICATIONFIREWALLS (PART 1)
https://HdhCmsTestsans.org/security-training/web-application-firewall-filter-bypass-day-4-15936-cid
Web Application Firewall and Filter Bypass
http://HdhCmsTestdarkreading测试数据/security/news/217400819/researchers-hack-web-application-firewalls.html
还有 safe3 和 blackhat 上面那个协议方面绕过的文章,可以自己找下。
…..
欢迎补充。
0x05 问题说明
这几个漏洞应该都存在很长时间了,而且估计千人日了。不过这里只做说明,重点是 waf 。
查看更多关于快递厂商的安全小测 - 网站安全 - 自学php的详细内容...