Skip to content
Pwnversity
AD-ENUMintermediate · 11 min · upd. 2026-11

Active Directory Enumeration

T1087.002T1069.002T1482T1018

Active Directory is a hierarchical database, accessible over LDAP, that describes the whole organization: users, groups, computers, policies, trusts and the permissions between them. What matters to the attacker is that any authenticated domain user can read almost everything: who is an administrator, which accounts have SPNs, which computers have delegation, which ACLs sit on each object. Enumerating AD is drawing the map before attacking: Kerberoasting, ACL paths, delegations, AD CS and the shortest path to Domain Admin all come from here.

flowchart LR
    Z["No credentials"] -->|"DNS, rootDSE, null session,<br/>kerbrute, RID cycling"| U["User list<br/>password policy"]
    U -->|"AS-REP roasting, spraying"| C["First credential"]
    C -->|"LDAP / SMB / BloodHound"| M["Full map:<br/>SPNs, ACLs, delegations,<br/>GPOs, AD CS, trusts"]
    M --> A["Attack path"]

AD favors interoperability: computers and applications need to query the directory, so reading it is a default right of any account. That bulk read gives the attacker the privilege map without touching anything broken. For the defender, the queries look legitimate: the challenge is telling reconnaissance apart from normal use.

Port Service What it’s good for
53 DNS SRV records, machine names
88 Kerberos Validating users, roasting
135 / 139 / 445 RPC / SMB Users, groups, shares (SYSVOL, NETLOGON), RID cycling
389 / 636 LDAP / LDAPS The whole directory
3268 / 3269 Global catalog Forest-wide searches
5985 WinRM Remote access, if you have permissions
  • Domain (DC=corp,DC=local): users, groups, computers, OUs, GPOs.
  • Configuration (CN=Configuration,…): sites, services, AD CS (templates and CA).
  • Schema (CN=Schema,CN=Configuration,…): class and attribute definitions.

The rootDSE (the empty entry) can be read without authenticating and gives the naming contexts, the DC’s name and the functional level.

Attribute What to look for
userAccountControl Flags: DONT_REQ_PREAUTH (0x400000), TRUSTED_FOR_DELEGATION (0x80000), PASSWD_NOTREQD (0x20), DONT_EXPIRE_PASSWORD (0x10000), ACCOUNTDISABLE (0x2)
servicePrincipalName User accounts with an SPN → Kerberoasting
adminCount 1 = protected by AdminSDHolder (privileged now or in the past)
description, info Passwords written down by the help desk
memberOf / member Memberships, including nested ones
pwdLastSet, lastLogonTimestamp Old accounts, passwords that never rotate, abandoned accounts
msDS-AllowedToDelegateTo · msDS-AllowedToActOnBehalfOfOtherIdentity Constrained delegation and RBCD (delegation)
ms-DS-MachineAccountQuota How many computers a regular user can create (10 by default)
nTSecurityDescriptor Each object’s DACL (ACL)

userAccountControl flags are filtered in LDAP with the bitwise AND matching rule 1.2.840.113556.1.4.803:

(&(objectCategory=person)(userAccountControl:1.2.840.113556.1.4.803:=4194304)) # no pre-authentication
(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288)(!(userAccountControl:1.2.840.113556.1.4.803:=8192))) # unconstrained delegation, DCs excluded (8192)
(&(objectCategory=person)(servicePrincipalName=*)) # users with an SPN
Starting point What you can get
No known internal network Domain and DC names from DNS and the SMB/LDAP banner
No credentials rootDSE, valid users through Kerberos, sometimes null session and RID cycling
Guest account or anonymous session allowed Users through RID cycling, sometimes shares
Any domain account Practically the whole directory, SYSVOL, full BloodHound
Local admin on a machine Also, that machine’s sessions and local groups
Ventana de terminal
# Locate DCs and the domain
dig +short SRV _ldap._tcp.dc._msdcs.corp.local
nxc smb 10.10.10.0/24 # each machine's name, domain, version and SMB signing
ldapsearch -x -H ldap://10.10.10.10 -b '' -s base namingContexts dnsHostName domainFunctionality
# Valid users through Kerberos (no password: the KDC answers differently if the user exists)
kerbrute userenum -d corp.local --dc 10.10.10.10 names.txt
# Null or guest session: RID cycling and users
nxc smb 10.10.10.10 -u '' -p '' --users
nxc smb 10.10.10.10 -u 'guest' -p '' --rid-brute
enum4linux-ng -A 10.10.10.10

