pentesting, updated
LDAP enumeration
Enumerate directory objects, users and groups from an LDAP/Active Directory service.
Goal
Extract the directory structure, user and group objects an LDAP service exposes, starting from an anonymous bind if one is allowed.
How to test
ldapsearch -x -H ldap://10.10.10.5 -s base namingcontexts # see [ldapsearch](/docs/pentest-cheatsheets/tools/network/ldapsearch) for more
ldapsearch -x -H ldap://10.10.10.5 -b "DC=internal,DC=corp,DC=local" # anonymous bind, dump the tree
ldapsearch -x -H ldap://10.10.10.5 -D "user@internal.corp.local" -w 'Password1' \
-b "DC=internal,DC=corp,DC=local" "(objectClass=user)" sAMAccountName
What to look for
Anonymous bind succeeding at all, user objects with a description field containing a password, or group membership revealing a path to a privileged account.
Notes
If anonymous bind is refused, the same queries authenticated with any low-privilege domain account usually still work — LDAP read access is rarely locked down per-user.