当前位置:网站首页>点击劫持攻击
点击劫持攻击
2022-07-26 16:52:00 【悠然予夏】
1、攻击原理
点击劫持(Click Jacking),也被称为UI覆盖攻击
黑客创建一个网页利用iframe包含目标网站;隐藏目标中的网站,是用户无法察觉到目标网站的存在;诱使用户点击图中特定的按钮。特定的按钮为位置和原网页中关键按钮位置一致,用户在不知情的情况下点击按钮,被引诱执行了危险操作。

2、攻击方式
两种方式:
- 一是攻击者使用一个透明的iframe,覆盖在一个网页上,然后诱使用户在该页面上进行操作,此时用户将在不知情的情况下点击透明的iframe页面;
- 二是攻击者使用一张图片覆盖在网页,遮挡网页原有位置的含义。
3、iframe覆盖攻击与防护
iframe攻击就像一张图片上面铺了一层透明的纸一样,你看到的页面是在底部,而你真正点击的是被黑客透明化的另一个网页。一个简单的点击劫持例子,就是当你点击了一个不明链接之后,自动关注了某一个人的博客或者订阅了视频。
假如我在优酷发布了很多视频,想让更多的人关注它,于是我们准备了一个页面:
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<head>
<title>点击劫持 POC</title>
<style>
iframe {
width: 1440px;
height: 900px;
position: absolute;
top: -0px;
left: -0px;
z-index: 2;
-moz-opacity: 0;
opacity: 0;
filter: alpha(opacity=0);
}
button {
position: absolute;
top: 270px;
left: 1150px;
z-index: 1;
width: 90px;
height:40px;
}
</style>
</head>
<body>
<button>美女图片</button>
<img src="http://pic1.win4000.com/wallpaper/2018-03-19/5aaf2bf0122d2.jpg">
<iframe src="http://i.youku.com/u/UMjA0NTg4Njcy" scrolling="no"></iframe>
</body>
</html>
当然真正的页面肯定会更精致一些,不会这么简陋。
解决办法
使用一个HTTP头——X-Frame-Options。X-Frame-Options可以说是为了解决ClickJacking而生的,它有三个可选的值:
- DENY:浏览器会拒绝当前页面加载任何frame页面;
- SAMEORIGIN :frame页面的地址只能为同源域名下的页面;
- ALLOW-FROM origin:允许frame加载的页面地址;
nginx配置:
add_header X-Frame-Options SAMEORIGIN;
4、图片覆盖攻击与防护
图片覆盖攻击(Cross Site Image Overlaying),攻击者使用一张或多张图片,利用图片的style或者能够控制的CSS,将图片覆盖在网页上,形成点击劫持。当然图片本身所带的信息可能就带有欺骗的含义,这样不需要用户点击,也能达到欺骗的目的。
PS:这种攻击很容易出现在网站本身的页面。
示例
在可以输入HTML内容的地方加上一张图片,只不过将图片覆盖在指定的位置。
<a href="http://tieba.baidu.com/f?kw=%C3%C0%C5%AE">
<img src="XXXXXX" style="position:absolute;top:90px;left:320px;" />
</a>解决办法
在防御图片覆盖攻击时,需要检查用户提交的HTML代码中,img标签的style属性是否可能导致浮出。
总结:
点击劫持算是一种很多人不大关注的攻击,他需要诱使用户与页面进行交互,实施的攻击成本更高。另外开发者可能会觉得是用户犯蠢,不重视这种攻击方式。
边栏推荐
- Come on developer! Not only for the 200000 bonus, try the best "building blocks" for a brainstorming
- 就这一次!详细聊聊分布式系统的那些技术方案
- Speaker recruitment | AI time recruit icml/ijcai 2022 as a Chinese speaker!!!
- Xiaomi Wuhan headquarters building starts today! Lei Jun: planned according to the scale of 10000 people
- 基本的SELECT语句
- 2.1.2 同步始终失败
- On the growth of data technicians
- JS 递归 斐波那契数列 深克隆
- Ascend目标检测与识别-定制自己的AI应用
- Use dired to move files quickly
猜你喜欢

GAN (Generative Adversarial Network,GAN)生成式对抗网络

Pass-19,20

About the difference between BigDecimal conversion string toengineeringstring, toplainstring and toString

The principle of reliable transmission in TCP protocol
![[ctfshow web] deserialization](/img/cd/b76e148adfc4d61049ab2cf429d4d7.png)
[ctfshow web] deserialization

Redis persistence - detailed analysis of RDB source code | nanny level analysis! The most complete network

【机器学习】Mean Shift原理及代码

第16周OJ实践1 计算该日在本年中是第几天
![[C language classic topic exercise 2]](/img/66/8dbfefe585aa35f5791f04b376b75c.png)
[C language classic topic exercise 2]

Avalanche subnets vs. polygon supernets of application chain
随机推荐
股票公司开户万一免五这是真的安全靠谱的吗
The diagram of user login verification process is well written!
About the adjustment of the game background, reading this article is enough
2.1.2 synchronization always fails
Common super easy to use regular expressions!
Concepts and differences of DQL, DML, DDL and DCL
OpenWrt之feeds.conf.default详解
Kudu design tablet
leetcode:1206. 设计跳表【跳表板子】
敏捷开发与DevOps的对比
简述CUDA镜像构建
CCS TM4C123新建工程
硬件开发与市场产业
Xiaomi Wuhan headquarters building starts today! Lei Jun: planned according to the scale of 10000 people
Heavy announcement! Icml2022 Awards: 15 outstanding papers, selected by Fudan University, Xiamen University and Shanghai Jiaotong University
【虚拟机数据恢复】意外断电导致XenServer虚拟机不可用,虚拟磁盘文件丢失的数据恢复案例
Brief introduction to CUDA image construction
图的遍历的定义以及深度优先搜索和广度优先搜索(一)
Pytorch中的tensor操作
Leetcode:1206. design jump table [jump table board]