XSS-labs靶场练习

1.环境搭建

先去GitHub下载,点这。然后利用phpstudy启动服务访问即可,具体的百度都有。

level 1

观察源代码

<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()  
{
        
confirm("完成的不错!");
 window.location.href="level2.php?keyword=test"; 
}
</script>
<title>欢迎来到level1</title>
</head>
<body>
<h1 align=center>欢迎来到level1</h1>
<h2 align=center>欢迎用户1"></h2></h2><center><img src=level1.png></center>
<h3 align=center>payload的长度:8</h3></body>
</html>

闭合前面的

,在执行一个xss比如即可完成第一关,payload:

http://127.0.0.1/xss-labs-master/level1.php?name=

level2


<!DOCTYPE html><!--STATUS OK--><html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script>
window.alert = function()  
{
        
confirm("完成的不错!");
 window.location.href="level3.php?writing=wait"; 
}
</script>
<title>欢迎来到level2</title>
</head>
<body>
<h1 align=center>欢迎来到level2</h1>
<h2 align=center>没有找到和test相关的结果.</h2><center>
<form action=level2.php method=GET>
<input name=keyword  value="test">
<input type=submit name=submit value="搜索"/>
</form>
</center><center><img src=level2.png></center>
<h3 align=center>payload的长度:4</h3></body>
</html>

先用第一关的payload试试,发现行不通,变成了这样

h1 align=center>欢迎来到level2</h1>
<h2 align=center>没有找到和&lt;/h2&gt;&lt;script&gt;

你可能感兴趣的:(php,javascript,html)