ldap
Theldap command is R4t’s primary interface for interacting with Active Directory via the Lightweight Directory Access Protocol. It supports enumeration, modification, object creation and deletion, vulnerability scanning, DACL manipulation, GPO management, and LAPS interaction.
All ldap subcommands use the global authentication and connection flags.
Usage
Subcommands
ldap get
Query and retrieve AD objects.
Object Types
| Type | Description |
|---|---|
user | Single user by samAccountName, DN, or UPN |
users | All domain user accounts |
computer | Single computer account |
computers | All computer accounts |
group | Single group by name or DN |
groups | All security and distribution groups |
ou | Single Organizational Unit |
ous | All Organizational Units |
maq | Machine Account Quota for the domain |
spn | All accounts with Service Principal Names |
desc | Accounts with interesting strings in the description field |
Common Flags
| Flag | Description |
|---|---|
--name | Filter by samAccountName, CN, or DN |
--output, -o | Write results to file |
--raw | Output raw LDAP attributes |
Examples
ldap create
Create new AD objects.
Object Types
| Type | Description |
|---|---|
user | Create a new user account |
computer | Create a new computer account |
group | Create a new security group |
group-member | Add a member to an existing group |
ou | Create a new Organizational Unit |
Examples
ldap delete
Delete AD objects.
Object Types
| Type | Description |
|---|---|
user | Delete a user account |
computer | Delete a computer account |
group-member | Remove a member from a group |
ou | Delete an Organizational Unit |
ldap modify
Modify attributes on an existing AD object.
| Flag | Description |
|---|---|
--dn | Distinguished Name of the object to modify |
--attribute | LDAP attribute name to change |
--value | New value for the attribute |
--add | Add the attribute value (rather than replace) |
--delete | Delete the attribute value |
Examples
ldap enable
Re-enable a disabled AD object.
Object Types
| Type | Description |
|---|---|
user | Enable a disabled user account |
computer | Enable a disabled computer account |
ldap password
Reset or change an account password.
| Flag | Description |
|---|---|
--target-user | The user whose password to change |
--new-password | The new password to set |
--old-password | Current password (required for self-service change) |
Examples
ldap query
Execute a raw LDAP search query.
| Flag | Description |
|---|---|
--filter | LDAP search filter (e.g., (objectClass=user)) |
--attributes | Comma-separated list of attributes to return |
--base | Search base DN (defaults to domain root) |
--scope | Search scope: base, one, sub (default: sub) |
--output, -o | Write results to file |
Examples
ldap scan
Scan for AD vulnerabilities and misconfigurations.
- Accounts with no pre-authentication (AS-REP Roastable)
- Accounts with kerberoastable SPNs
- DCSync-capable accounts (Replicating Directory Changes All)
- Accounts with shadow credential opportunities
- Coercible hosts
- Password policy weaknesses
- Domain functional level issues
- Delegation misconfigurations (unconstrained, constrained, resource-based)
- Pre-Windows 2000 compatible access
- NOPAC-vulnerable accounts
| Flag | Description |
|---|---|
--output, -o | Write scan results to file |
ldap recon
Full domain reconnaissance — enumerates users, computers, groups, OUs, GPOs, trusts, domain controllers, and password policies, storing everything in the database.
| Flag | Description |
|---|---|
--output, -o | Output directory for results |
ldap dacl
Enumerate and modify Discretionary Access Control Lists (DACLs) on AD objects.
Subcommands
| Subcommand | Description |
|---|---|
get | Enumerate DACL ACEs on an object |
add | Add an ACE to an object’s DACL |
remove | Remove an ACE from an object’s DACL |
| Flag | Description |
|---|---|
--dn | Target object DN |
--trustee | Account to grant/revoke rights to |
--right | AD right (e.g., GenericAll, WriteProperty, ResetPassword) |
Examples
ldap gplink
Manage Group Policy Object links to containers (OUs, domains, sites).
Subcommands
| Subcommand | Description |
|---|---|
add | Link a GPO to a container |
remove | Unlink a GPO from a container |
list | List all GPO links |
ldap laps
Interact with LAPS (Local Administrator Password Solution).
| Flag | Description |
|---|---|
--computer | Target computer name |
--all | Retrieve LAPS passwords for all computers |
--output, -o | Write results to file |
ms-Mcs-AdmPwd (LAPS v1) and msLAPS-Password (LAPS v2) attributes from computer objects.
Examples
ldap gpo
Enumerate Group Policy Objects.
| Flag | Description |
|---|---|
--output, -o | Write results to file |
--links | Include GPO link information |
ldap gpo — GPO Enumeration Notes
GPO data is stored in the gpos and gp_link_entries tables in the SQLite database after enumeration.
LDAP Obfuscation
R4t uses theel-dap library, which supports LDAP query obfuscation to evade signature-based detection of LDAP queries. Obfuscation is applied transparently for all ldap subcommand operations when configured.
