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.

2 min readAdvanced

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

  1. The attacker registers a multi-tenant app with a trustworthy-sounding name and logo ("Document Viewer", "Teams Calendar Sync").
  2. The victim receives a link to the real login.microsoftonline.com consent prompt.
  3. The prompt requests delegated permissions, often including offline_access for long-lived refresh tokens.
  4. 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

kusto
// 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 desc

Apps 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.

kusto
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 desc

New 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.

kusto
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, OperationName

Tune 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

  1. Disable the malicious service principal and revoke its OAuth grants.
  2. Revoke the affected users' refresh tokens.
  3. Review mailbox rules, forwarding and sent items for follow-on abuse.
  4. 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

HackersRoot Research · Research team

The HackersRoot research team investigates attack techniques across AI systems, cloud and identity, and enterprise networks, then publishes the detections and hardening guidance that stop them.

More from HackersRoot →

Related research