Skip to content

Port reference

Port 389 (TCP/UDP) – LDAP

LDAP — the cleartext directory query protocol used to read and write Active Directory.

tcpudpWell-knownCommonly attacked

Default state

Open on every Active Directory domain controller. Cleartext by default; should not be exposed to untrusted networks.

Common attacks

  • Anonymous and unauthenticated bind enumeration
  • Directory enumeration (users, groups, SPNs, ACLs)
  • LDAP relay (NTLM relay to LDAP)
  • Credential sniffing of cleartext simple binds

Hardening

  • Prefer LDAPS (636) or StartTLS; avoid cleartext simple binds
  • Enforce LDAP signing and channel binding to defeat relay
  • Disable anonymous binds
  • Restrict 389 to trusted management networks
  • Monitor for bulk/abnormal LDAP queries (BloodHound-style)

nmap snippet

nmap -p389 --script ldap-rootdse,ldap-search <target>

Replace <target> with the host or range you're authorized to scan.

What runs on port 389?

Port 389 is the default for LDAP (Lightweight Directory Access Protocol), the query protocol that reads and writes the directory. In Windows environments that directory is Active Directory: every domain controller exposes LDAP on 389 so clients, applications, and administrators can look up users, groups, computers, service principal names, and the access-control structure of the domain. By default this traffic is cleartext.

Why it matters for security

LDAP is the map of an Active Directory environment, so read access alone is powerful — attackers use it to enumerate every account, group membership, and privilege relationship. Worse, plain 389 is unencrypted, exposing simple-bind passwords to network sniffing, and many directories still permit anonymous binds. LDAP is also a prime relay target: coerced NTLM authentication relayed to LDAP can be used to grant rights or add a computer for RBCD-based escalation.

How it's attacked

Tools like BloodHound query LDAP to enumerate users, groups, SPNs (for Kerberoasting targeting), and dangerous ACLs across the whole domain. Where anonymous bind is allowed, this needs no credentials at all. Captured NTLM authentication is relayed to LDAP to modify directory objects, and cleartext simple-bind credentials are sniffed straight off the wire.

Hardening checklist

Move clients to LDAPS (636) or StartTLS and stop accepting cleartext simple binds. Enforce LDAP signing and channel binding on domain controllers to defeat relay. Disable anonymous binds. Restrict port 389 to trusted management networks and alert on bulk or unusual query patterns that signal directory enumeration. The nmap scripts above read the RootDSE and run a directory search on systems you are authorized to test.

Related ports

Frequently asked questions

What is port 389 used for?
Port 389 is LDAP, the protocol clients and applications use to query and modify the Active Directory database — looking up users, groups, computers, and policies.
Is LDAP on port 389 encrypted?
No. Plain LDAP on 389 is cleartext, so simple-bind credentials and directory data can be sniffed. Use LDAPS on 636 or StartTLS for encryption.