Page cover
For the complete documentation index, see llms.txt. This page is also available as Markdown.

LDAP | 389, 636

LDAP typically uses port 389 for unencrypted communication and port 636 for encrypted connections (LDAPS). While 389 is the default for unencrypted LDAP, 636 is the standard for LDAP over SSL/TLS.

 ## ------------------| Brute Force
 hydra -l UserName -P Passwordlist $IP ldap2 -V -f

01. ldapsearch

#  -x Simple Authentication
#  -D UserName
#  -w Password
#  -b Base site

## ------------------| Simple Auth
ldapsearch -x -H ldap://$IP 

## ------------------| Get LDAP Naming Context (DN)
ldapsearch -x -s base namingcontexts -H ldap://$IP

## ------------------| Enum 
ldapsearch -x -b "DC=<SUBDOMAIN>,DC=<TDL>" -H ldap://$IP
ldapsearch -x -b "DC=<SUBDOMAIN>,DC=<TDL>" -H ldap://$IP -D '<DOMAIN>\<USER>' -w 'PassWord'
ldapsearch -x -b "DC=<SUBDOMAIN>,DC=<TDL>" -H ldap://$IP -D '<DOMAIN>\ldap' -w 'PassWord'

## ------------------| Queries
ldapsearch -x -H ldap://$IP -b "DC=htb,DC=local" '(objectClass=Person)'
ldapsearch -x -H ldap://$IP -b "DC=htb,DC=local" '(objectClass=User)' sAMAccountName | grep sAMAccountName  

## ------------------| Grep only domain admins
ldapsearch -x -H ldap://$IP -b "DC=HTB,DC=LOCAL"  -D '<DOMAIN>\<USER>' -w 'Ashare1972' "(&(ObjectClass=user)(memberOf=CN=Domain Admins,CN=Users,DC=htb,DC=local))" | grep sAMAccountName        

## ------------------| Extract users
ldapsearch -x -b "DC=HTB,DC=LOCAL" "*" -H ldap://$IP  | grep dn | awk -F\, '{print $1}' | awk -F\= '{print $2}'
-b "CN=Users,DC=<SUBDOMAIN>,DC=<TDL>"

## ------------------| Extract computers
-b "CN=Computers,DC=<SUBDOMAIN>,DC=<TDL>"       

## ------------------| Extract self info
 -b "CN=<MY NAME>,CN=Users,DC=<SUBDOMAIN>,DC=<TDL>"

## ------------------| Extract Domain Admins
-b "CN=Domain Admins,CN=Users,DC=<SUBDOMAIN>,DC=<TDL>"

## ------------------| Extract Domain Users
-b "CN=Domain Users,CN=Users,DC=<SUBDOMAIN>,DC=<TDL>"

## ------------------| Extract Enterprise Admins
-b "CN=Enterprise Admins,CN=Users,DC=<SUBDOMAIN>,DC=<TDL>"

## ------------------| Extract Administrators
-b "CN=Administrators,CN=Builtin,DC=<SUBDOMAIN>,DC=<TDL>"

## ------------------| Extract Remote Desktop Group
-b "CN=Remote Desktop Users,CN=Builtin,DC=<SUBDOMAIN>,DC=<TDL>"      

02. WindapSearch

03. Kerbrute

04. NetExec

05. LDAPDomainDump

Last updated