LDAP Authenticated User Group Enumeration
With valid domain credentials — even a low-privilege user account — you can query nearly everything in Active Directory via LDAP. The goal is to map users, groups, service accounts, and delegations that translate into privilege escalation or lateral movement paths. Run this immediately after you obtain any set of valid domain credentials.
Authenticating with ldapsearch
Two authentication formats work depending on the directory type.
Users — full attribute pull
Pull all user objects with the attributes that matter for privilege escalation planning. userAccountControl tells you the account flags — disabled, no password required, no pre-auth. memberOf shows group memberships. pwdLastSet of 0 means the password was never set or is expired.
The grep -v '\$$' at the end strips machine accounts (which end in $) leaving only user accounts. Machine accounts are still useful for Pass-the-Hash and Kerberos attacks but keep them separate from your user list.
userAccountControl bit values
The userAccountControl attribute is a bitmask. These are the values that matter most during an engagement:
Value | Hex | Meaning | Attack relevance |
|---|---|---|---|
2 | 0x0002 | Account disabled | Skip for spraying |
32 | 0x0020 | Password not required | Try blank password immediately |
65536 | 0x10000 | Password never expires | Old password, worth spraying |
4194304 | 0x400000 | No pre-auth required | AS-REP Roastable |
8192 | 0x2000 | Domain controller | DCSync target |
Service accounts and Kerberoasting
Any account with a Service Principal Name set can have its Kerberos TGS ticket requested by any authenticated user and cracked offline. Pull all SPNs, then request the tickets.
Delegation — unconstrained and constrained
Delegation allows a service to authenticate to other services on behalf of a user. Unconstrained delegation means the service receives a copy of the user's TGT — if you compromise an account or machine with unconstrained delegation, any user who authenticates to it gives you their TGT. Constrained delegation restricts which services can be impersonated but can still be abused.
Computers with unconstrained delegation are high-value targets — any domain admin who authenticates to that machine (e.g. via a printer bug or forced authentication) gives you a TGT you can use for privilege escalation. Domain controllers always have unconstrained delegation by default, so filter them out with (&(objectClass=computer)(userAccountControl:1.2.840.113556.1.4.803:=524288)(!(userAccountControl:1.2.840.113556.1.4.803:=8192))). For exploitation see Unconstrained Delegation Abuse and Constrained Delegation Abuse.
Groups and privileged memberships
nxc — fast bulk enumeration
After pulling users and identifying attack paths: AS-REP Roastable accounts go to AS-REP Roasting, Kerberoastable SPNs go to Kerberoasting or AD Kerberoasting, unconstrained delegation targets go to Unconstrained Delegation Abuse, constrained delegation targets go to Constrained Delegation Abuse, ACL misconfigurations on high-value objects go to ACL Abuse Privilege Escalation, and credentials found in descriptions go directly to AD Password Spraying or lateral movement.
References
-
NetExec (nxc) — GitHubgithub.com/Pennyw0rth/NetExec (opens in new tab)
Full LDAP module documentation and flags
-
Impacket GetUserSPNs — GitHubgithub.com/fortra/impacket (opens in new tab)
Kerberoasting via LDAP SPN enumeration
Was this helpful?
Your feedback helps improve this page.