TCP Dangerous Directory

Port 389 (LDAP)

Learn about port 389 (LDAP) - security risks, vulnerabilities, and common uses. Find devices with port 389 open.

Quick Info

Port Number
389
Protocol
TCP
Service
LDAP
IANA Name
LDAP

Service Description

Network port 389 (TCP) is the standard port for the Lightweight Directory Access Protocol (LDAP). LDAP is an open, vendor-neutral, industry-standard application protocol for accessing and maintaining distributed directory information services over an Internet Protocol (IP) network. It acts as a 'phone book' for computers, allowing them to look up information such as usernames, passwords, email addresses, and access privileges. Originally derived from the X.500 directory standard, LDAP offers a simplified and more efficient method for accessing directory services. It operates on a client-server model, where the LDAP client sends requests (e.g., search, bind, add, modify) to the LDAP server, which then processes the request and returns the results. The LDAP data is typically organized in a hierarchical, tree-like structure called the Directory Information Tree (DIT). Each entry in the DIT is composed of attributes, which define the characteristics of the entry. The protocol uses distinguished names (DNs) to uniquely identify each entry within the directory. Operations are authenticated, often using simple authentication, SASL, or TLS/SSL encryption to protect credentials during transmission.

At a technical level, an LDAP client initiates a connection to the LDAP server on port 389. The client then sends a bind request, which authenticates the client with the server. Once authenticated, the client can perform various operations, such as searching for entries, adding new entries, modifying existing entries, or deleting entries. The server processes the request and returns a response to the client. The communication between the client and server is done using a binary protocol encoded using Basic Encoding Rules (BER). For secure communication, LDAP can be run over TLS/SSL, which is referred to as LDAPS (Lightweight Directory Access Protocol Secure) and commonly uses port 636, though port 389 can also be used with STARTTLS to upgrade the connection to TLS. LDAP is a critical component in many enterprise networks, facilitating centralized user management, authentication, and authorization.

## Firewall Recommendations

Whether to allow or block port 389 depends on the network architecture and whether LDAP services are required. If LDAP is used internally, the port should be restricted to only allow access from trusted internal networks. External access should be carefully considered and generally avoided, or secured with LDAPS (port 636) or STARTTLS. Firewall rules should be configured to limit connections to only the necessary source IP addresses or networks. Intrusion detection and prevention systems (IDS/IPS) should be deployed to monitor LDAP traffic for suspicious activity, such as LDAP injection attempts or excessive bind requests. It is highly recommended to enforce LDAPS (port 636) or STARTTLS to encrypt LDAP traffic and protect credentials from eavesdropping. Regularly audit and update LDAP server configurations to ensure they are secure and compliant with security best practices. Disable anonymous binds if possible and enforce strong password policies for LDAP accounts.

Security Information

LDAP, while a powerful directory service protocol, presents several security risks if not properly configured and maintained. Common attack vectors include anonymous binds, which allow unauthenticated users to query the directory, potentially exposing sensitive information. Weak or default passwords can be easily compromised, granting attackers access to the entire directory. LDAP injection attacks, similar to SQL injection, can occur when user-supplied input is not properly sanitized, allowing attackers to execute arbitrary LDAP commands. Unencrypted LDAP traffic transmits data in plaintext, making it vulnerable to eavesdropping and credential theft. Denial-of-service (DoS) attacks can overload the LDAP server, rendering it unavailable. Attackers target LDAP servers because they often hold critical user and system information, making them a valuable target for gaining unauthorized access to other systems and data within the network. Compromising an LDAP server can provide attackers with a foothold to escalate privileges and move laterally throughout the network.

Known Vulnerabilities

CVE Name Severity Description
CVE-2020-25647 OpenLDAP slapd buffer overflow High Уязвимость переполнения буфера в OpenLDAP slapd позволяет локальному злоумышленнику вызвать отказ в обслуживании или выполнить произвольный код.
CVE-2017-17735 389 Directory Server denial of service Medium Уязвимость в 389 Directory Server приводит к отказу в обслуживании из-за недостаточной проверки входных данных.
CVE-2023-38425 OpenLDAP Assertion Failure Low OpenLDAP Assertion Failure при обработке плохо сформированных фильтров

Common Software

  • OpenLDAP
  • Microsoft Active Directory
  • Apache Directory Server
  • 389 Directory Server
  • FreeIPA
  • Red Hat Directory Server
  • IBM Security Directory Server
  • Oracle Directory Server
  • Novell eDirectory

Find devices with this port

Discover all devices with port 389 open in any country.

Search Port 389

Find all devices with port 389 open

ScaniteX scans millions of IPs to find devices with specific ports open. Perfect for security research and network auditing.

Start Mass Scanning