LDAP/LDAPS Enumeration (389, 636)
#Quick failure checklist
#If LDAP tools fail, check in this order:
1. time sync against the DC
2. DC IP/FQDN and /etc/hosts entry
3. DNS resolution for the domain and DC
4. bind format: user@domain.local vs domain.local\\user
5. reachability to 389 and 636 from the host you are running from
6. whether the creds actually work on SMB/WinRM against the same target
Query naming contexts
#ldapsearch -x -H ldap://$IP -s base namingcontexts
Check who you are after an authenticated bind
#ldapwhoami -x -H ldap://$IP -D 'domain.local\user' -w 'password'
ldapwhoami -x -H ldap://$IP -D 'user@domain.local' -w 'password'
Authenticated rootDSE and base search
#ldapsearch -x -H ldap://$IP -D 'domain.local\user' -w 'password' -s base namingcontexts
ldapsearch -x -H ldap://$IP -D 'domain.local\user' -w 'password' -b "DC=domain,DC=local" "(objectClass=*)" dn
Anonymous LDAP search
#ldapsearch -x -H ldap://$IP -b "DC=domain,DC=local"
Check DC records if DNS is in play
#dig @$IP _ldap._tcp.dc._msdcs.domain.local SRV
Check LDAPS certificate
#openssl s_client -connect $IP:636 -servername domain.local
If BloodHound or SharpHound fails
#Do not stop at the collector failure.
- verify LDAP with ldapwhoami / ldapsearch first
- rerun from a domain-joined foothold if possible
- fall back to manual enumeration in [Active Directory](<active-directory>)