With the user list: AS-REP roasting (needs no passwords) and, minding the lockout policy, password spraying.

The first pass, with NetExec:

Ventana de terminal
nxc smb dc01.corp.local -u jdoe -p 'Passw0rd!' --users --groups --shares --pass-pol
nxc ldap dc01.corp.local -u jdoe -p 'Passw0rd!' --users # includes the description
nxc ldap dc01.corp.local -u jdoe -p 'Passw0rd!' --admin-count --trusted-for-delegation --password-not-required
nxc ldap dc01.corp.local -u jdoe -p 'Passw0rd!' -M maq # ms-DS-MachineAccountQuota
nxc ldap dc01.corp.local -u jdoe -p 'Passw0rd!' -M adcs # is there AD CS?
LDAP 10.10.10.10 389 DC01 -Username- -Last PW Set- -BadPW- -Description-
LDAP 10.10.10.10 389 DC01 svc-backup 2018-05-02 10:11:09 0 Backup job. Pass: Backup2018!
LDAP 10.10.10.10 389 DC01 helpdesk-admin 2025-11-03 08:40:52 0 Tier 2 support

The password policy (--pass-pol) decides how many attempts you can make before locking accounts out: note it down before trying any credential.

For the permission graph, BloodHound (see its card):

Ventana de terminal
bloodhound-python -d corp.local -u jdoe -p 'Passw0rd!' -ns 10.10.10.10 -c All --zip
# or with NetExec
nxc ldap dc01.corp.local -u jdoe -p 'Passw0rd!' --bloodhound --collection All --dns-server 10.10.10.10

Targeted queries with ldapsearch:

Ventana de terminal
ldapsearch -x -H ldap://10.10.10.10 -D 'jdoe@corp.local' -w 'Passw0rd!' -b 'DC=corp,DC=local' \
'(&(objectCategory=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288)(!(userAccountControl:1.2.840.113556.1.4.803:=8192)))' dNSHostName

Other sources with the same account:

Ventana de terminal
adidnsdump -u 'corp.local\jdoe' -p 'Passw0rd!' dc01.corp.local # DNS records in the zone
certipy find -u jdoe@corp.local -p 'Passw0rd!' -dc-ip 10.10.10.10 -vulnerable -stdout # AD CS
nxc smb dc01.corp.local -u jdoe -p 'Passw0rd!' -M gpp_password # passwords in SYSVOL

With the Active Directory module (if RSAT is installed) or with PowerView:

