Password Policy & User Lists
Before you spray, two things need to be true: you know the lockout threshold, and you have a clean user list. Spraying blind locks accounts, burns the engagement, and gets the SOC’s attention for nothing.
Order of operations
- Pull the password policy (lockout threshold, observation window).
- Build a user list.
- Filter the list by
badPwdCountso you never touch an account one bad guess from lockout.- Pick 1–2 passwords. Spray. Wait longer than the observation window between rounds.
Pulling the password policy
From Linux — with creds
nxc smb 172.16.5.5 -u moh -p 'P@ssw0rd!' --pass-pol
crackmapexec smb 172.16.5.5 -u moh -p 'P@ssw0rd!' --pass-polFrom Linux — null session / anonymous
Still common on legacy DCs and misconfigured member servers.
# rpcclient
rpcclient -U "" -N 172.16.5.5
rpcclient $> querydominfo
rpcclient $> getdompwinfo
# enum4linux-ng
enum4linux-ng -P 172.16.5.5 -oA ilfreight-passpolFrom Linux — LDAP anonymous bind
ldapsearch -H ldap://172.16.5.5 -x -b "DC=INLANEFREIGHT,DC=LOCAL" -s sub "*" \
| grep -m1 -B10 pwdHistoryLengthFields you care about:
| LDAP attribute | Meaning |
|---|---|
minPwdLength | Minimum password length |
lockoutThreshold | Bad attempts before lockout (0 = never) |
lockOutObservationWindow | Window for counting bad attempts |
lockoutDuration | How long an account stays locked |
pwdHistoryLength | Password reuse depth |
pwdProperties | Complexity flags |
From Windows
net accounts /domainImport-Module .\PowerView.ps1
Get-DomainPolicy
(Get-DomainPolicy).SystemAccessFine-grained password policies
Default Domain Policyis just the baseline. Service accounts, admins, and specific groups can live under PSOs with laxer or stricter rules. Check withGet-ADFineGrainedPasswordPolicyor LDAP formsDS-PasswordSettingsobjects.
Building the user list
Null session → RPC
rpcclient -U "" -N 172.16.5.5
rpcclient $> enumdomusers
# One-liner via enum4linux
enum4linux -U 172.16.5.5 | grep "user:" | cut -f2 -d"[" | cut -f1 -d"]"NetExec / CrackMapExec
nxc smb 172.16.5.5 -u '' -p '' --users
nxc smb 172.16.5.5 -u moh -p 'P@ssw0rd!' --usersWhy NetExec beats raw rpcclient
It prints
badPwdCountandbadPwdTimealongside each user — strip anyone one hit from lockout before you spray.
RID brute via lookupsid.py
Works when enumdomusers is blocked but the server still answers SID lookups. Ancient, reliable.
lookupsid.py anonymous@172.16.5.5 20000 | tee rid.out
grep "SidTypeUser" rid.out | awk -F'\\' '{print $2}' | awk '{print $1}' > users.txt
# With creds
lookupsid.py INLANEFREIGHT/moh:'P@ssw0rd!'@172.16.5.5 20000LDAP anonymous bind
ldapsearch -H ldap://172.16.5.5 -x -b "DC=INLANEFREIGHT,DC=LOCAL" \
"(&(objectclass=user))" sAMAccountName \
| grep sAMAccountName: | cut -f2 -d" " > users.txt
# Or with windapsearch
./windapsearch.py --dc-ip 172.16.5.5 -u "" -UKerbrute userenum (no creds, quiet)
Kerberos pre-auth doesn’t log failures — perfect for user discovery.
kerbrute userenum -d inlanefreight.local --dc 172.16.5.5 \
/opt/jsmith.txt -o valid_users.txt
# Try both common first-last schemas
kerbrute userenum -d inlanefreight.local --dc 172.16.5.5 /opt/jsmith2.txtLists worth keeping on disk:
jsmith.txt—flastpatternjsmith2.txt—firstlastpatternstatistically-likely-usernamesrepo for the rest
Scraping users from SMB shares
Once you’ve got any foothold-level auth (even guest on a share), grep file paths and open docs for usernames.
smbmap -H 172.16.5.5 -u guest -p '' -R --no-banner
smbmap -H 172.16.5.5 -u moh -p 'P@ssw0rd!' -R 'Users' # pulls home dir names
smbclient -N //172.16.5.5/Public
smb: \> recurse ON
smb: \> prompt OFF
smb: \> mget *Home directory names on \\DC\Users$ or similar = authoritative sAMAccountName list.
Email harvesting → username schema
Order of inference:
- Harvest emails:
hunter.io,phonebook.cz, LinkedIn →linkedin2username. - Observe the pattern:
john.smith@,jsmith@,smith.j@,john_smith@. - Convert emails to sAMAccountName by stripping domain and applying the observed rule.
- Validate with
kerbrute userenum.
# Generate every plausible combination from a LinkedIn pull
linkedin2username -c "Inlanefreight" -n inlanefreight.local
# produces jsmith.txt, jsmith2.txt, jsmith3.txt, etc.Checklist
- Password policy pulled (creds, null session, or LDAP — whichever works)
- Fine-grained password policies (PSOs) checked
- Lockout threshold & observation window noted
- User list built from at least two independent sources
-
badPwdCountfiltered — no account within 2 of threshold - Username convention confirmed against known-valid user via Kerbrute
- List deduplicated, lowercased, machine accounts (
$) stripped
Related
- 19 · Active Directory Enumeration & Attacks — module index
- 00 · Cheatsheet & Checklist
- AD Fundamentals
- Core Protocols
- External Recon & Initial Enumeration
- LLMNR & NBT-NS Poisoning
- Password Spraying
- Credentialed Enumeration (Linux)
- Credentialed Enumeration (Windows)
- Kerberoasting & AS-REP Roasting
- ACL Abuse
- Lateral Movement & Attacks
- Trust Abuse
- Hardening & Detection
