Skip to content
AdminKit

Is port 389 (LDAP) exposed to the internet, and is anonymous bind on?

Port 389 is the default port for LDAP, the protocol most directory services use to look up users and groups. LDAP allows an unauthenticated "anonymous bind," and even an authenticated bind can send the password in clear text. AdminKit's port-check tool automates nine exposure checks; 389 isn't on that list, so here's how to confirm it yourself.

By AdminKit team, Netbase JSC · Updated

Key takeaways

  • Port 389 carries LDAP, the lookup protocol behind Active Directory, OpenLDAP and most other directories. It rarely has a reason to answer the public internet.
  • LDAP defines anonymous binds and clear-text simple binds as normal features. Every server must support anonymous bind, and OpenLDAP enables it by default with a default policy of read access for all.
  • An anonymous search can return the whole directory tree: user names, groups and organizational structure. A simple bind over plain 389 hands the password to anyone on the path.
  • Windows Server 2025 requires LDAP signing by default only for new deployments. Older and upgraded domains accept unsigned binds unless an administrator changes the policy.
  • Test from outside with ldapsearch: a root DSE answer means the listener is exposed, and entries from an anonymous subtree search mean the directory is too.

Why shouldn’t port 389 face the internet?

IANA registers port 389 for LDAP, the Lightweight Directory Access Protocol that Active Directory and most other directory services use for lookups and authentication. RFC 4511, the protocol specification, defines several bind mechanisms, including an anonymous bind that requires no credential at all, and a simple bind that — on a plain, non-TLS connection — transmits the bind DN and password in clear text. Both are legitimate protocol features for an internal, trusted network; neither is something you want answering requests from the open internet.

Directory servers usually listen on more than one port, and each one is a separate exposure question:

PortIANA nameWhat it carries
389/tcpldapLDAP in clear text, upgradable to TLS with StartTLS
389/udpldapConnection-less LDAP (CLDAP), moved to Historic status by RFC 3352
636/tcpldapsLDAP inside TLS from the first byte
3268/tcpmsft-gcActive Directory Global Catalog
3269/tcpmsft-gc-sslGlobal Catalog over TLS

A firewall rule that closes 389 but leaves 3268 open still exposes a forest-wide view of an Active Directory domain, so check them together.

What bind types does LDAP allow?

RFC 4513 sets out the authentication methods, and it makes one of them mandatory: LDAP server implementations must support the anonymous mechanism of the simple bind. Whether a given server lets anonymous sessions read anything is a configuration decision, not a protocol one.

BindWhat the client sendsWhat the RFC says
AnonymousNo name, no passwordServers must support it
UnauthenticatedA name with an empty passwordServers should fail it by default; the name is not checked
Name/passwordA DN and password, in clear text unless TLS is activeNeeds TLS to be safe on any untrusted path
SASLA negotiated mechanism, such as EXTERNAL with a client certificateCan provide integrity and encryption of its own

The unauthenticated row exists because of a common client bug: an application that sends a user name with an empty password gets an anonymous session rather than a failure, and may treat that as a successful login. The RFC therefore asks servers to reject that bind by default.

OpenLDAP shows how these defaults land on a real server. Its administrator’s guide on security considerations says slapd listens on both the IPv4 and IPv6 “any” addresses by default, that the anonymous bind mechanism is enabled by default, and that the unauthenticated mechanism is disabled by default. It also warns that disallow bind_anon alone does not stop anonymous access to the directory; that takes require authc. The access control chapter states that the default access control policy is to allow read by all clients.

What does an exposed, misconfigured port 389 give away?

If anonymous bind is enabled on a reachable server, anyone who connects can typically enumerate the entire directory: usernames, group memberships, organizational units, and any descriptive attributes administrators have populated — sometimes including credentials or hints that were never meant to be queryable without authentication. The same pre-authentication information leak shows up in other enterprise listeners too — an exposed Oracle database listener confirms the database and its service names before any credential is ever checked. On a plain (non-TLS) simple bind, credentials pass across the wire unencrypted, so anyone positioned to observe the traffic path can recover a working login. Microsoft’s own guidance on LDAP signing and LDAP channel binding exists specifically to close the follow-on risk: an unsigned LDAP session can also be relayed by an attacker positioned on the network path, turning a single intercepted or relayed bind into broader access across the domain.

Even a directory that refuses anonymous searches usually tells a stranger something. RFC 4512 defines the root DSE, an entry each server provides about itself, with attributes such as namingContexts, the supported controls and extensions, and the supported SASL mechanisms. Many servers return it before any bind, because clients use it to discover what the server can do. For an attacker, namingContexts names the domain or base DN to target next, and the mechanism list shows which login methods to try.

What does Active Directory enforce by default?

Microsoft’s signing and channel binding pages set out defaults that differ by Windows Server version and by whether the domain is new:

SettingWindows Server 2022 or earlierNew deployment on Windows Server 2025 or later
Server LDAP signingOptional; signed and unsigned binds acceptedRequired by default
Channel binding (LdapEnforceChannelBinding)NeverWhen supported, with auditing

When signing is enforced, a domain controller rejects SASL binds that do not request signing and simple binds over unencrypted connections. Signing protects integrity, not confidentiality; the signing page notes that attackers can still read unencrypted traffic. Channel binding ties an LDAPS session to the TLS channel so a relayed NTLM authentication can be told apart from a real one. A domain that was upgraded rather than built on 2025 keeps the older behaviour, which is why Microsoft’s migration path starts with event monitoring: Event IDs 2887 and 2889 identify clients still making unsigned or clear-text binds.

How do you check your own exposure?

