CVE detail

CVE-2009-3767

OpenLDAP vulnerable to SSL certificate spoofing attacks

MediumModified
CVSS4.3
EPSS
Exploitability5
Exploit refs0

Summary

OpenLDAP fails to properly validate X.509 certificates when using OpenSSL, allowing a null byte in the Common Name to bypass hostname matching. This enables man-in-the-middle attacks via a crafted certificate from a legitimate CA.

Published

Oct 24, 2009

Last modified

Jun 17, 2026

CWE

CWE-295 · Improper Certificate Validation

Affected product

cpe:2.3:a:openldap:openldap:*:*:*:*:*:*:*:* cpe:2.3:o:apple:mac_os_x:*:*:*:*:*:*:*:* cpe:2.3:o:fedoraproject:fedora:11:*:*:*:*:*:*:*

Why exploitable

Why Exploitable

The CVE-2009-3767 vulnerability is exploitable due to the improper handling of a '\0' character in a domain name in the subject's Common Name (CN) field of an X.509 certificate by OpenLDAP libraries. This allows man-in-the-middle attackers to spoof arbitrary SSL servers via a crafted certificate.

Key factors affecting exploitability:

  • EPSS (empirical exploitation probability) is not available, making it difficult to gauge the likelihood of exploitation.
  • The absence of public exploit/PoC references and CISA KEV listing reduces the perceived urgency. However, organizations should still validate their OpenLDAP versions and update to a patched version to prevent potential man-in-the-middle attacks.

Technical details

Overview

CVE-2009-3767 is a medium-severity vulnerability in OpenLDAP versions 2.2 and 2.4 (and possibly others) when using OpenSSL for TLS. The flaw lies in the improper validation of X.509 certificate subject Common Name (CN) fields containing a null byte (\\0). An attacker can exploit this by obtaining a certificate from a legitimate Certificate Authority (CA) with a crafted CN that includes a null byte, effectively truncating the hostname check. This allows the attacker to impersonate arbitrary SSL servers in a man-in-the-middle (MITM) scenario. The issue is related to CVE-2009-2408, which affects other software with similar null-byte handling problems. The vulnerability was disclosed in 2009 and affects multiple Linux distributions including Debian, Fedora, Red Hat, Gentoo, Oracle, and CBL Mariner. The CVSS base score is 4.3 (medium), but the EPSS percentile of 86.1 indicates high exploitation likelihood. Security teams should prioritize patching systems using OpenLDAP with OpenSSL for LDAP over TLS.

Technical details

The root cause is in the file libraries/libldap/tls_o.c in OpenLDAP. When OpenSSL is used for TLS, the certificate hostname verification logic does not properly handle null bytes in the CN field of an X.509 certificate. Specifically, the code uses string comparison functions that stop at a null byte, so a CN like example.com\\0.attacker.com would be treated as matching example.com because the comparison stops at the null. This bypasses the intended hostname check. The vulnerability affects OpenLDAP versions 2.2 and 2.4, and potentially other versions. The attack prerequisites include:

  • The attacker must be able to obtain a certificate from a legitimate CA with a crafted CN containing a null byte.
  • The attacker must be in a position to intercept and modify network traffic (MITM).
  • The target OpenLDAP client or server must be configured to use TLS with OpenSSL and verify certificates.

The weakness is classified as CWE-295: Improper Certificate Validation. The trust boundary is between the LDAP client and server; the attacker exploits the trust placed in the CA by using a certificate that appears valid but has a maliciously crafted CN.

Impact

Successful exploitation allows an attacker to perform MITM attacks against LDAP connections, potentially intercepting or modifying authentication credentials, directory data, and other sensitive information. The impact on confidentiality and integrity is high, as the attacker can read and alter LDAP traffic. Availability is not directly affected. Downstream abuse scenarios include:

  • Stealing LDAP credentials for further network compromise.
  • Modifying directory entries to escalate privileges or redirect services.
  • Impersonating LDAP servers to distribute malicious data.

For defenders, this vulnerability is critical in environments where OpenLDAP is used for authentication (e.g., single sign-on, directory services). The business exposure includes unauthorized access to sensitive systems and data.

Exploitation steps

  1. Attacker registers a domain name that includes a null byte in the CN, e.g., target.com\\0.evil.com, and obtains a valid X.509 certificate from a legitimate CA for that domain.
  2. Attacker positions themselves on the network path between the victim LDAP client and the legitimate LDAP server (e.g., via ARP spoofing, rogue Wi-Fi, or compromised router).
  3. Victim LDAP client initiates a TLS connection to the legitimate LDAP server (e.g., ldap://ldap.target.com).
  4. Attacker intercepts the connection and presents the crafted certificate with CN target.com\\0.evil.com.
  5. OpenLDAP's certificate validation routine compares the CN against the expected hostname (target.com) using a string function that stops at the null byte, incorrectly matching target.com.
  6. The client accepts the certificate and establishes a TLS session with the attacker.
  7. Attacker can now decrypt, read, and modify LDAP traffic between the client and the real server (by forwarding the connection).
  8. Attacker captures credentials or directory data, or injects malicious responses.

Indicators of compromise

  • TLS certificates with CN fields containing null bytes (visible in hex dump as 00).
  • LDAP connections that unexpectedly succeed with certificates from unexpected CAs.
  • Network traffic showing LDAP over TLS sessions with unusual certificate chains.
  • Log entries indicating certificate validation warnings or errors (e.g., "hostname mismatch" but connection still established).
  • EDR alerts for processes using OpenLDAP libraries (libldap) making TLS connections to unexpected IPs.
  • DNS queries for domains with null bytes (unlikely but possible in some logging).
  • Unusual LDAP queries or modifications that deviate from normal patterns.
  • MITM tool artifacts (e.g., ARP cache changes, rogue DHCP offers).

Mitigation and workarounds

  • Patch OpenLDAP: Upgrade to a fixed version. Most Linux distributions released patches in 2009. For example:
    • Debian: upgrade to libldap-2.4-2 version 2.4.11-1+lenny1 or later.
    • Red Hat: update openldap packages to versions that include the fix.
    • Gentoo: emerge =net-nds/openldap-2.4.15 or later.
  • Compensating controls:
    • Use certificate pinning or strict hostname verification if supported.
    • Implement network segmentation to limit MITM opportunities.
    • Monitor for anomalous LDAP traffic and certificate changes.
    • Use alternative TLS libraries (e.g., GnuTLS) if OpenSSL is not required.
  • Workaround: If patching is not immediately possible, disable TLS certificate verification (not recommended) or restrict LDAP connections to trusted networks.

Community reactions

The vulnerability was widely discussed in security advisories from major Linux vendors. Red Hat issued RHSA-2009:1462, Debian released DSA-1911-1, and Gentoo published GLSA 200911-02. The issue was also covered by security news outlets as part of the broader null-byte certificate validation problem (CVE-2009-2408). The community emphasized the need for proper null-byte handling in certificate validation routines. OpenLDAP developers released patches quickly, and most distributions backported fixes. The vulnerability is considered a classic example of improper input validation in security-critical code.

Additional resources

References

Intelligence is provided for awareness and triage. Validate exposure in your own environment before prioritising remediation.

CVE-2009-3767 · OpenLDAP vulnerable to SSL certificate spoofing attacks | CVE Intelligence | Trusteed