LDAP
LDAP Authentication
- User sends AD username and password to the application
- Application sends its own credentials to Domain Controller to create a LDAP bind request
- Domain Controller provides bind response
- Application asks for the user's information, which Domain Controller responds with
- Application sends LDAP Bind request with user credentials
- Domain Controller responds with LDAP Bind response
- The user is now authenticated to the application
LDAP Attacks
Credential Hunting: Windows Post-Exploitation › Plaintext Password Hunting
LDAP Pass-Back: Create a rogue LDAP server to capture credentials with slapd
LDAPSearch
User information, can be narrowed down with specific attributes (cn, etc.):
ldapsearch (objectclass=user)
Computer information, can also be narrowed down with specific attributes (cn, etc.):
ldapsearch (ObjectCategory=computer)
Domain trust information, can also be narrowed down with specific attributes (cn, etc.):
ldapsearch (objectClass=trustedDomain) cn,trustdirection
Fine grained password policy:
ldapsearch (ObjectClass=msDS-PasswordSettings)
LAPS enumeration:
ldapsearch (&(objectCategory=computer)(ms-MCS-admpwdexpirationtime=*)) cn
gMSA enumeration:
ldapsearch (ObjectClass=msDS-GroupManagedServiceAccount)
Impacket Enumeration
Impacket has a suite of tools that are useful for AD attacks
Many impacket commands support hashes rather than plaintext passwords by using the -hashes FULLNTLMHASH
GetADUsers
GetADUsers enumerates target domain for user data
Requires credentials or hash
impacket-GetADUsers -all DOMAIN/USERNAME -dc-ip DCIPADDR