1. Resources
  2. Identity Threats
  3. Microsoft Entra ID

Microsoft Entra ID Password Spraying

Also known as: Azure AD password spraying, Microsoft 365 password spray, Cloud password spraying, Low and slow password guessing

An attacker with a list of user names tries one or two common passwords against every account in a tenant, staying under smart lockout, to find the accounts with a weak password and no MFA.

Platform
Microsoft Entra ID
Impact
Medium
Last updated
Attack difficulty
Low
Detection difficulty
Medium
Privileges required: No account
No account. Internet access to the Microsoft sign-in endpoints and a list of valid user names for the tenant.
What the attacker gains
Valid passwords for some accounts, and a session for each of them that isn't stopped by MFA or Conditional Access.
Threat groups
AgriusAPT28APT29APT33ChimeraEmber BearHAFNIUMHEXANELazarus GroupLeafminerNIMBUS MANTICORESilent LibrarianAPT38APT5and 7 more in MITRE ATT&CKGroups that MITRE ATT&CK records using T1110.003, T1078.004.

How it works

Password spraying turns password guessing sideways. Guessing many passwords for one account trips lockout. Guessing one common password for many accounts doesn't, because each account sees a single failure. In a tenant of a few thousand users, some account almost always has the season and year, the company name with a digit, or a help desk default as its password.

Against Microsoft Entra ID the attack runs over the internet against the public sign-in endpoints. The attacker needs only user names, which come from tenant reconnaissance. The on-premises version of the attack, against domain controllers, is on the Active Directory password spraying page.

What the attacker has to stay under

Entra smart lockout is always on. By default it locks an account after 10 failed attempts in Azure Public tenants (3 in Azure US Government), for one minute at first and for longer after repeated lockouts. Three details shape a spray:

  • Familiar and unfamiliar locations have separate counters. Failures from an address the user never signs in from don't lock the user out at their usual location, which protects the real user more than it hinders the attacker.
  • The same wrong password doesn't count twice. Smart lockout tracks the last three bad password hashes, so repeating one bad password doesn't increment the counter. This is not available with pass-through authentication, where the password is checked on-premises.
  • Microsoft also blocks by network. Sign-ins from addresses with malicious activity are refused with error 50053, the same code as a locked account, whether or not the password is right.

With pass-through authentication or federation, a second verifier is involved: the on-premises domain or the federation service. Its lockout policy applies too, and a spray against the cloud endpoint can lock on-premises accounts if the cloud threshold is not lower than the domain's.

What the responses reveal

The error code returned for each attempt tells the attacker more than success or failure:

Result Meaning What the attacker learns
0 Sign-in succeeded Valid password, no further control in the way
50126 Invalid user name or password Wrong password (or wrong name)
50034 User account does not exist Remove the name from the list
50053 Account locked, or sign-in blocked for malicious IP activity Slow down or change address
50076 MFA required The password is correct
50079 User must register for MFA The password is correct, and the attacker may be able to register their own method
50158 External security challenge not satisfied The password step passed; a federated or third-party control interrupted
50055 Password expired The password is correct but must be changed
50057 Account disabled The account can't sign in
53003 Blocked by Conditional Access The password step passed; policy refused the session

Why the protocol matters

Interactive sign-in can demand MFA. Password-only flows can't: the resource owner password credentials (ROPC) grant and legacy mail protocols take a user name and password and nothing else. Microsoft reports that more than 99 percent of password spray attacks use legacy authentication protocols. Spray tools use these flows because they are simple to script and return a precise error. See ROPC and legacy authentication abuse.

Prerequisites

  • A list of valid user names for the tenant.
  • Internet access to login.microsoftonline.com. Many source addresses help against IP-based blocking.
  • For the spray to pay off: at least one account with a guessable password and a path that doesn't require MFA, such as an application excluded from Conditional Access, a legacy protocol that is still allowed, or an account that hasn't registered MFA yet.

Attack steps

For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.

The steps below are for an authorized assessment or a lab.

1. Build and validate the user list

Derive candidate names from the organization's email format and remove the ones that don't exist:

