LDAP (Lightweight Directory Access Protocol) Pentesting
Enumeration
# Nmap
nmap --script ldap-brute --script-args ldap.base='"cn=users,dc=cqure,dc=net"' -p 389 <target-ip>
nmap --script ldap-search -p 389 <target-ip>
nmap --script ldap-* -p 389 <target-ip>
nmap --script "ldap* and not brute" -p 389 <target-ip>
# NetExec
# -k: Use Kerberos authentication
netexec ldap <target-ip> -u usernames.txt -k
# --trusted-for-delegation: Enumerate computers and users with the flag `TRUSTED_FOR_DELEGATION`
# reference: https://learn.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties#property-flag-descriptions
netexec ldap <target-ip> -u username -p password --trusted-for-delegation
# Users
ldapsearch -x -H ldap://10.0.0.1 -D "username@example.local" -w "password" -b "dc=example,dc=local" "(objectclass=user)" sAMAccountName memberOf
# Groups
ldapsearch -x -H ldap://10.0.0.1 -D "username@example.local" -w "password" -b "dc=example,dc=local" "(objectClass=group)" name memberDump Active Directory Information
Connect
AD CS (Active Directory Certificate Services)
LAPS (Local Administrator Password Solution)
Pass-Back Attack
Host Rogue LDAP Server
Last updated