Skip to content

Active Directory — enumeration

← Back to index · The AD set is 40 points — nearly half a pass, and the highest-leverage target on the exam.

To attack AD you first have to understand what it is: a central database (on the Domain Controller) of every user, group, computer, and the permissions between them. Every AD attack is about abusing one of those relationships. So enumeration here isn't "list users" — it's mapping who can do what to whom, because that map contains your path to Domain Admin. The exam hands you a breach-scenario foothold (a credential or a shell); your job is to turn that toehold into the whole domain by reading the map.

Port 88 = Domain Controller. First, anchor names: echo "$DC_IP dc01.$DOMAIN $DOMAIN" | sudo tee -a /etc/hosts (Kerberos is picky about names, not just IPs).

Stage 1 — with no credentials yet

Even unauthenticated, AD leaks a lot, because some services allow anonymous/null access by design.

netexec smb $DC                                 # domain name, DC hostname, OS — free
netexec smb $DC -u '' -p '' --users             # null-session user list (sometimes works)
enum4linux-ng -A $DC
kerbrute userenum -d $DOMAIN --dc $DC users.txt  # which usernames are real? (no creds needed)
ldapsearch -x -H ldap://$DC -b "DC=${DOMAIN%%.*},DC=${DOMAIN#*.}"   # anonymous LDAP bind?
What you're fishing for: a valid username list. Usernames are the hard part — once you have them, AS-REP roasting and spraying become possible with no password at all.

Stage 2 — with one valid credential

The breach scenario usually gives you user:pass or a shell. That one credential is a key to read the entire directory:

netexec smb $DC -u $USER -p $PASS                            # validate it works
netexec smb $DC -u $USER -p $PASS --users --groups --pass-pol --shares
ldapdomaindump -u "$DOMAIN\\$USER" -p $PASS ldap://$DC -o ldapdump/   # dump ALL objects to HTML
impacket-GetADUsers -all $DOMAIN/$USER:$PASS -dc-ip $DC               # every user
How to read the dump: open ldapdomaindump's HTML and read the description fields (passwords hide there constantly), the group memberships (who's in Domain Admins / privileged groups), and service accounts (SPNs → Kerberoastable). The --pass-pol output tells you the lockout threshold — essential before any spraying.

Stage 3 — BloodHound (the map)

Manual enumeration finds objects; BloodHound finds paths. It ingests the directory and graphs "who can compromise whom," which is exactly the relationship-abuse that AD attacks are made of.

bloodhound-python -u $USER -p $PASS -d $DOMAIN -dc dc01.$DOMAIN -c all -ns $DC_IP
# or run SharpHound on a domain host, import the .zip into BloodHound CE
How to actually use it: 1. Mark your owned user as Owned. 2. Run "Shortest Paths to Domain Admins" and "Shortest Paths from Owned Principals." 3. Inspect your user's Outbound Object Control — edges like GenericAll, WriteDACL, ForceChangePassword, AddMember are abusable permissions (see attacks). 4. Note sessions of privileged users (where a Domain Admin is logged in = a box worth compromising to steal their token/hash).

BloodHound turns "I have a low-priv user" into a concrete sentence: "this user can change that user's password, who is in a group that can admin the DC." That sentence is your attack plan.

What to hunt for (the quick-win checklist)

flowchart TD
  A["valid domain cred"] --> B["dump users/groups/computers + BloodHound"]
  B --> C{"quick wins?"}
  C -->|AS-REP roastable| E["no-preauth users -> crackable hash"]
  C -->|SPN set| F["Kerberoastable service accounts"]
  C -->|lockout headroom| G["password spray a common password"]
  C -->|ACL edge| H["GenericAll / WriteDACL / ForceChangePassword"]
  C -->|SYSVOL / GPP| I["cpassword in Groups.xml"]
- GPP / SYSVOL: netexec smb $DC -u $USER -p $PASS -M gpp_password — decrypts a password Microsoft stored with a published key. Free plaintext when present. - Shares: netexec smb $DC -u $USER -p $PASS -M spider_plus to loot readable shares for configs/scripts/creds. - Every hostname in the dump is a pivot target — the other two AD machines are in there.

The loop: every new credential you gain → re-validate against every host and re-run BloodHound as that user, because a more privileged user reveals new paths. Keep climbing the map until an edge reaches Domain Admin.