问题标签 [clickjacking]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1047 浏览

django - 即使在视图设置为@xframe_options_exempt 后,Django iframe 加载也被 xframe 选项拒绝

我有一个 django 应用程序,我想在其中将一个embed视图作为 iframe 嵌入任何站点。以为我已经正确配置了这个,因为我将视图设置为@xframe_options_exempt,但我仍然在 Chrome 和 Firefox 中得到一个 x-frame 选项错误。

铬合金:Refused to display 'https://foo.com/embed/...' in a frame because it set 'X-Frame-Options' to 'deny'.

火狐:Load denied by X-Frame-Options: 'https://foo.com/embed/...' does not allow framing

视图.py

设置.py

我假设djangosecure.middleware.SecurityMiddleware正在执行 'X-Frame-Options' over @xframe_options_exempt. 我更愿意使用特定于视图的解决方案而不是 set 来解决这个问题X_FRAME_OPTIONS = 'ALLOW'。谢谢

0 投票
1 回答
7887 浏览

content-security-policy - 内容安全策略“框架祖先”指令在元素中不起作用

作为点击劫持的一部分,我们正在尝试将 CSP 标头作为元标记添加到我们的 Angular 项目中。下面是html

但是,当我们尝试将页面加载为 iframe 时,它​​会加载。我们已经在谷歌浏览器中进行了测试。

为了解决这个问题,我们构建了 Angular 项目,将 dist 下的文件移动到 Web 应用程序,添加了一个过滤器以将 CSP 标头添加到每个请求的响应中。下面是代码

这行得通。

为什么在元标记中添加 CSP 标头不起作用?我什至检查了https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy,他们提到在元标记中添加 CSP。

我知道 X-FRAME-OPTIONS 不支持 html 元标记。Content-Security-Policy 也一样吗?还是 chrome 忽略了元标记中的 CSP?

0 投票
1 回答
2797 浏览

html - iframe 如何在其中嵌入 https 403 禁止站点?

我在它的 iframe 中找到了一个能够访问被禁止站点的网站,所以我检查了网页和 iframe,发现没有太多的脚本或设计,而是一个简单的 iframe,其中显示了一个被禁止的站点。我通过复制 iframe 的 src 发现该站点被禁止,并尝试使用不同的浏览器(如 chrome、Firefox、Tor)访问它,但没有成功。谁能向我解释一下该网站如何能够访问其 iframe 中未经授权的内容?注意:该网站有一个 .se(瑞典)顶级域

0 投票
1 回答
433 浏览

rest - OWASP 保护 restapi 免受点击劫持的安全指南,它们准确吗?

我们有一个基于 java restapi webapplication ,我正在尝试对它进行渗透测试,并且我浏览了 restapi 的 owasp 安全表:

https://www.owasp.org/index.php/REST_Security_Cheat_Sheet#Security_headers

正如 owasp 建议的那样,“另外,客户端应该发送一个 X-Frame-Options:deny 以防止在旧浏览器中进行拖放点击劫持攻击。”但是,据我所知,服务器通常会发送这个 x-frame-options,不是客户,是 owasp 的错字失败吗?此外,对于 rest api 请求,如何利用点击劫持,因为在浏览器中看不到 restapi 调用!?

0 投票
1 回答
33 浏览

security - 清除 cookie 后是否可能进行 CSRF / 点击劫持?

据我了解,CSRF 和 Clickjacking 使用浏览器自动在对网页的请求(即来自该域的请求)中包含 cookie 的事实。

所以基本上,攻击者会准备一个恶意站点并调用某个 URL(例如 Gmail),希望这个 URL 的 cookie 仍然保存在我的浏览器中。或者他们能以某种方式找出我当前在另一个选项卡中登录了哪些网页,然后针对此调整他们的攻击?

还有一个更紧迫的问题:在我清除浏览器缓存或正确注销后,这两种攻击是不可能的,不是吗?

0 投票
3 回答
3372 浏览

angular - add_header X-Frame-Options DENY;在 nginx conf 中不起作用,我仍然可以在我们的应用程序中看到 iframe

add_header X-Frame-Options DENY;似乎对我们不起作用。

我们打算将我们的托管页面之一显示为 PCI 相关问题的 iframe,我们成功了,但为了避免点击劫持,我们建议使用x-frame-options DENY但我们不能这样做,因为我们希望我们的用户使用框架我们开发了,所以解决方案可能是使用x-frame-options ALLOW FROM uri.

我们正在尝试add_header X-Frame-Options DENY;查看我们的应用程序是否首先限制了 iframe,但 iframe 仍然可见。我们多次验证了 add header 是否在 nginx conf 中的位置错误,但事实并非如此。

PS下面的图片是参考的,但我们仍然可以看到角度应用程序成功地渲染了框架:(

否定

0 投票
0 回答
36 浏览

javascript - Is there a way to pass a script tag through a GET request?

I am working on a school project and the goal is a rather difficult click jacking. I am using a virtual machine and a host-based domain. Essentially, I have a very vulnerable shopping website and I am trying to overlay iframes on top of some buttons on the site.

My first approach I created an iframe when the user clicked my "eViL" Button to host the vulnerable website in. From here I have tried inserting more iframes based off of the page after it loads (since the buttons are dynamic). I have tried doing this by doing something like this:

However, I soon realized that this just causes an error because of the Same Origin Policy of the Browser.

My second approach that I can think of is possibly sending some script tags through a GET request. However, I am not quite sure how to go about doing it as I am not super familiar with Javascript or HTML. I'm sure it will have to be a little hacky to do it by escaping characters and what not but, is it really possible to do it this way?

My second kind of overall question is was my logic from my first attempt flawed? Or was there another way to go about doing this whole process? Which approach seems to be the correct one here?

0 投票
1 回答
6169 浏览

node.js - 内容安全策略框架祖先“无”不起作用

我试图通过Content-Security-Policy在节点层的响应标题中设置它来禁用我网站上的所有 iframe。根据Mozilla Developer Network,从客户端的角度来看,该属性应如下所示:

没关系,这就是我在中间件的 Node 层中设置它的方式:

这是我检查网络活动时它在客户端的显示方式:

在此处输入图像描述

但是,当我嵌入 YouTube iframe 时,如下所示:

它没有被禁用。为什么框架祖先策略似乎没有效果?在 Chrome 上测试它的价值。

0 投票
1 回答
335 浏览

django - 为什么 Django 从用 xframe_options_exempt 装饰的视图返回 X-Frame-Options SAMEORIGIN?

我有一个用 装饰的 Django 视图@xframe_options_exempt,我将它托管在一个iframe. 视图上的GET请求工作正常,但会POST导致浏览器错误,因为返回的响应X-Frame-Options设置为SAMEORIGIN.

为什么不@xframe_options_exempt工作?

0 投票
0 回答
319 浏览

x-frame-options - 为什么chrome会忽略X-frame-option:sameorigin?

Mac 上的 Chrome 忽略了我网站的 X-frame-options 标头。

我已经设置了 x-frame-options :sameorigin 我正在使用 Google Chrome 是最新版本 74.0.3729.157(官方构建)(64 位)。

Chrome 会忽略标题并在 iframe 中打开网站。Firefox 和 safari 阻止站点在框架中打开。