Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1179818
  • 博文数量: 272
  • 博客积分: 3899
  • 博客等级: 中校
  • 技术积分: 4734
  • 用 户 组: 普通用户
  • 注册时间: 2012-06-15 14:53
文章分类

全部博文(272)

文章存档

2012年(272)

分类: 网络与安全

2012-06-26 11:02:45

Clickjacking 还不明白的可以先google

最近IE 8 RC1 发布了,也多了一个新特性,对ClickJacking的防御。

具体可以参考:
http://blogs.msdn.com/ie/archive/2009/01/27/ie8-security-part-vii-clickjacking-defenses.aspx

由于IE是个浏览器,所以微软就大方的发挥了浏览器的先天优势,造了一个 HTTP 头来防御ClickJacking

X-FRAME-OPTIONS

具体用法摘录原文如下:

Web developers can send a HTTP response header named X-FRAME-OPTIONS with HTML pages to restrict how the page may be framed. If the X-FRAME-OPTIONS value contains the token DENY, IE8 will prevent the page from rendering if it will be contained within a frame. If the value contains the token SAMEORIGIN, IE will block rendering only if the origin of the top level-browsing-context is different than the origin of the content containing the X-FRAME-OPTIONS directive. For instance, if contains a DENY directive, that page will not render in a subframe, no matter where the parent frame is located. In contrast, if the X-FRAME-OPTIONS directive contains the SAMEORIGIN token, the page may be framed by any page from the exact origin.


不喜欢看鸟语的,可以看我的小结:
1. 返回的HTTP 头中,如果是 X-Frame-OPTIONS: DENY ,那么这个页面就不能被嵌入在iframe里面,IE会报告个错误提示

2. 返回的HTTP 头中,如果是 X-Frame-OPTIONS: SAMEORIGIN ,那么这个页面只能被嵌入在 ”与TOP 页面同源“ 的页面中。(熟悉同源策略的应该很好理解)



对于程序员来说:就是要在重要的页面,加上这个HTTP返回头。

能够起到同样效果的,有frame busting 的技巧
我们经常可以看到这样一段JS:


目的是为了防止页面被iframe引用,比如baidu的很多页面就都包含了这段js,这个技巧就是frame busting

但是由于这段代码是JS写的,所以有很多方法可以绕过去,或者是可能被绕过去。


如果用HTTP头,则更可靠了,所以总的来说,微软还是做了一件好事。

不过还是有一些指出缺陷的声音:
http://ha.ckers.org/blog/20090128/ie80-and-clickjacking/

noscript的作者也在叫嚷着说他那个才是最好的



在我看来,IE8普及虽然需要些时间,但是值得期待。中肯的希望MS能在推广上走的更好。

此外还比较担忧的就是这种防御方案还是依赖于程序员的技能,无法做到 secure by default

Bless!
阅读(1147) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~