Skip to content
Info disclosure Write-up Beginner

Exploiting LDAP Server NULL Bind

An LDAP server allowed anonymous binding, which let the attacker read all directory objects including password hashes and SSH public keys. The attacker could crack the password hashes and potentially modify SSH keys to gain access to other systems.

n00py.io

Published on n00py.io

I was recently on a penetration test that was completely locked down, I was completely alone in my subnet, and almost all of my scope targets were firewalled off. After running a bunch of port scans, I was left only with a few SSH services on port 22, and one Secure LDAP server on port 636.

The author, on n00py.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the LDAP server was misconfigured to allow anonymous bind and did not restrict access to sensitive attributes like userPassword and sshPublicKey.

Impact

The attacker could read password hashes and crack them, then use the credentials to authenticate to other exposed systems; if the attacker could also modify the sshPublicKey attribute, they could add their own key and log in to systems that only allow key-based authentication.

What the attacker needed

Network access to LDAP port 636; LDAP server allows anonymous bind; Sensitive attributes readable anonymously

How it was found

  1. Scan the target with Nmap version detection to find an LDAP server that reports anonymous bind OK.
  2. Use a Python script with the ldap3 library to create a server object and connect without credentials.
  3. Bind anonymously and retrieve the server's naming context from the DSE.
  4. Search the directory for all objects and dump their attributes.
  5. Filter the search to retrieve only the userPassword attribute for all person objects.
  6. Crack the SHA1 password hashes to obtain plaintext passwords.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

LDAP is a protocol used to store and look up information about users and computers, like a phone book for a network. If a server allows 'anonymous bind', it means anyone can connect without a username or password and read the directory. Here, that let the attacker see password hashes and SSH keys, which could be cracked or abused to log in to other machines.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.