How LDAP Works: Bind, Search & Active Directory Security (Animated)
LDAP is how applications talk to a directory such as Microsoft Active Directory: “Is this password right?”, “Which groups is Priya in?”, “List all computers.” Almost every corporate login touches LDAP, so SOC teams watch it closely.
1. Bind: the app logs in to the directory
The intranet app first logs in (binds) to the domain controller with its own service account.
- bindRequest (Intranet app → Domain controller): A
simple bindon port 389 sends the account’s password unencrypted. Keep this in mind for the attack chapter. - bindResponse (Domain controller → Intranet app): The app is now logged in to the directory.
Wireshark filter:
ldap.protocolOp == 0
2. Search: find the user and their groups
When Priya logs in to the app, it searches the directory for her account, then tries her password with a second bind.
- LOGIN (User PC → Intranet app): Priya types her domain password into the intranet app.
- searchRequest (Intranet app → Domain controller): The app asks for Priya’s entry and her group memberships.
- searchResEntry (Domain controller → Intranet app): The directory returns her entry. Group membership decides what she may see in the app.
- bindRequest (Intranet app → Domain controller): To check the password, the app binds as Priya.
- bindResponse (Domain controller → Intranet app): Correct password: Priya is in.
Wireshark filter:
ldap.protocolOp == 3
3. Exposed binds & mapping: attack: reading passwords and the whole directory
Two weaknesses. Clear-text binds on 389 expose every password to anyone who can capture the traffic. And by default any domain account can read most of the directory, so one stolen low-level login lets an attacker list every user, admin group and server.
- CAPTURED (Intranet app → Attacker): Capturing the app’s traffic reveals the service account password in readable form.
- searchRequest (Attacker → Domain controller): With any valid login, the attacker asks for everything.
- searchResEntry (Domain controller → Attacker): The directory obliges. The attacker now knows exactly whose accounts are worth targeting.
Wireshark filter:
ldap.authentication.simple
4. Ldaps & signing: defence: encrypt, sign, watch
Require LDAP signing and channel binding, move apps to LDAPS (636), lock down what ordinary accounts can read, and alert on one account pulling thousands of directory objects.
- bindRequest (Intranet app → Domain controller): Unsigned clear-text binds are now refused.
- LDAPS (Intranet app → Domain controller): The app reconnects over LDAPS; a sniffer sees only encrypted bytes.
Group policy:
Domain controller: LDAP server signing requirements = Require signing LDAP server channel binding token requirements = Always
Practise this in a real lab
Query a lab Active Directory with ldapsearch, capture clear-text binds in Wireshark, then enforce LDAP signing and LDAPS and watch them fail.
Explore ER Segment training →FAQ
What is the difference between LDAP and Active Directory?
Active Directory is Microsoft’s directory service. LDAP is one of the protocols used to read and update it.
Which ports does LDAP use?
389 for LDAP (clear text unless signed or upgraded with StartTLS), 636 for LDAPS (TLS), 3268/3269 for the Global Catalog.
What is a bind?
The LDAP word for logging in to the directory.