Consent phishing: find risky OAuth apps in Microsoft 365
How consent phishing (illicit consent grant) gives an attacker mailbox access without a password, how to find risky OAuth apps and consents in Entra ID with the audit log and PowerShell, and how to revoke them and stop it happening again.
Consent phishing doesn't steal a password. The user clicks a link, signs in to the real Microsoft login page with their real MFA, and then sees a genuine Microsoft prompt: "Mailbox Sync wants to read your mail and maintain access to data you have given it access to." They click Accept. From that moment an app the attacker controls can read their mail through Microsoft Graph, and it keeps working after you reset the password.
Microsoft calls this an illicit consent grant. It's harder to spot than credential phishing because nothing about the sign-in looks wrong: right user, right MFA, often the user's own IP. The evidence is in the app consents and the audit log, which is where this guide looks for risky OAuth apps in Microsoft 365.
How does consent phishing work?
The attacker registers a multitenant app in their own Entra tenant, gives it a believable name and logo, and asks for delegated permissions such as Mail.Read and offline_access. The phishing email links to a normal Microsoft authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
?client_id=7f3c…&response_type=code
&redirect_uri=https://mailbox-sync.example/callback
&scope=Mail.Read%20Mail.Send%20offline_access
Every link in that chain is real Microsoft infrastructure until the final redirect, so URL filters and user training aimed at fake login pages don't catch it. Once the user consents, the app receives a refresh token. offline_access is the permission that lets it keep getting new access tokens for weeks without the user being present.
Why MFA doesn't help here: the user did complete MFA. The app isn't signing in as the user with a password; it holds a token the user willingly granted. That's also why a password reset on its own doesn't end the access.
Which permissions should worry me?
Not every consent is a problem. Plenty of legitimate apps ask for User.Read to show your name and photo. The ones worth a closer look are the permissions that read or send data:
| Permission | What the app can do |
|---|---|
Mail.Read, Mail.ReadWrite | Read (and change or delete) everything in the mailbox |
Mail.Send | Send mail as the user, which is ideal for internal phishing |
MailboxSettings.ReadWrite | Create forwarding and inbox rules |
Files.Read.All, Files.ReadWrite.All, Sites.Read.All | Every OneDrive and SharePoint file the user can open |
Contacts.Read, People.Read | The user's contacts, to pick the next targets |
full_access_as_user (EWS) | Full mailbox access through Exchange Web Services |
offline_access | Keep access without the user present. Harmless alone, but it turns any of the above into persistent access |
Application permissions (as opposed to delegated) need admin consent and apply to every mailbox, not one user. An unknown app holding Mail.Read as an application permission is the worst case you can find in this review.
How do I find risky OAuth apps in the tenant?
Start in the Entra admin center under Enterprise applications. Set the Application type filter to All applications, because the default view hides some. For each app you don't recognise, open Permissions and look at both the Admin consent and User consent tabs.
Clicking through doesn't scale past a few dozen apps. This Microsoft Graph PowerShell lists every delegated grant that touches mail, files or contacts, with the publisher and who granted it:
Connect-MgGraph -Scopes "Directory.Read.All"
$risky = 'Mail\.|Files\.|Sites\.|Contacts\.|MailboxSettings|full_access_as_user'
Get-MgOauth2PermissionGrant -All | Where-Object { $_.Scope -match $risky } | ForEach-Object {
$sp = Get-MgServicePrincipal -ServicePrincipalId $_.ClientId
[pscustomobject]@{
App = $sp.DisplayName
Publisher = $sp.VerifiedPublisher.DisplayName
OwnerTenant = $sp.AppOwnerOrganizationId
Scope = $_.Scope.Trim()
GrantedTo = if ($_.ConsentType -eq 'AllPrincipals') { 'All users' } else { (Get-MgUser -UserId $_.PrincipalId).UserPrincipalName }
GrantId = $_.Id
}
} | Sort-Object App | Format-Table -AutoSize
An empty Publisher means the publisher isn't verified. That alone doesn't make an app malicious (lots of small vendors never bother), but almost every consent phishing app is unverified.
What does a malicious app usually look like?
- A generic or Microsoft-sounding name: "Mail Sync", "Office 365 Security Update", "Secure Document Viewer". Microsoft's own apps belong to a Microsoft tenant and don't need a user to consent to mail access.
- Consented by one or two users, recently, rather than rolled out by IT to a department.
- A reply URL on a young or unrelated domain. You'll find it on the app's overview page; check it the way you'd check any suspicious domain.
- Consent granted minutes after a phishing email landed in the same mailbox.
- Heavy mail permissions for an app that has no reason to need them, such as a "PDF viewer" asking for
Mail.Send.
When was consent granted, and by whom?
The Entra audit log records every consent as Consent to application. If the logs go to Sentinel or Log Analytics, this query shows who consented to what, and with which permissions:
AuditLogs
| where TimeGenerated > ago(30d)
| where OperationName == "Consent to application"
| extend User = tostring(InitiatedBy.user.userPrincipalName),
App = tostring(TargetResources[0].displayName)
| mv-expand Prop = TargetResources[0].modifiedProperties
| where tostring(Prop.displayName) == "ConsentAction.Permissions"
| project TimeGenerated, User, App, Permissions = tostring(Prop.newValue), Result
| order by TimeGenerated desc
Without Sentinel, filter the audit log in the Entra admin center by Activity: Consent to application. Then open the user's non-interactive sign-ins and filter by the app name: that shows when the app actually used its token, and from which IPs. A legitimate SaaS app comes from its vendor's cloud ranges; an attacker's app often shows hosting providers or VPN exits.
How do I revoke the access?
- Disable the app first so it can't get new tokens while you investigate: on the enterprise app, set Enabled for users to sign in? to No, or run
Update-MgServicePrincipal -ServicePrincipalId <id> -AccountEnabled:$false. - Remove the grants with
Remove-MgOauth2PermissionGrant -OAuth2PermissionGrantId <GrantId>, then delete the enterprise app once you've kept what you need for the record. - Revoke the user's sessions with
Revoke-MgUserSignInSession. That invalidates refresh tokens already issued, including the one the app holds. - Check what the app did. Look for new inbox rules and forwarding (the inbox rules guide has the searches), sent mail the user didn't write, and OneDrive files accessed by the app.
- Find other victims. Search the audit log for the same app ID across all users. Consent phishing campaigns usually hit several people in one tenant on the same day.
How do I stop users consenting to risky apps?
The fix is a setting most small tenants have never touched. Under Enterprise applications > Consent and permissions > User consent settings, choose either Do not allow user consent or Allow user consent for apps from verified publishers, for selected permissions. The second option is a sensible middle ground: users can still sign in to well-known apps, but nothing unverified gets mail or file access without an admin.
Then turn on the admin consent workflow, so a blocked user can request the app instead of asking IT to open consent back up for everyone. Without the workflow, the first complaint from a manager tends to undo the whole change.
If you're also tightening sign-in controls, the MFA fatigue guide covers the other common way attackers get around MFA in Entra ID.
FAQ
Does resetting the password remove an OAuth app's access?
No. The app holds a token granted by consent, not the password. Remove the consent, disable the app and revoke the user's sessions; a password reset alone leaves the app working.
Does MFA protect against consent phishing?
No. The user completes MFA as part of the attack. Restricting user consent to verified publishers and low-risk permissions is what blocks it.
What is the difference between delegated and application permissions?
Delegated permissions act as one signed-in user and only reach what that user can reach. Application permissions act as the app itself across the whole tenant and always need admin consent, which makes an unknown app with application permissions far more serious.
Is an unverified publisher always malicious?
No. Many small vendors and internal tools are unverified. Treat it as a reason to look closer, together with the permissions, the reply URL and who consented.
M365 Posture Scanner checks whether users can consent to apps on their own and lists third-party apps holding mail and file permissions, with publisher and who granted them. Read-only, runs in your browser.
IOC Triage, our free browser extension: right-click the redirect domain or the IP that granted consent for a verdict from 15 threat-intel sources, then copy a ticket note.