Skip to content

Cheatsheet · Infrastructure and AD pentesting · Red teaming

Authenticated Active Directory enumeration: NetExec, LDAP, BloodHound

Authenticated AD enumeration for an internal test: domain, accounts, groups, password policy, shares, LDAP queries and BloodHound collection.

By Steven Carrier Published

Official website: NetExec

This sheet covers enumerating an Active Directory domain with a standard account, as part of an authorised internal test. The aim is to map what the domain exposes: accounts, groups, password policy, shares and delegations. No exploitation is described here. Replace corp.local, 10.0.0.10 (domain controller) and audit.user with the elements of your scope, agreed beforehand using the penetration test scoping checklist. To find the domain controllers and exposed services first, see the Nmap cheatsheet.

Prepare the enumeration

Use an account dedicated to the engagement, supplied by the client, and note the time of each run: detection teams must be able to tell your activity apart.

# Domain controller and basic information (no account required)
nxc smb 10.0.0.10

# Convenience variables for what follows
export DC=10.0.0.10 DOMAIN=corp.local

The nxc smb output shows the host name, domain, Windows version and the SMB signing status (signing). SMB signing that is not required is an observation to report.

Validate credentials and the password policy

# Check that the supplied account works
nxc smb $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword'

# Domain password and lockout policy
nxc smb $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' --pass-pol

Record the minimum length, complexity, maximum age and above all the lockout threshold. This sheet does not cover any password testing: if the audit agreement provides for it, the lockout threshold determines what is possible without affecting users.

List accounts, groups and machines

# Domain accounts (SMB, then LDAP)
nxc smb $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' --users
nxc ldap $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' --users

# Domain groups and local groups
nxc smb $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' --groups
nxc smb $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' --local-groups

# Domain controllers (LDAP)
nxc ldap $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' --dc-list

# Account descriptions (often filled in with sensitive information)
nxc ldap $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' -M get-desc-users

# Quota for adding machines to the domain (MachineAccountQuota)
nxc ldap $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' -M maq

Run nxc ldap -L for the list of modules available in your version, and nxc ldap -M <module> --options for their parameters. Options change from one version to another.

List shares

# SMB shares and the account's rights (READ, WRITE)
nxc smb $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' --shares

# The same check on a list of in-scope machines
nxc smb targets.txt -d $DOMAIN -u audit.user -p 'SuppliedPassword' --shares

Look for shares writable by a standard account, application shares open to "Authenticated Users", and logon script folders (SYSVOL, NETLOGON) containing configuration files. Download only what is needed as evidence, and report any secret found immediately.

Query the directory with ldapsearch

# Search base: the domain root (DC=corp,DC=local)
BASE="DC=corp,DC=local"

# All user accounts (password requested interactively)
ldapsearch -x -H ldap://$DC -D "audit.user@$DOMAIN" -W -b "$BASE" \
  "(&(objectCategory=person)(objectClass=user))" sAMAccountName description memberOf

# Members of a privileged group (recursive, via the matching rule in chain)
ldapsearch -x -H ldap://$DC -D "audit.user@$DOMAIN" -W -b "$BASE" \
  "(&(objectCategory=person)(memberOf:1.2.840.113556.1.4.1941:=CN=Domain Admins,CN=Users,$BASE))" sAMAccountName

# Accounts whose password never expires
ldapsearch -x -H ldap://$DC -D "audit.user@$DOMAIN" -W -b "$BASE" \
  "(&(objectCategory=person)(userAccountControl:1.2.840.113556.1.4.803:=65536))" sAMAccountName

-x means simple authentication: without LDAPS or signing, the password travels in clear text on the network. Prefer ldaps:// (or -ZZ with StartTLS) when the controller offers it, and note in the report whether LDAP accepts unprotected binds.

Collect BloodHound data

BloodHound models the relationships between AD objects as a graph. Collection is a series of legitimate LDAP and SMB queries, but it generates a noticeable volume and can trigger alerts: warn the SOC if the agreement provides for it.

# Collection from a Linux machine (bloodhound-python)
bloodhound-python -d $DOMAIN -u audit.user -p 'SuppliedPassword' \
  -ns $DC -c DCOnly --zip

