Password spraying is an effective authentication attack technique that attempts to access a large number of accounts with a few commonly used passwords. Unlike traditional brute force attacks that try many passwords against a single account, password spraying tries a single password against many accounts before moving on to the next password, which helps to avoid account lockouts.
Understanding Password Spraying
Password Spraying vs. Brute Force
Password Spraying
Traditional Brute Force
Few passwords against many accounts
Many passwords against few accounts
Typically uses common, weak passwords
Can use dictionary or exhaustive attacks
Designed to evade lockout policies
Often triggers account lockouts
Lower chance of success per account
Higher chance of success per account
Lower risk of detection
Higher risk of detection
When to Use Password Spraying
Password spraying is most effective when:
Account lockout policies are in place
You have identified many valid usernames
You want to remain stealthy
You suspect default, common, or weak password usage
Organization-wide password patterns might exist
Preparation for Password Spraying
Understanding the Target Environment
Before performing password spraying, gather intelligence about:
Account lockout thresholds: Determine how many failed attempts trigger a lockout
Lockout duration: Learn how long accounts remain locked
Lockout observation window: Understand the time window for counting failed attempts
Password complexity requirements: Tailor your password list to meet requirements
Authentication endpoints: Identify all services that can be used for authentication
Creating Target Lists
Generate a list of valid usernames using techniques from user enumeration:
Source IP pattern: Multiple attempts from the same IP
Timing patterns: Regular intervals between attempts
Account coverage: Failed attempts across many accounts
Unusual authentication times: Activity outside business hours
Evasion Techniques
Rotate source IPs: Use multiple exit nodes or proxies
Add jitter: Randomize timing between attempts
Limit scope: Target fewer accounts per spray
Use expected credentials: Start with the most likely passwords
Timing selection: Perform spraying during normal business hours
After a Successful Spray
Credential Validation
Confirm that obtained credentials are valid:
Privilege Assessment
Determine the permissions of compromised accounts:
Lateral Movement
Use compromised credentials to access other systems:
Best Practices
Start conservatively: Begin with a small subset of accounts
Monitor for lockouts: Watch for signs of account lockouts during spraying
Document everything: Keep detailed records of attempts and results
Avoid service accounts: These often have monitoring and may trigger alerts
Test one password fully: Complete a full spray with one password before moving to the next
Prioritize attempts: Start with the most likely passwords for your target environment
Legal and Ethical Considerations
Only perform password spraying with explicit permission
Document all activities thoroughly
Be mindful of potential system impacts
Report findings responsibly
Follow proper data handling procedures for any credentials discovered
Password spraying remains one of the most effective techniques for gaining initial access to environments with multiple user accounts. When performed carefully and methodically, it can yield valuable access while minimizing the risk of detection or account lockouts.
# Example execution timeline
# 09:00 - Spray Password1 against all accounts
# 09:30 - Wait for lockout counter to reset
# 10:00 - Spray Welcome1 against all accounts
# Using random delays between attempts
for user in $(cat users.txt); do
crackmapexec smb 172.16.5.5 -u $user -p 'Spring2023!'
sleep $(( ( RANDOM % 10 ) + 1 ))
done
# Split users file into batches of 5 users
split -l 5 users.txt batch_
# Process each batch
for batch in batch_*; do
crackmapexec smb 172.16.5.5 -u $batch -p 'Spring2023!' --continue-on-success
echo "Waiting 30 minutes before next batch..."
sleep 1800
done
# Check if user has admin rights
crackmapexec smb 172.16.5.5 -u found_user -p 'Spring2023!' --shares
# Check if user has WinRM access
crackmapexec winrm 172.16.5.5 -u found_user -p 'Spring2023!' -X whoami
# Check access across multiple systems
crackmapexec smb 172.16.5.0/24 -u found_user -p 'Spring2023!'