Detecting OAuth Consent Phishing in Microsoft Entra ID
Consent phishing skips passwords and MFA entirely: the victim grants a malicious app access to their mailbox or files. How illicit consent grants work, KQL to find them in Entra ID audit logs, and the tenant settings that stop them.
OAuth consent phishing (Microsoft calls it an illicit consent grant) is one of the most effective ways into a Microsoft 365 tenant, because it never touches the user's password or MFA. The attacker registers an application, sends the victim a link to a genuine Microsoft sign-in page, and asks for permissions such as Mail.Read or Files.ReadWrite.All. One click on Accept and the app holds a token that keeps working after the user changes their password.
How the attack works
- The attacker registers a multi-tenant app with a trustworthy-sounding name and logo ("Document Viewer", "Teams Calendar Sync").
- The victim receives a link to the real
login.microsoftonline.comconsent prompt. - The prompt requests delegated permissions, often including
offline_accessfor long-lived refresh tokens. - After consent, the attacker uses Microsoft Graph to read mail, download files or send phishing from the victim's account.
Because the sign-in is legitimate, password resets and MFA don't revoke access. The grant has to be removed.
Detection with Entra ID audit logs
Every consent creates audit events. Forward Entra ID audit logs to Microsoft Sentinel or your SIEM and look for these patterns.
New consents to high-risk permissions
// User consents that include high-risk delegated permissions
AuditLogs
| where OperationName == "Consent to application"
| extend AppName = tostring(TargetResources[0].displayName),
User = tostring(InitiatedBy.user.userPrincipalName),
Props = tostring(TargetResources[0].modifiedProperties)
| where Props has_any ("Mail.Read", "Mail.ReadWrite", "Mail.Send", "Files.ReadWrite.All",
"Sites.ReadWrite.All", "offline_access", "Contacts.Read", "MailboxSettings.ReadWrite")
| project TimeGenerated, User, AppName, Result, Props
| order by TimeGenerated descApps consented by several users in a short window
A campaign usually hits many users. A sudden spread of consents to the same app is a strong signal.
AuditLogs
| where TimeGenerated > ago(1d) and OperationName == "Consent to application"
| extend AppId = tostring(TargetResources[0].id), AppName = tostring(TargetResources[0].displayName)
| summarize Users = dcount(tostring(InitiatedBy.user.userPrincipalName)), First = min(TimeGenerated)
by AppId, AppName
| where Users >= 3
| order by Users descNew credentials added to an existing app
Attackers who compromise an admin often add a secret to a trusted app instead of registering a new one.
AuditLogs
| where OperationName has_any ("Add service principal credentials", "Update application – Certificates and secrets management")
| extend App = tostring(TargetResources[0].displayName), Actor = tostring(InitiatedBy.user.userPrincipalName)
| project TimeGenerated, Actor, App, OperationNameTune by excluding your approved app IDs, and enrich alerts with the publisher verification status of the app.
Prevention: tenant settings that matter
- Restrict user consent. In Entra ID → Enterprise applications → Consent and permissions, allow users to consent only to apps from verified publishers requesting low-risk permissions, or disable user consent entirely.
- Turn on the admin consent workflow so users can request access and admins review it.
- Review existing grants regularly: list OAuth permission grants and remove unused or suspicious apps.
- Use app governance / Defender for Cloud Apps policies to flag apps with high privileges and low prevalence.
- Train users to treat unexpected consent prompts like attachments from strangers.
Response checklist
- Disable the malicious service principal and revoke its OAuth grants.
- Revoke the affected users' refresh tokens.
- Review mailbox rules, forwarding and sent items for follow-on abuse.
- Search for the same app ID across the tenant and block it.
Key takeaways
- Consent phishing bypasses passwords and MFA. Removing the grant is the only fix.
- Audit logs record every consent: alert on high-risk permissions and multi-user spread.
- Restricting user consent to verified publishers and low-risk scopes prevents most attacks.
Further reading
Related research
The Key Nobody Retired: How a Forgotten AI-Vendor Credential Breached Barracuda's Cloud in 44 Hours
Barracuda has owned a hard truth: a cloud access key it handed a third-party AI vendor, and never retired when the work ended, was leaked and used to reach around ten of its cloud accounts in 44 hours. It is a textbook non-human identity failure. Here is the timeline, the blast radius, and how to make sure your own forgotten keys can't do this.
Hunting Agentic AI Intrusions in AWS: CloudTrail Detections for Machine-Speed Recon
An AI-driven intrusion doesn't look like a human operator. It looks like hundreds of API calls across dozens of AWS services in half an hour, most of them denied, and one that isn't. How agentic attack frameworks behave in the cloud, the CloudTrail signals that give them away, and the controls that make a stolen key worthless.
AiTM Phishing and Session Token Theft in Microsoft 365: Detection and Defence
Adversary-in-the-middle phishing doesn't break MFA, it walks around it: the victim completes a real sign-in and the attacker keeps the session cookie. How the attack works, the telemetry that exposes it, KQL detections for Entra ID, and the controls that make stolen tokens worthless.