Import-Module AADInternals
Get-Content .\candidates.txt | Invoke-AADIntUserEnumerationAsOutsider

Keep the names the command reports as existing, one per line, in userlist.txt.

2. Choose the password and the pace

Pick one password per round: season and year, company name with a year, the month, a known default. Calculate the pace from the lockout settings: with a threshold of 10 and a familiar real user also making mistakes, one attempt per account per round and a long wait between rounds stays well clear. If the tenant uses pass-through authentication, the domain's lockout threshold is the one to respect.

3. Spray

MSOLSpray sends one ROPC sign-in per user and interprets the error code. It reports valid passwords, accounts where the password is right but MFA is required, names that don't exist, and locked or disabled accounts:

Import-Module .\MSOLSpray.ps1

# One password against every user in the list
Invoke-MSOLSpray -UserList .\userlist.txt -Password 'Winter2026!'

# Write the valid credentials to a file
Invoke-MSOLSpray -UserList .\userlist.txt -Password 'Winter2026!' -OutFile valid-users.txt

The tool stops when it sees several lockouts in a row; -Force overrides that and should not be used against a production tenant.

4. Spread the source addresses

Requests from one address are easy to block and easy to see. MSOLSpray accepts an alternative endpoint, so the spray can go through a FireProx API gateway that gives each request a different source address:

