Port 389: LDAP (Lightweight Directory Access Protocol)
What port 389 (TCP/UDP) does, the security risks of leaving it open, and how to secure and test it.
| Port | 389 |
|---|---|
| Transport | TCP/UDP |
| Service | Lightweight Directory Access Protocol (LDAP) |
| Encrypted | Optional (StartTLS) |
What is port 389?
LDAP is how applications query and update directories such as Microsoft Active Directory: users, groups and computers.
Common uses
- Applications checking usernames and passwords against Active Directory
- Looking up users and group membership
Security risks
- Simple binds send passwords in plain text
- Anonymous binds leaking directory information
- LDAP relay attacks in Windows domains
How to secure port 389
- Use LDAPS on port 636 or require StartTLS
- Require LDAP signing and channel binding on domain controllers
- Disable anonymous binds
- Never expose LDAP to the internet
How to check if port 389 is open
| Where | Command |
|---|---|
| Scan from another machine | nmap -p 389 <host> |
| Windows (PowerShell) | Test-NetConnection <host> -Port 389 |
| Linux (what is listening) | sudo ss -tulpn | grep :389 |
| Windows (what is listening) | netstat -ano | findstr :389 |
Only scan systems you own or have permission to test.
Example: block it at the internet edge (Cisco)
For a service that should stay inside your network, deny it on the internet-facing interface. Put the rule before any broader permit statements:
ip access-list extended INTERNET-IN
remark Block LDAP from the internet
deny tcp any any eq 389
permit ip any any
!
interface GigabitEthernet0/0
ip access-group INTERNET-IN inIn a real network the final line would be your normal inbound policy, not "permit ip any any". Build and check rules with the ACL builder.
Related ports
Frequently asked questions
What is port 389 used for?
Port 389 (TCP/UDP) is used by Lightweight Directory Access Protocol (LDAP). LDAP is how applications query and update directories such as Microsoft Active Directory: users, groups and computers.
Is it safe to open port 389?
Only if the service needs to be reached and is configured securely. Use LDAPS on port 636 or require StartTLS.
How do I check if port 389 is open?
From another computer, run nmap -p 389 followed by the host address. On the server itself, ss -tulpn on Linux or netstat -ano on Windows shows whether anything is listening on 389.
Learn more: TCP, UDP and ports explained and firewall basics.