Most tenants spent 2024 and 2025 rolling out FIDO2 and passkeys, and it worked: AiTM kits have a much harder time against phishing-resistant MFA. So attackers moved to flows that sit beside authentication instead of attacking it. In an OAuth consent attack the user signs in properly, passes every MFA check, and then gives an app access to their mailbox. The access survives a password reset, because the password was never the thing that was stolen.
This post covers the three variants you should be detecting in 2026, the Sentinel queries for each, how to inventory the grants already sitting in your tenant, and the consent settings that shut most of this down.
Three ways to get a token without stealing a password
1. Classic illicit consent grant. The attacker registers a multi-tenant app called something like "Secure Document Viewer" or "Teams Notes AI", then sends a link to its consent screen. If your tenant allows user consent, one click gives the app delegated permissions like Mail.Read, Files.Read.All and offline_access. The app gets a refresh token and reads mail through Microsoft Graph for as long as the grant exists.
2. ConsentFix (also called AuthCodeFix). Push Security documented this one in late 2025, and by May 2026 automated versions (ConsentFix v3) were circulating. It doesn't need a malicious app at all. The victim is walked through signing in to a legitimate Microsoft first-party app, usually Azure CLI. These apps are pre-consented in every tenant, so there's no consent prompt. The sign-in ends on a localhost redirect that fails to load, and the phishing page tells the victim to copy that URL back into the page to "verify". That URL contains the OAuth authorization code, and the attacker exchanges it for tokens. If the victim already has a browser session, there isn't even a password or MFA prompt.
3. Device code phishing. The victim types a code at the real microsoft.com/devicelogin page and completes real MFA, which signs in the attacker's session. In 2026 this has been packaged as phishing-as-a-service (EvilTokens is one example), and AiTM crews have bolted it onto their kits. I covered the device code detection in the AiTM post, so this post focuses on the first two.
| Variant | Where it shows up | Why MFA doesn't help | Survives password reset? |
|---|---|---|---|
| Illicit consent grant | AuditLogs consent events, then Graph API calls by the app | The user authenticates legitimately, then grants access | Yes, until the grant is removed |
| ConsentFix | SigninLogs for a first-party app such as Azure CLI, then non-interactive use from attacker IPs | Real sign-in by the user; the auth code is handed over afterwards | The refresh token does until it's revoked |
| Device code | SigninLogs with AuthenticationProtocol = deviceCode | The user completes MFA for the attacker's session | The refresh token does until it's revoked |
Detection 1: consent grants with high-risk scopes
Every user or admin consent writes a Consent to application event to AuditLogs. The useful detail is buried in TargetResources[0].modifiedProperties: whether it was admin consent, which scopes were granted, and the app's service principal names (which include its AppId). Flatten that into a property bag first, then filter on scopes that read mail, files or chat, or that change the directory.
let HighRiskScopes = dynamic([ "Mail.Read", "Mail.ReadBasic", "Mail.ReadWrite", "Mail.Send", "MailboxSettings.ReadWrite", "Files.Read.All", "Files.ReadWrite.All", "Sites.Read.All", "Sites.ReadWrite.All", "Notes.Read.All", "Chat.Read", "Chat.ReadWrite", "Contacts.Read", "EWS.AccessAsUser.All", "full_access_as_user", "User.ReadWrite.All", "Directory.ReadWrite.All", "Application.ReadWrite.All", "AppRoleAssignment.ReadWrite.All", "RoleManagement.ReadWrite.Directory"]); AuditLogs | where TimeGenerated > ago(1d) | where OperationName == "Consent to application" | where Result =~ "success" | extend AppName = tostring(TargetResources[0].displayName), SPObjectId = tostring(TargetResources[0].id), ConsentedBy = tostring(InitiatedBy.user.userPrincipalName), ConsentIP = tostring(InitiatedBy.user.ipAddress) | mv-apply Prop = TargetResources[0].modifiedProperties on ( summarize Props = make_bag(bag_pack(tostring(Prop.displayName), tostring(Prop.newValue))) ) | extend IsAdminConsent = tostring(Props["ConsentContext.IsAdminConsent"]) has "True", Permissions = tostring(Props["ConsentAction.Permissions"]), AppId = extract(@"([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})", 1, tostring(Props["TargetId.ServicePrincipalNames"])) | extend ScopeText = strcat_array(extract_all(@"Scope:\s*([^,\]]+)", Permissions), " ") | extend GrantedScopes = split(trim(@"\s+", ScopeText), " ") | extend RiskyScopes = set_intersect(GrantedScopes, HighRiskScopes) | where array_length(RiskyScopes) > 0 | project TimeGenerated, AppName, AppId, SPObjectId, ConsentedBy, ConsentIP, IsAdminConsent, RiskyScopes, GrantedScopes | order by TimeGenerated desc
Severity depends on context. A user consenting to Mail.Read for an app nobody else in the tenant uses is high. An admin consenting to a known SaaS integration through your change process is informational. If you keep a watchlist of approved AppIds, exclude them here and the rule gets very quiet.
The scope list is embedded in a string that looks like [[Id: ..., ConsentType: Principal, Scope: Mail.Read offline_access User.Read, ...]], which is why the query uses regex instead of JSON parsing. Run the mv-apply part on its own against a week of your data first and confirm the property names match what your tenant writes. The KQL compiles cleanly, but Microsoft has changed audit log formats before without much warning.
Detection 2: an app that didn't exist in your tenant yesterday
When a user consents to a multi-tenant app for the first time, Entra creates a service principal for it in your tenant. Phishing apps are almost always new to the tenant, while legitimate apps usually already have a service principal because someone else uses them. "Service principal created and consented to within minutes" is a strong pattern.
let window = 1d; let NewServicePrincipals = AuditLogs | where TimeGenerated > ago(window) | where OperationName == "Add service principal" | where Result =~ "success" | project SPCreated = TimeGenerated, SPObjectId = tostring(TargetResources[0].id); AuditLogs | where TimeGenerated > ago(window) | where OperationName == "Consent to application" | where Result =~ "success" | extend SPObjectId = tostring(TargetResources[0].id), AppName = tostring(TargetResources[0].displayName), ConsentedBy = tostring(InitiatedBy.user.userPrincipalName), ConsentIP = tostring(InitiatedBy.user.ipAddress) | join kind=inner NewServicePrincipals on SPObjectId | where TimeGenerated between (SPCreated .. (SPCreated + 15m)) | project ConsentTime = TimeGenerated, SPCreated, AppName, SPObjectId, ConsentedBy, ConsentIP
Then check the app by hand. Does it have a verified publisher? What reply URLs does it use? Is it a homoglyph of a real product name? A brand-new app with no verified publisher, a reply URL on a cheap TLD and mail scopes is a phishing app until proven otherwise.
Detection 3: the consented app starts reading mail
Consent on its own is a soft signal. Graph API calls that read mail or files minutes after consent are a hard one. This needs MicrosoftGraphActivityLogs, which is off by default (it's a diagnostic setting on Entra ID, and it costs money at scale). If you can only afford one new log source for cloud identity this year, make it this one. Without it you can see the door was opened but not what walked through it.
let RecentConsents = AuditLogs | where TimeGenerated > ago(3d) | where OperationName == "Consent to application" | where Result =~ "success" | mv-apply Prop = TargetResources[0].modifiedProperties on ( summarize Props = make_bag(bag_pack(tostring(Prop.displayName), tostring(Prop.newValue))) ) | extend AppId = extract(@"([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})", 1, tostring(Props["TargetId.ServicePrincipalNames"])) | project ConsentTime = TimeGenerated, AppId, AppName = tostring(TargetResources[0].displayName), ConsentedBy = tostring(InitiatedBy.user.userPrincipalName) | where isnotempty(AppId); MicrosoftGraphActivityLogs | where TimeGenerated > ago(3d) | where RequestUri has_any ("/messages", "/mailFolders", "/drive/", "/drives/", "/sites/", "/contacts", "/chats") | join kind=inner RecentConsents on AppId | where TimeGenerated > ConsentTime | summarize Requests = count(), FirstCall = min(TimeGenerated), LastCall = max(TimeGenerated), CallerIPs = make_set(IPAddress, 20), SampleUris = make_set(RequestUri, 10) by AppName, AppId, ConsentedBy, ConsentTime, UserId | extend MinutesToFirstCall = datetime_diff('minute', FirstCall, ConsentTime) | order by MinutesToFirstCall asc
Phishing apps tend to start pulling mail within minutes, often by paging through /messages with $top set high. A legitimate productivity app usually syncs more gently. Also look at CallerIPs: a "document viewer" calling Graph from a VPS ASN tells you plenty.
Detection 4: ConsentFix, a first-time Azure CLI sign-in
ConsentFix leaves no consent event, so the detections above miss it. What it does leave is a sign-in to a developer tool by someone who isn't a developer. In most organisations, the set of people who legitimately sign in to Azure CLI or Azure PowerShell is small and stable. A finance user's first-ever Azure CLI sign-in is a very clean signal.
let DevToolApps = dynamic([ "04b07795-8ddb-461a-bbee-02f9e1bf7b46", // Microsoft Azure CLI "1950a258-227b-4e31-a9cf-717495945fc2"]); // Microsoft Azure PowerShell let window = 1d; let KnownUsers = SigninLogs | where TimeGenerated between (ago(45d) .. ago(window)) | where AppId in (DevToolApps) | where ResultType == "0" | distinct UserPrincipalName; SigninLogs | where TimeGenerated > ago(window) | where AppId in (DevToolApps) | where ResultType == "0" | where UserPrincipalName !in (KnownUsers) | project TimeGenerated, UserPrincipalName, AppDisplayName, AppId, ResourceDisplayName, IPAddress, AutonomousSystemNumber, Location, AuthenticationProtocol, UserAgent, SessionId, CorrelationId
Give this rule a short list of exclusions (your cloud engineering group) and it will fire rarely enough to be a high-severity alert. Then go one step further: in a ConsentFix attack the sign-in happens from the victim's browser, but the token is used from the attacker's machine. That shows up as the same user and app across two networks within a short window.
let DevToolApps = dynamic(["04b07795-8ddb-461a-bbee-02f9e1bf7b46", "1950a258-227b-4e31-a9cf-717495945fc2"]); let window = 1d; let Interactive = SigninLogs | where TimeGenerated > ago(window) | where AppId in (DevToolApps) and ResultType == "0" | project InteractiveTime = TimeGenerated, UserPrincipalName, AppId, InteractiveIP = IPAddress, InteractiveASN = AutonomousSystemNumber; AADNonInteractiveUserSignInLogs | where TimeGenerated > ago(window) | where AppId in (DevToolApps) and ResultType == "0" | join kind=inner Interactive on UserPrincipalName, AppId | where TimeGenerated between (InteractiveTime .. (InteractiveTime + 2h)) | where AutonomousSystemNumber != InteractiveASN | summarize ReplayIPs = make_set(IPAddress, 10), ReplayASNs = make_set(AutonomousSystemNumber, 10), Resources = make_set(ResourceDisplayName, 10), Uses = count() by UserPrincipalName, AppId, InteractiveTime, InteractiveIP, InteractiveASN
Inventory what's already granted
Detections only catch new grants. Most tenants already have years of user consents nobody has looked at, and some of them will be bad. Run this once, then quarterly. It lists every delegated grant with a risky scope, who granted it, and whether the app has a verified publisher.
Connect-MgGraph -Scopes "Directory.Read.All" $risky = 'Mail.Read','Mail.ReadBasic','Mail.ReadWrite','Mail.Send','MailboxSettings.ReadWrite', 'Files.Read.All','Files.ReadWrite.All','Sites.Read.All','Sites.ReadWrite.All', 'Chat.Read','Chat.ReadWrite','Contacts.Read','Notes.Read.All','EWS.AccessAsUser.All', 'Directory.ReadWrite.All','Application.ReadWrite.All' $spCache = @{} Get-MgOauth2PermissionGrant -All | ForEach-Object { $grant = $_ $hits = ($grant.Scope -split ' ') | Where-Object { $_ -and ($risky -contains $_) } if ($hits) { if (-not $spCache.ContainsKey($grant.ClientId)) { $spCache[$grant.ClientId] = Get-MgServicePrincipal -ServicePrincipalId $grant.ClientId } $sp = $spCache[$grant.ClientId] [pscustomobject]@{ App = $sp.DisplayName AppId = $sp.AppId Publisher = $sp.VerifiedPublisher.DisplayName # empty = unverified ConsentType = $grant.ConsentType # AllPrincipals = admin, Principal = one user PrincipalId = $grant.PrincipalId RiskyScopes = $hits -join ' ' } } } | Sort-Object Publisher, App | Export-Csv .\oauth-risky-grants.csv -NoTypeInformation
Sort by an empty Publisher first. Unverified apps holding mail or file scopes, granted by a single user, are where you'll find the old compromises.
Response: remove the grant, not just the password
The standard account-compromise playbook (reset password, revoke sessions) is not enough for an illicit consent grant. The app's grant lives on the service principal, and as long as it's there, the attacker can keep using it. Order of operations:
- Disable the service principal. This stops new tokens being issued to the app tenant-wide, which matters if more than one user consented.
- Remove the delegated grants and any app role assignments the app holds.
- Revoke the user's sessions so existing refresh tokens die. For ConsentFix this is the main step, because there's no malicious app to remove, just tokens issued to a legitimate Microsoft app.
- Scope the damage with detection 3's query: every Graph call the app made, per user, since consent.
- Find the other victims. Search
AuditLogsfor consents to the same AppId across the whole tenant, and search email for the lure.
$spId = "<service principal object id>" $upn = "victim@contoso.com" Connect-MgGraph -Scopes "Application.ReadWrite.All","DelegatedPermissionGrant.ReadWrite.All", "AppRoleAssignment.ReadWrite.All","User.RevokeSessions.All" # 1. Stop the app getting new tokens anywhere in the tenant Update-MgServicePrincipal -ServicePrincipalId $spId -AccountEnabled:$false # 2. Remove delegated grants and application permissions held by the app Get-MgOauth2PermissionGrant -Filter "clientId eq '$spId'" -All | ForEach-Object { Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId $_.Id } Get-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $spId -All | ForEach-Object { Remove-MgServicePrincipalAppRoleAssignment -ServicePrincipalId $spId -AppRoleAssignmentId $_.Id } # 3. Kill the victim's refresh tokens Revoke-MgUserSignInSession -UserId $upn
The settings that actually stop this
- Restrict user consent. In Entra ID user consent settings, either disallow user consent entirely or allow it only for verified publishers and low-impact permissions you've classified. This one setting kills most of variant 1.
- Turn on the admin consent workflow so users can still request apps. If blocking consent means users are stuck, they'll find workarounds, so give them a request path with a reviewer behind it.
- Lock down the first-party developer tools. Create service principals for Azure CLI and Azure PowerShell in your tenant if they don't exist, set "assignment required", and assign only the groups that need them. Non-developers then can't complete the sign-in that ConsentFix depends on. Test with your cloud team first.
- Block device code flow with the Conditional Access authentication flows condition, with an excluded group for the few people who need it.
- Use app governance in Defender for Cloud Apps if you have it. It flags overprivileged and unused apps, and apps whose Graph usage changes suddenly.
Tightening consent settings doesn't revoke anything already granted. If you change the setting today and skip the inventory, every app consented over the last five years still has its access.
FIDO2 was the right investment, and it pushed attackers here. Now that the consent layer is the target, the grant needs the same scrutiny as the sign-in, and the logs to watch it are already in your workspace.
Every issue includes a full detection rule for Sentinel, CrowdStrike or Splunk, with investigation steps, false positive guidance and MITRE mapping. Platforms rotate so you get broad coverage over time.
Join — $14.99/mo See a Sample Issue