notmalicio.us
04 · active directory

LDAP

4 sections · 1 min read · ~/playbook/ldap

LDAP Authentication

  1. User sends AD username and password to the application
  2. Application sends its own credentials to Domain Controller to create a LDAP bind request
  3. Domain Controller provides bind response
  4. Application asks for the user's information, which Domain Controller responds with
  5. Application sends LDAP Bind request with user credentials
  6. Domain Controller responds with LDAP Bind response
  7. 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
esc
↑↓ navigate↵ openesc close