# Broader collection (sessions and local administrators included)
bloodhound-python -d $DOMAIN -u audit.user -p 'SuppliedPassword' \
  -ns $DC -c All --zip

# Collection built into NetExec
nxc ldap $DC -d $DOMAIN -u audit.user -p 'SuppliedPassword' \
  --bloodhound -c All --dns-server $DC

From a domain-joined Windows machine, the SharpHound collector produces the same archive:

SharpHound.exe -c DCOnly
SharpHound.exe -c Default
Method Content
DCOnly queries to the domain controller only: groups, ACLs, delegations, trusts. Quieter, but no sessions or local rights
Default DCOnly plus sessions and local group membership
All Default plus the additional methods: more complete, noisier

Options vary between BloodHound versions and editions. Check them with bloodhound-python -h or in the documentation of the version you use, then import the archive into BloodHound.

What to look for

Observation Why it matters Where to find it
Overpopulated privileged groups (Domain Admins, Enterprise Admins, Administrators, Backup Operators, Account Operators, DnsAdmins) Every member is a path to domain compromise --groups, ldapsearch, BloodHound
Service accounts with an SPN (Kerberoastable, identification only) Their password is often old and weak; the exposure can be measured without extracting a ticket LDAP filter below, BloodHound
Unconstrained or constrained delegation A machine or account can impersonate users LDAP filters below, BloodHound
Accounts with a non-expiring password or a sensitive description Account hygiene, exposed secrets 65536 filter, get-desc-users
MachineAccountQuota above 0 Any user can add machines to the domain maq module
SMB or LDAP signing not required Exposure to relay attacks nxc smb, LDAP bind test
Overly permissive AD CS certificate templates Well-known privilege escalation route -M adcs, BloodHound
# Enabled user accounts with an SPN (identifying Kerberoastable accounts)
ldapsearch -x -H ldap://$DC -D "audit.user@$DOMAIN" -W -b "$BASE" \
  "(&(objectCategory=person)(objectClass=user)(servicePrincipalName=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))" \
  sAMAccountName servicePrincipalName memberOf

# Unconstrained delegation (excluding domain controllers)
ldapsearch -x -H ldap://$DC -D "audit.user@$DOMAIN" -W -b "$BASE" \
  "(&(userAccountControl:1.2.840.113556.1.4.803:=524288)(!(primaryGroupID=516)))" sAMAccountName dNSHostName

# Constrained delegation
ldapsearch -x -H ldap://$DC -D "audit.user@$DOMAIN" -W -b "$BASE" \
  "(msDS-AllowedToDelegateTo=*)" sAMAccountName msDS-AllowedToDelegateTo

These queries identify the exposure without exploiting it. In the report, state the number of accounts concerned, whether they belong to privileged groups and the age of their password (pwdLastSet), rather than listing the accounts outside the secure deliverable.

Engagement precautions

  • Work with a dedicated, standard-rights account, and keep a record of every command with its timestamp.
  • Limit queries to the domain controllers and in-scope machines; avoid session collection at peak hours.
  • Treat exports (BloodHound, account lists) as sensitive data: encryption at rest, deletion at the end of the engagement as the agreement requires.
  • Report any secret discovered (a clear-text password in a share or a description) to the client without waiting for the final report.

Sources

Related resources

  • Methodology · Infrastructure and AD pentesting · Red teaming

    Active Directory config review

    Defensive Active Directory review checklist for audits: privileged accounts, krbtgt, delegation, LAPS, legacy protocols, GPOs, ADCS and logging.

    Published

  • AI skill · Web pentesting · Infrastructure and AD pentesting · Red teaming

    Engagement scoping skill

    Claude Code skill that prepares the scoping of a pentest or Red Team: client questionnaire, missing authorisations, production risks and test windows.

    Published

  • AI prompt · Web pentesting · Infrastructure and AD pentesting · Red teaming

    Scoping questionnaire prompt

    Prompt that generates the scoping questionnaire to send a client, based on the engagement type (web, infrastructure, red team) and context, with blockers.

    Published

BEAROPS

Need a penetration test?

BEAROPS experts test your applications, infrastructure and cloud, black box or grey box, following OWASP, NIST and ANSSI guidance.