Active Directory Enumeration: BloodHound, PowerView & LDAP Queries

Active directory enumeration is the critical first phase of any internal network penetration test. Before exploiting misconfigurations, attackers must map the AD environment: users, groups, computers, GPOs, trusts, and ACLs. This guide covers the most effective tools and techniques for AD enumeration using BloodHound, PowerView, and LDAP queries.

Why Active Directory Enumeration Matters

Active Directory is the backbone of most enterprise networks, managing authentication and authorization for every resource. A thorough active directory enumeration reveals attack paths that lead to Domain Admin. Tools like BloodHound visualize these paths automatically, turning hours of manual work into minutes.

BloodHound & SharpHound: Mapping Attack Paths

BloodHound uses graph theory to reveal hidden relationships in Active Directory. SharpHound is the collector that gathers data from the domain.

# Run SharpHound from a domain-joined machine
./SharpHound.exe -c All --zipfilename ad_enum.zip

# Run SharpHound remotely with credentials
./SharpHound.exe -c All -d target.local --ldapusername jdoe --ldappassword P@ss123

# Import zip into BloodHound
# Start Neo4j, launch BloodHound, drag-and-drop the zip

Once data is loaded into BloodHound, use pre-built queries: “Find all Domain Admins”, “Find Shortest Paths to Domain Admins”, “Find Principals with DCSync Rights”. These queries expose the most critical attack paths instantly.

PowerView: Manual AD Enumeration

PowerView is a PowerShell tool for AD reconnaissance. Import it and start enumerating domain objects immediately.

# Import PowerView
Import-Module ./PowerView.ps1

# Enumerate domain information
Get-NetDomain
Get-NetDomainController

# Enumerate users
Get-NetUser | Select SamAccountName, Description, MemberOf
Get-NetUser -SPN  # Find service accounts (Kerberoastable)

# Enumerate groups
Get-NetGroup -Name "Domain Admins" | Select Member
Get-NetLocalGroup -ComputerName DC01

# Enumerate computers
Get-NetComputer | Select Name, OperatingSystem, LastLogon

# Find shares
Find-DomainShare -CheckShareAccess

# Find users with high-value permissions
Find-DomainUserLocation -UserGroupIdentity "Domain Admins"

LDAP Queries for Manual Enumeration

Direct LDAP queries work even when PowerShell is restricted. Use ldapsearch from Linux or ADExplorer on Windows.

# Enumerate users via LDAP from Linux
ldapsearch -x -H ldap://10.10.10.161 -b "DC=htb,DC=local" -D "htb\svc-alfresco" -w s3rvice "(objectClass=user)" sAMAccountName

# Find Domain Admins
ldapsearch -x -H ldap://10.10.10.161 -b "DC=htb,DC=local" "(memberOf=CN=Domain Admins,CN=Users,DC=htb,DC=local)" sAMAccountName

# Find accounts with no kerberos preauthentication (AS-REP Roastable)
ldapsearch -x -H ldap://DC_IP -b "DC=domain,DC=local" "(userAccountControl:1.2.840.113556.1.4.803:=4194304)" sAMAccountName

Enumerating ACLs and Trusts

ACL misconfigurations are a goldmine. WriteDACL, GenericAll, GenericWrite, ForceChangePassword — these permissions on high-value objects lead directly to Domain Admin.

# Find interesting ACLs with PowerView
Find-InterestingDomainAcl -ResolveGUIDs | Where-Object {$_.IdentityReferenceName -notmatch "^(DnsAdmins|SYSTEM|Domain Admins)"}

# Check trusts
Get-NetDomainTrust
Get-NetForestTrust

# Enumerate GPOs
Get-NetGPO | Select DisplayName, GpcFileSysPath
Get-NetGPOGroup  # GPOs that add users to local admins

References

For further reading: MITRE ATT&CK — Discovery (TA0007), BloodHound GitHub, PowerView Source.

Related Articles

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top