【问题标题】:x-frame-options header set but can stilll embed in iframe?x-frame-options 标头集但仍可以嵌入 iframe?
【发布时间】:2021-10-17 01:17:07
【问题描述】:

x-frame-options 标头已确认设置为 SAMEORIGIN,但在创建简单的本地 HTML 文件时,例如

<html>
<head>
<title>Clickjack test page</title>
</head>
<body>
<p>Website is vulnerable to clickjacking!</p>
<iframe src="http://www.yoursite.com/sensitive-page" width="500" height="500"> 
</iframe>
</body> 
</html>

并尝试嵌入目标页面,我可以毫无问题地这样做。

这可能是什么原因造成的?

谢谢

【问题讨论】:

  • 您拥有该网站吗?标签“SAMEORIGIN”将允许来自自身的 iframe 请求。因此,如果 google.com 有一个 iframe 到 google.com,并且标题为“SAMEORIGIN”,那么请求就会顺利通过。

标签: html iframe web-applications header x-frame-options


【解决方案1】:

我能想到的一些原因:

  1. 页面正在从同一来源加载,因此是允许的。
  2. “X-Frame-Options”或“SAMEORIGIN”拼写不正确,因此被忽略。
  3. Content-Security-Policy frame-ancestors 指令更宽松,设置时忽略 X-Frame-Options。如果是这种情况,它应该在不理解 Content-Security-Policy 的 IE 中被阻止。
  4. 您的浏览器对本地文件更加宽容。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-16
    • 1970-01-01
    • 2017-06-13
    • 1970-01-01
    • 2019-03-15
    • 1970-01-01
    • 2018-05-23
    • 2017-02-09
    相关资源
    最近更新 更多