Invoke-MSOLSpray -UserList .\userlist.txt -Password 'Winter2026!' `
    -URL https://abcdefghij.execute-api.us-east-1.amazonaws.com/fireprox

5. Use what came back

  • Valid, no MFA: sign in and collect tokens.
  • Valid, MFA required: keep the password. Try applications and protocols that policy may have excluded, try MFA fatigue, or wait for an opening.
  • Valid, MFA registration required: the account has no method yet. Whoever completes the registration first owns the second factor.
  • Password expired: the password is known. Depending on policy, the attacker may be able to set a new one.

Impact

Each account that falls gives the attacker that user's mail, files and applications, a position inside the tenant for directory enumeration, and a trusted sender for internal phishing. The impact is rated medium because the usual result is a standard user. It rises quickly when the account is an administrator without MFA, a synced service account with broad rights, or a break-glass account with a weak password.

Passwords that are correct but blocked by MFA are not harmless. They are confirmed credentials that work wherever the second factor isn't asked for, including other services where the user reused them.

OPSEC and artifacts

  • One attempt per account, long pauses. This keeps each account's counter low and avoids lockout events. What remains is the shape across accounts: many accounts, one failure each, in the same window.
  • Rotating source addresses. FireProx and residential proxies defeat per-address thresholds and Microsoft's IP blocking. The requests still share a client application ID, a user agent and a tight time pattern, and API gateway addresses belong to a cloud provider that few real users sign in from.
  • Password-only protocols. ROPC and legacy protocols avoid the MFA prompt that would alert the user. They are also distinctive: sign-in records show AuthenticationProtocol ropc or a legacy ClientAppUsed value, and most tenants have very little legitimate traffic of that kind.
  • Unknown names stand out. A list that wasn't validated produces a run of 50034 results from one source. Operators validate first with a lookup that doesn't sign in.
  • Every attempt is a sign-in record. Failures are in the interactive or non-interactive sign-in log with the user, address, application, result code and, for a successful password followed by MFA, the individual authentication steps. The attacker can't prevent or remove these records.
  • A success after the spray comes from a new address and usually a new client for that user. Operators wait and sign in from a location close to the user's. The risk detections are computed anyway.

Detection

Failure breadth per source, with the "password not rejected" results separated:

union withsource=SourceTable
    (SigninLogs
     | project TimeGenerated, Id, IPAddress, UserId, AppId, ErrorCode = toint(ResultType)),
    (AADNonInteractiveUserSignInLogs
     | project TimeGenerated, Id, IPAddress, UserId, AppId,
               ErrorCode = coalesce(toint(parse_json(Status).errorCode), toint(ResultType)))
| where ErrorCode in (50126, 50034, 50053, 50076, 50079, 50158, 50055, 50057, 53003)
| extend AttemptClass = iff(ErrorCode in (50076, 50079, 50158, 50055, 50057, 53003),
                            "PasswordNotRejected", "PasswordRejectedOrUnknown")
| summarize Requests = dcount(Id), Users = dcountif(UserId, isnotempty(UserId))
    by bin(TimeGenerated, 1h), IPAddress, AppId, AttemptClass
| where Users >= 10
| order by TimeGenerated asc

To confirm that a password step succeeded before MFA stopped the sign-in, read the authentication steps:

SigninLogs
| mv-expand Step = todynamic(AuthenticationDetails)
| project TimeGenerated, Id, CorrelationId, UserPrincipalName, AppDisplayName, ResultType,
          Method = tostring(Step.authenticationMethod),
          StepSucceeded = tostring(Step.succeeded),
          StepDetail = tostring(Step.authenticationStepResultDetail)
| order by TimeGenerated asc

The threshold is a starting value. A corporate proxy, a migration of mail clients or an expired service password also produces many failures from one address, so compare with the same source's normal traffic. Sign-in records don't contain the password that was tried, so "the same password" is inferred from the pattern. A step satisfied by a claim in an existing token is not evidence of a freshly typed password.

Mitigation

  • Require MFA for every user and every application, with no exclusions for "trusted" locations or legacy applications. Phishing-resistant methods for administrators. This turns a correct password into a blocked sign-in.
  • Block legacy authentication with Conditional Access (Exchange ActiveSync clients and Other clients), and block or tightly scope ROPC. Use report-only mode first to find what depends on them.
  • Ban weak passwords. Enable Microsoft Entra Password Protection with a custom banned list that contains the company name, products and local terms, and extend it to on-premises Active Directory.
  • Move to passwordless sign-in where possible. An account without a password can't be sprayed.
  • Tune smart lockout for hybrid. With pass-through authentication, set the Entra threshold lower than the domain's lockout threshold and the Entra duration longer, so the cloud blocks the attack before on-premises accounts lock. The Entra Connect hardening guide covers the hybrid settings.
  • Use risk-based policies. Require a password change for high user risk and MFA for risky sign-ins. The ID Protection guide shows the setup and how to handle a risky user.
  • Close the registration gap. Require MFA registration from a trusted location or with a Temporary Access Pass, so a sprayed password can't be used to enroll the attacker's device.
  • After a spray: reset the password of every account whose result shows the password was not rejected, revoke its sessions, and review what it did since the first such result.

Detection rules for this attack

Log events to collect

FAQ

Does smart lockout stop password spraying?

It limits it. Smart lockout locks an account after 10 failed attempts by default, for one minute at first and longer after that. A spray makes one or two attempts per account and waits, so it stays far below the threshold. Smart lockout protects each account against guessing; it doesn't see a pattern spread across thousands of accounts. Microsoft's separate IP-based blocking and the ID Protection password spray detection address the pattern.

Does MFA stop password spraying?

MFA stops the sign-in, but the spray still learns which passwords are right. A correct password on an account that requires MFA returns a different error (50076 or 50079) than a wrong password (50126). The attacker keeps the password for MFA fatigue, for protocols and applications excluded from MFA, or for other systems where the user reused it.

Which error codes show a password spray in Entra sign-in logs?

50126 is a wrong user name or password, 50034 a user name that doesn't exist, 50053 a locked account or a blocked IP address. Results that mean the password was not rejected need attention first: 50076 (MFA required), 50079 (MFA registration required), 50158 (external challenge), 50055 (expired password), 50057 (disabled account) and 53003 (blocked by Conditional Access).

How is this different from on-premises password spraying?

The target is the Microsoft sign-in endpoint on the internet, so the attacker needs no foothold in the network. Lockout is decided by Entra smart lockout, not by the domain's lockout policy, unless the tenant uses pass-through authentication or federation, where the on-premises verifier checks the password and its own lockout also counts.

References

Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.

Does this attack work in your environment?

Forestall maps every identity and the attack paths between them across Active Directory, Entra ID and cloud, read-only and agentless.