AdminKit’s open ports check checks a fixed nine-port list, and port 389 isn’t on it — confirm this one manually with a TCP-aware check such as nc -vz -w 3 203.0.113.5 389 run from outside your network, after confirming your public IP with what is my IP. A directory server can be fully patched and still be reachable on 389 from outside simply because of a firewall rule or port-forward nobody remembers adding — worth confirming directly rather than assuming the perimeter is closed. The AdminKit tool tests only the address your browser connects from and only over TCP, so the UDP side of 389 needs checking at the firewall itself.

With the OpenLDAP client tools on an outside machine, two searches show how much the directory gives a stranger. The first reads the root DSE; the second tries an anonymous subtree search under the naming context it returned (dc=example,dc=com here):

$ ldapsearch -x -H ldap://203.0.113.5 -b "" -s base namingContexts supportedSASLMechanisms
$ ldapsearch -x -H ldap://203.0.113.5 -b "dc=example,dc=com" -s sub "(objectClass=person)" cn

Example results (illustrative; documentation address and domain, text varies by server):

ResultWhat it means
namingContexts: dc=example,dc=com from the first searchThe listener is exposed and has named its base DN.
Person entries from the second searchAnonymous read is on. The directory’s contents are public.
Operations error with a note that a successful bind must be completedTypical of Active Directory: anonymous search refused, root DSE still answered.
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)Nothing reachable on 389 from where you tested.

Repeat the first search against ldaps://203.0.113.5 and port 3268 to cover the other listeners.

How do you confirm the listener on your own host?

On a Linux directory server, list the sockets, then read the running OpenLDAP configuration over the local socket as root:

$ ss -ltnp | grep -E ':(389|636) '
LISTEN 0  2048  0.0.0.0:389  0.0.0.0:*  users:(("slapd",pid=702,fd=8))
LISTEN 0  2048  [::]:389     [::]:*     users:(("slapd",pid=702,fd=9))

$ sudo ldapsearch -Q -Y EXTERNAL -H ldapi:/// -b cn=config -s base olcDisallows olcRequires olcSecurity

The ss lines are an example of the OpenLDAP default: every IPv4 and IPv6 address. Missing olcDisallows and olcRequires values mean anonymous binds are allowed and nothing requires authentication. On a Windows domain controller, netstat -ano | findstr ":389" shows the same thing, and the Directory Service event log shows whether events 2886 and 2887 are being logged.

How do you fix an exposed LDAP directory?

  • Block port 389 at your perimeter firewall so directory lookups are only reachable from your internal network or over a VPN — a directory service almost never needs to answer LDAP queries from the public internet directly. Close UDP 389, 636 and 3268–3269 in the same rule set.
  • Disable anonymous bind on the directory server unless a specific, reviewed application genuinely requires it, and on OpenLDAP require authentication as well.
  • Require LDAPS (port 636) or StartTLS for any bind, so credentials and query results aren’t sent in clear text even on paths you do trust.
  • On Active Directory, enable LDAP signing and channel binding enforcement so unsigned or unprotected binds are rejected outright, closing the relay risk Microsoft’s guidance describes.
  • Bind the server to internal addresses only, so a firewall mistake does not expose it.

For OpenLDAP configured with slapd.conf, the settings from the administrator’s guide look like this, with slapd started on an internal address plus the local socket:

# slapd.conf
disallow bind_anon
require authc
security ssf=128

# start-up listeners
slapd -h "ldap://10.0.2.60/ ldaps://10.0.2.60/ ldapi:///"

security ssf=128 refuses operations on sessions without strong protection, so plain binds must use StartTLS or LDAPS. The same exposure logic applies to other management protocols that were built for trusted networks, such as SNMP on port 161.

Which servers may you test with these checks?

Every check this page links to is for assets you own or are explicitly authorized to test. Never scan, probe, or attempt to connect to a network or device you don’t control — AdminKit’s active checks only ever run against the IP making the request or an asset you’ve verified ownership of. See our Disclaimer and Acceptable Use Policy for the full terms.

This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.

Frequently asked questions

Does AdminKit's port-check tool scan port 389?

No. The tool checks a fixed list of nine specific TCP ports (23, 554, 1883, 8883, 502, 7547, 80, 443, 8080) chosen for how often they turn up misconfigured on home and small-office devices — see the port-check tool page for the current list. 389 isn't on that list, so confirm your own exposure with the manual check below.

Is LDAP itself insecure, or only specific configurations?

The protocol itself, as defined in RFC 4511, supports an anonymous (unauthenticated) bind and a simple bind that sends credentials in clear text unless the session is wrapped in TLS or StartTLS. Neither is a bug — they're options the protocol allows — but either one reachable from the public internet turns a normal administrative feature into an open door.

Why would anonymous bind be enabled in the first place?

Often because it is the default. OpenLDAP's administrator's guide says the anonymous bind mechanism is enabled by default and that its default access policy allows read by all clients. It is also turned on deliberately for legacy applications that don't support authenticated binds, or left over from a test configuration that was never locked down before the server became reachable from outside the network.

What has Microsoft done about this on Active Directory specifically?

Microsoft's documentation says Windows Server 2025 and later require LDAP signing by default for new Active Directory deployments, which rejects unsigned SASL binds and clear-text simple binds. Windows Server 2022 and earlier make signing optional by default, and channel binding defaults to Never on 2022 and earlier and to When supported on new 2025 deployments, so most existing domains need these settings changed by hand.

What's the fastest fix if I find my own directory server's port 389 open to the internet?

Block port 389 at the perimeter firewall so it's only reachable from your internal network or a VPN, disable anonymous bind on the directory server if it's enabled, and require LDAPS (port 636) or StartTLS for any bind that does need to cross an untrusted network.

Want AdminKit to watch this for you?

Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.

Huy Nguyen (David), Founder and CEO of Netbase JSC

Talk to an expert

Huy Nguyen (David), Founder & CEO, Netbase JSC

Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.