LDAP Brute Force and Password Spraying
LDAP binds authenticate credentials directly against the directory. This makes LDAP a reliable channel for password spraying and brute forcing — a successful bind means the credentials are valid domain credentials usable across all services. Always check the password policy before attempting any credential attacks to avoid account lockouts.
Check lockout policy first
Never spray or brute force before confirming the lockout threshold. A single miscalculation here locks out accounts across the entire domain.
lockoutThreshold: 5 lockoutDuration: -18000000000 lockoutObservationWindow: -18000000000
lockoutThreshold: 5 means 5 failed attempts locks the account. lockoutDuration and lockoutObservationWindow in negative values are intervals — divide by -10000000 to get seconds. A value of -18000000000 is 1800 seconds (30 minutes). With a threshold of 5 and 30-minute window, you can attempt 4 passwords per account per 30 minutes safely.
lockoutThreshold: 0 means no lockout — brute force freely.
Password spraying with nxc
Spraying tests one password against many accounts. It is the safest approach when a lockout policy exists — one attempt per account stays well under any threshold.
LDAP 10.10.10.10 389 DC01 [-] corp.local\jsmith:Password123! LDAP 10.10.10.10 389 DC01 [-] corp.local\tharris:Password123! LDAP 10.10.10.10 389 DC01 [+] corp.local\mwilson:Password123!
A [+] result means valid credentials. STATUS_ACCOUNT_LOCKED_OUT in the output means you have triggered a lockout — stop immediately and wait for the observation window to reset. STATUS_PASSWORD_MUST_CHANGE means valid credentials but the password has expired.
Username enumeration without credentials
On some configurations, LDAP returns different error codes for valid versus invalid usernames even when authentication fails. This allows username enumeration before spraying.
Targeted brute force — single account, no lockout
Only run a full brute force when lockout is confirmed as disabled or when targeting a specific account with confirmed no-lockout policy (service accounts sometimes have this configured).
Hydra's ldap2 module uses simple bind authentication. On Active Directory this works for domain accounts. On OpenLDAP use the full DN format: -l "cn=admin,dc=corp,dc=local".
Username list sources
A targeted username list dramatically improves spray success rate over a generic wordlist. Build it from LDAP anonymous enumeration, OSINT, email patterns, or SMB null sessions before spraying.
References
-
NetExec — GitHubgithub.com/Pennyw0rth/NetExec (opens in new tab)
LDAP password spraying and pass-pol module
-
kerbrute — GitHubgithub.com/ropnop/kerbrute (opens in new tab)
Fast Kerberos-based username enumeration and spraying
Was this helpful?
Your feedback helps improve this page.