Ventana de terminal
Get-ADUser -Filter 'servicePrincipalName -like "*"' -Properties servicePrincipalName,memberOf,pwdLastSet
Get-ADComputer -Filter 'TrustedForDelegation -eq $true'
Get-ADDomain | Select-Object DistinguishedName, DomainMode
# PowerView
Get-DomainUser -PreauthNotRequired
Get-DomainUser -Properties samaccountname,description | ? description
Get-DomainGPOLocalGroup # who is local admin through GPO
Find-DomainShare -CheckShareAccess
Finding Next step
Password in description Validate it and see what it allows
Users with an SPN Kerberoasting
DONT_REQ_PREAUTH AS-REP roasting
cpassword in SYSVOL GPP
Abusable ACLs in the graph ACL abuse
Delegation (unconstrained, constrained, RBCD) Kerberos delegation
AD CS with vulnerable templates AD CS
ms-DS-MachineAccountQuota > 0 Creating computer accounts (RBCD, relay)
Readable LAPS or gMSA Read them (ACL)
SMB signing not required on machines NTLM relay
Trusts to other domains Trust abuse
  1. Without credentials: domain, DCs, rootDSE, valid users and policy (if there’s a null session).
  2. First credential: NetExec (users, groups, shares, policy) and full BloodHound.
  3. Check descriptions, SYSVOL and AD CS: they’re quick wins.
  4. List SPNs, accounts without pre-authentication, delegations, LAPS, MAQ and SMB signing.
  5. In BloodHound, shortest path from your account to Domain Admins and to valuable machines.
  6. Repeat the enumeration with every new account: permissions change.
  • NetExec (card): SMB and LDAP with modules (maq, adcs, laps, gpp_password…).
  • BloodHound with bloodhound-python, SharpHound or NetExec.
  • ldapsearch, ldapdomaindump, windapsearch, adidnsdump.
  • kerbrute, enum4linux-ng, rpcclient.
  • Certipy for AD CS.
  • PowerView and the Active Directory module on Windows; PingCastle (defensive too).

Enumeration compromises nothing by itself, but it decides the whole attack: which accounts to roast, which ACLs to abuse, which delegation to exploit and which is the shortest path to Domain Admin. Thorough reconnaissance often makes any exploit unnecessary.

  • Bulk LDAP queries from a user workstation (SharpHound, ldapdomaindump): spikes of domain-wide searches in a short time.
  • Kerberos enumeration: bursts of 4768 with error code 0x6 (unknown user) from the same source.
  • Null sessions and RID cycling: anonymous access to IPC$ and to SAMR/LSARPC.
  • Honeytokens: a decoy account with an attractive description or a fake SPN; any use or ticket request is an alert.
  • The DC’s LDAP query log (event 1644, enabled through Field Engineering) to see expensive or bulk filters.
  • 4662 with SACLs on sensitive objects; 4768/4769; 5140/5145 on shares.
  • Microsoft Defender for Identity (LDAP, account and SMB reconnaissance).
  1. No null sessions: RestrictAnonymous, RestrictAnonymousSAM, and remove Anonymous and Everyone from the Pre-Windows 2000 Compatible Access group (leftovers from old domains that allow enumeration without authentication).
  2. Clean descriptions and attributes holding secrets; check SYSVOL too.
  3. ms-DS-MachineAccountQuota = 0 and computer joins only by authorized accounts.
  4. Remove unnecessary SPNs and DONT_REQ_PREAUTH, unconstrained delegations and broad LAPS read permissions.
  5. Audit the domain with PingCastle or Purple Knight and the graph with BloodHound before the attacker does.

If you detect reconnaissance, identify the source account and machine, review what it queried to anticipate the next step, and close first the vectors that reconnaissance would have revealed (roasting, ACLs, delegations).

  • Domain enumeration is a phase in nearly every AD intrusion (MITRE T1087.002, T1069.002, T1482); BloodHound/SharpHound appears in many ransomware incident reports as the step before escalation.
  • Passwords in description and in SYSVOL (GPP, MS14-025) are still common real findings in assessments.
  • The Pre-Windows 2000 Compatible Access group containing Everyone or Anonymous, inherited from NT4 migrations, allows enumerating the domain without credentials in older domains.

More on MITRE ATT&CK (https://attack.mitre.org/tactics/TA0007/).

  • Domain, DCs and functional level (DNS, rootDSE, SMB banner).
  • Valid users without credentials (kerbrute, null session, RID cycling).
  • Password and lockout policy noted.
  • Users, groups, shares and descriptions with the first credential.
  • Full BloodHound collected.
  • SPNs, accounts without pre-authentication, delegations, adminCount.
  • SYSVOL (GPP, scripts), AD CS, LAPS, gMSA and MAQ.
  • SMB and LDAP signing on the machines, and trusts.
  • Enumeration repeated with every new account.