How it works
Multifactor authentication happens in a browser or a broker: the identity provider shows a prompt and the user answers it. Two kinds of sign-in have no place for that prompt, because the client collects the password itself and sends it in a single request.
The resource owner password credentials grant
ROPC is an OAuth 2.0 grant type. The application posts the user's name and password to the token endpoint with grant_type=password and receives an access token, and a refresh token if it asked for offline_access. Microsoft supports it for work and school accounts and recommends against using it, because it is incompatible with MFA.
What Microsoft documents about its limits is what an attacker plans around:
- If the user must use MFA to sign in to the application, the request is blocked instead of challenged.
- It works only on a tenant-specific endpoint or
organizations, notcommonorconsumers. - Accounts without a password (FIDO2, Authenticator phone sign-in, SMS sign-in) can't use it.
- It isn't supported for federated domains, except with pass-through authentication or a home realm discovery policy that sets
AllowCloudPasswordValidation. - The client has to be allowed to use the flow. Public client applications, which have no secret, include several of Microsoft's own applications that exist in every tenant.
The response separates outcomes precisely. invalid_grant comes with an Entra error code: a wrong password, a correct password that needs MFA, an expired password, a disabled account and a Conditional Access block are all different codes. A password is therefore confirmed even when the request is refused. That makes ROPC the standard vehicle for password spraying and credential stuffing against Entra ID.
Legacy authentication
Legacy authentication is Entra ID's name for clients that use Basic authentication: IMAP, POP, authenticated SMTP, Exchange ActiveSync, Exchange Web Services, MAPI over HTTP, Autodiscover and older Office clients. The mail service receives the user name and password and validates them on the client's behalf. These sign-ins don't support MFA and don't pass device information, so a policy that requires MFA or a compliant device can only block them, and only if it applies to legacy clients.
Microsoft's analysis is that more than 97 percent of credential stuffing attacks and more than 99 percent of password spray attacks use legacy authentication.
A protocol name alone doesn't make a sign-in legacy. IMAP and SMTP clients can use OAuth, and a non-interactive sign-in is not automatically old. What matters is whether the password itself was sent, which the sign-in record's client app and authentication protocol fields show.
Where the gap is
Conditional Access is evaluated after the first factor succeeds. The attack works wherever the evaluation ends without a block:
- A policy that requires MFA for "all cloud apps" but excludes an application, a group, a location or a platform.
- A legacy authentication block with exclusions for a service account or a multifunction printer.
- Per-user MFA or security defaults that were switched off for an account.
- A policy in report-only mode, which logs what it would have done and enforces nothing.
Prerequisites
- A user name, and a password to test (guessed, sprayed, or from a breach).
- For ROPC: a managed (not federated) domain, or pass-through authentication, and a client application ID that the tenant accepts for the flow.
- For legacy protocols: Basic authentication still enabled for that protocol in the mail service and not blocked for that user.
- For access, not only validation: no Conditional Access policy that requires MFA or blocks the flow for that user, application and location.
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. Send the password to the token endpoint
The request is a single POST. Use the tenant's ID or domain in the path and the application ID of a public client:
curl -s -X POST "https://login.microsoftonline.com/corp.example.com/oauth2/v2.0/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "client_id=00000000-0000-0000-0000-000000000000" \
--data-urlencode "scope=https://graph.microsoft.com/.default offline_access" \
--data-urlencode "username=alice@corp.example.com" \
--data-urlencode "password=<password>" \
--data-urlencode "grant_type=password"
2. Read the answer
A success returns JSON with access_token, refresh_token and expires_in. A failure returns invalid_grant with an error description that starts with an AADSTS code:
| Code | Meaning for the attacker |
|---|---|
| AADSTS50126 | Wrong user name or password |
| AADSTS50034 | The user doesn't exist in this tenant |
| AADSTS50076 | The password is correct; MFA is required |
| AADSTS50079 | The password is correct; the user has to register for MFA |
| AADSTS50055 | The password is correct and expired |
| AADSTS50057 | The account is disabled |
| AADSTS50053 | The account is locked, or the source address is blocked |
| AADSTS53003 | The password step passed; Conditional Access blocked the request |
3. Look for the combination that isn't covered
A policy often applies to some applications and not others. roadtx requests tokens with a user name and password and lets the operator choose the client and the resource, so the same password can be tried against different combinations:
# List the built-in aliases for client applications and resources
roadtx listaliases
# Microsoft Graph with the default client
roadtx gettokens -u alice@corp.example.com -p '<password>' -r msgraph
# The same password, presenting as the Teams client
roadtx gettokens -u alice@corp.example.com -p '<password>' -c msteams -r msgraph
A combination that returns tokens while others return AADSTS50076 marks an exclusion in the tenant's policies.
4. Use and extend the tokens
With a refresh token from a successful request, ask for tokens for other resources without sending the password again:
roadtx gettokens --refresh-token <token> -r msgraph
roadtx gettokens --refresh-token <token> -c msteams
5. Legacy protocols
Where Basic authentication is still enabled, the same user name and password work directly in an IMAP, POP or SMTP client pointed at the mail service. A successful login gives the mailbox contents (IMAP, POP) or the ability to send as the user (SMTP), with no token and no prompt. Service accounts for scanners, monitoring and old line-of-business applications are the usual survivors, because they were excluded from the block that covers everyone else.
Impact
At minimum the attacker learns which passwords are valid, including for accounts protected by MFA. Where the flow completes, the attacker holds tokens for Microsoft Graph, Exchange Online or another resource and acts as the user: mail, files, Teams, directory enumeration. A refresh token extends that access beyond the life of the first access token. Legacy protocol access to a mailbox gives password reset mails, internal conversations and a trusted address to phish from.
The impact is rated medium because the result is one user's access. It is higher for an administrator or a service account that policy exclusions were built around.
OPSEC and artifacts
- No prompt, so the user sees nothing. There is no MFA notification, no browser page and no consent screen. The only record is in the sign-in logs.
- ROPC is labeled. The sign-in record carries the authentication protocol value
ropc. A tenant with no legitimate ROPC use can alert on every occurrence, so operators check for existing ROPC traffic (legacy scripts, test rigs) and choose a client that is already seen. - The client application is recorded. Using a first-party application ID that the user normally uses blends better than an unusual one. The user agent of a scripting library still gives it away unless it is changed.
- Legacy sign-ins are labeled too. The client app field shows IMAP4, POP3, Authenticated SMTP, Exchange ActiveSync or Other clients. They often land in the non-interactive log, which fewer teams watch.
- Failures are as visible as successes. Each wrong password is a sign-in record with result 50126, and each "password correct, MFA required" is a 50076 from a protocol that could never satisfy it, which is itself a strong signal.
- Report-only policies leave a trail. A request that a report-only policy would have blocked is logged with that result. The attacker isn't stopped, and the defender has the evidence.
Detection
- Every successful ROPC sign-in. The ROPC sign-in rules cover it. Build an allow list of the few applications that use the flow.
- Every successful legacy sign-in. The legacy authentication rules list the client app values.
- Failures over these flows across many accounts, which is the password spraying pattern.
- Blocks that prove a password is known. Sign-ins blocked by Conditional Access with result 53003, and 50076 results, over a password-only flow mean the attacker has the password.
- Changes that reopen the gap. Per-user MFA disabled and Conditional Access policy updates that add exclusions.
An inventory of password-only sign-ins and their outcomes:
union withsource=SourceTable
(SigninLogs
| project TimeGenerated, UserPrincipalName, IPAddress, AppDisplayName, AuthenticationProtocol, ClientAppUsed, ResultType),
(AADNonInteractiveUserSignInLogs
| project TimeGenerated, UserPrincipalName, IPAddress, AppDisplayName, AuthenticationProtocol, ClientAppUsed, ResultType)
| where AuthenticationProtocol == "ropc"
or ClientAppUsed in ("IMAP4", "POP3", "Authenticated SMTP", "Exchange ActiveSync",
"Exchange Web Services", "MAPI over HTTP", "Autodiscover", "Other clients")
| summarize Attempts = count(), Users = dcount(UserPrincipalName), Successes = countif(ResultType == "0")
by SourceTable, AuthenticationProtocol, ClientAppUsed, AppDisplayName, IPAddress
| order by Successes desc, Users desc
Rows with successes are the accounts that can be taken with a password alone. Rows with many users and no successes are a spray in progress.
Mitigation
- Block legacy authentication for everyone. Create the Conditional Access policy that blocks Exchange ActiveSync clients and Other clients for all users and all resources. Run it in report-only mode first, fix what depends on it, then turn it on. Tenants without Conditional Access get the same block from security defaults.
- Disable Basic authentication in the mail service as well, with an Exchange Online authentication policy, and disable SMTP AUTH on mailboxes that don't need it. This rejects the request before the password is checked.
- Require MFA for all users and all resources with no application exclusions. ROPC is not a legacy client, so the legacy block doesn't cover it. A policy that requires MFA everywhere causes ROPC requests to be blocked.
- Migrate applications off ROPC. Use an interactive flow where a user is present, and a workload identity (managed identity, federated credential or certificate) where none is. Find the owner of each application that still uses the flow from the sign-in logs.
- Remove exclusions. Each excluded service account is an account that password-only flows work against. Replace the account with a service principal, or restrict it by network location and a long random password. Emergency access accounts should be excluded from as little as possible and monitored; see the break-glass accounts guide.
- Don't allow cloud password validation for federated users unless a named legacy application needs it.
- Go passwordless for people. An account with no password has nothing to send.
- Act on confirmed passwords. A 50076 or 53003 result over a password-only flow means the password is known to someone else: reset it and revoke sessions. Risk-based policies automate this; see the ID Protection guide.
Detection rules for this attack
Log events to collect
FAQ
Does ROPC bypass MFA?
It can't perform MFA, which is different. If a Conditional Access policy requires MFA for the user and the resource, an ROPC request is blocked. If no policy covers that combination (an excluded application, an excluded location, a user outside the policy), the request succeeds with the password alone and returns tokens. Either way the response shows whether the password was right.
Is ROPC the same as legacy authentication?
No. ROPC is an OAuth 2.0 grant on the modern token endpoint, and Entra ID doesn't classify it as a legacy client. Legacy authentication means Basic authentication over protocols such as IMAP, POP, SMTP and Exchange ActiveSync. They share the weakness that matters: the client sends a user name and password and has no way to answer an MFA challenge. A legacy authentication block doesn't stop ROPC.
How do I find ROPC and legacy sign-ins in my tenant?
In the sign-in logs, ROPC requests have the authentication protocol value ropc. Legacy sign-ins are identified by the client app column: IMAP4, POP3, Authenticated SMTP, Exchange ActiveSync, Other clients and similar values. Check both interactive and non-interactive sign-ins, and review successes first.
Do federated users work with ROPC?
Not normally. When a domain is federated, Entra ID can't test the password against the on-premises identity provider through ROPC. Two exceptions exist: pass-through authentication supports ROPC, and a home realm discovery policy with AllowCloudPasswordValidation lets federated users whose password hash is synced authenticate directly.
References
- Microsoft identity platform and OAuth 2.0 Resource Owner Password Credentials (Microsoft Learn)
- Block legacy authentication with Conditional Access (Microsoft Learn)
- Conditional Access: Conditions, client apps (Microsoft Learn)
- Disable Basic authentication in Exchange Online (Microsoft Learn)
- RFC 6749: The OAuth 2.0 Authorization Framework, section 4.3
- Brute Force: Password Spraying, T1110.003 (MITRE ATT&CK)
- ROADtools Token eXchange, roadtx (ROADtools wiki)
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.