THREAT-M365-SuspiciousOAuthConsent Elastic Security · Elastic

Detect Suspicious OAuth Application Consent Grant in Microsoft 365 in Elastic Security

Illicit OAuth consent grants are a persistent M365 attack vector where users are tricked into granting third-party applications excessive permissions to their Microsoft 365 data. Attackers register OAuth apps with convincing names ('HR Document Portal', 'Microsoft Security Update', 'Teams Bot') and send phishing emails directing users to 'consent' to the app. Once consented, the attacker's app has persistent API access (often with Mail.Read, Contacts.Read, Files.Read, or offline_access) without needing the user's credentials or bypassing MFA. Microsoft documented Storm-0558 and Midnight Blizzard using this technique. NCSC UK warns that illicit consent grants are particularly effective against SMBs because many lack admin consent workflows. Attackers can also use 'consent phishing' through OAuth apps registered in the same Entra ID tenant after initial compromise.

MITRE ATT&CK

Tactic
Credential Access Collection

Elastic Detection Query

Elastic Security (Elastic)
eql
any where event.dataset == "azure.auditlogs"
  and event.action in~ (
    "Consent to application",
    "Add delegated permission grant",
    "Add OAuth2PermissionGrant",
    "Add app role assignment to service principal"
  )
  and event.outcome == "success"
  and (
    azure.auditlogs.properties.additional_details : (
      "*Mail.Read*", "*Mail.ReadWrite*", "*Mail.Send*",
      "*Files.Read.All*", "*Files.ReadWrite.All*",
      "*offline_access*", "*Directory.Read.All*",
      "*User.Read.All*", "*User.ReadWrite.All*",
      "*Contacts.Read*", "*Contacts.ReadWrite*",
      "*Sites.Read.All*", "*Sites.ReadWrite.All*",
      "*MailboxSettings.ReadWrite*", "*Calendars.ReadWrite*",
      "*Group.Read.All*", "*Mail.ReadBasic.All*"
    )
    or event.action in~ ("Add app role assignment to service principal")
    or azure.auditlogs.properties.additional_details : "*admin consent*"
  )
high severity high confidence

Detects illicit OAuth consent grants in Azure AD / Entra ID where users or administrators grant third-party applications sensitive API permissions covering mail, files, contacts, calendar, and directory access. Covers consent phishing techniques attributed to Storm-0558 and Midnight Blizzard threat actors. A secondary hunting angle targets first-time application consents by joining against a 90-day baseline of previously seen app IDs.

Data Sources

Azure Active Directory Audit Logs via Elastic Azure integrationMicrosoft Entra ID Audit LogsAzure Monitor Diagnostic Logs forwarded to Elastic

Required Tables

azure.auditlogs

False Positives & Tuning

  • Legitimate IT-sanctioned enterprise application deployments where administrators intentionally grant broad OAuth permissions to approved productivity or security tools such as Salesforce, Workday, or ServiceNow M365 connectors
  • Microsoft first-party or rebranded applications appearing as new consents during tenant migrations, license tier upgrades, or Microsoft Entra policy changes that require re-consent
  • Automated provisioning workflows including Azure DevOps service principals and Power Automate connectors legitimately requesting delegated or application permissions as part of CI/CD pipeline setup
Download portable Sigma rule (.yml)

Other platforms for THREAT-M365-SuspiciousOAuthConsent


Testing Methodology

Validate this detection against 1 adversary technique from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Illicit OAuth Consent Grant Simulation

    Expected signal: Azure AD Audit log records 'Consent to application' event with Mail.Read, offline_access, and Files.Read.All permissions for the test user.

Unlock Pro Content

Get the full detection package for THREAT-M365-SuspiciousOAuthConsent including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections