ldapsearch

Query LDAP / Active Directory.

KaliParrotLinuxlow

pkg: ldap-utils

ldapsearch reads directory objects from LDAP/AD — users, groups, computers and attributes.

Syntax

ldapsearch -x -H ldap://{host} -b {baseDN}

Example

ldapsearch -x -H ldap://10.0.0.1 -b "dc=corp,dc=local"

Anonymously dumps directory objects under the base DN.

Options & flags

What each switch does. Toggle them in the builder below to assemble a command.

-xSimple (non-SASL) authentication.
-H <ldap://10.0.0.1>LDAP URI.
-b <dc=corp,dc=local>Search base DN.
-D <cn=user,dc=corp,dc=local>Bind DN (user).
-w <Password1>Bind password.

Command builder

Tick options (and fill any values) to build a ready-to-copy command.

ldapsearch

Usage examples

ldapsearch -x -H ldap://10.0.0.1 -b "dc=corp,dc=local"

Anonymous dump of the directory.

ldapsearch -x -H ldap://10.0.0.1 -D user@corp.local -w P@ss -b "dc=corp,dc=local" "(objectClass=user)"

Authenticated user enumeration.

Advantages
  • Direct AD/LDAP enumeration
  • Standard and scriptable
Disadvantages
  • Often requires creds
  • Verbose output
Tags
#ldap#ad

Official docs: ldapsearch

Related commands

Frequently asked questions

What is ldapsearch used for?
ldapsearch reads directory objects from LDAP/AD — users, groups, computers and attributes.
What is an example ldapsearch command?
A common example is: ldapsearch -x -H ldap://10.0.0.1 -b "dc=corp,dc=local" — Anonymously dumps directory objects under the base DN.
Is ldapsearch part of Kali Linux?
Yes. ldapsearch ships with Kali Linux (and Parrot OS). If missing, install it with: sudo apt install ldap-utils.
What category of security tool is ldapsearch?
ldapsearch is a Information Gathering tool with a low-risk profile when run against a live target.

Try recon tools live

Run real scans against a domain you control, stage by stage.

Open the lab →