Detect Suspicious OAuth Application Consent Grant in Microsoft 365 in Splunk
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
SPL Detection Query
index=azure sourcetype="azure:aad:audit"
OperationName IN ("Consent to application", "Add delegated permission grant",
"Add OAuth2PermissionGrant", "Add app role assignment to service principal")
Result="success"
| spath input=TargetResources path="{0}.displayName" output=AppName
| spath input=AdditionalDetails path="{}.value" output=PermissionDetails
| spath input=InitiatedBy path="user.userPrincipalName" output=ConsentorUPN
| spath input=InitiatedBy path="user.ipAddress" output=ConsentorIP
| eval sensitive_perms=if(
match(PermissionDetails, "(?i)(Mail\.Read|Mail\.ReadWrite|Mail\.Send|Files\.Read|Files\.ReadWrite|offline_access|Directory\.Read|User\.Read\.All|Contacts\.Read|Sites\.Read)"),
"YES", "NO"
)
| where sensitive_perms="YES" OR OperationName="Add app role assignment to service principal"
| stats count AS ConsentEvents,
values(AppName) AS AppsConsented,
values(PermissionDetails) AS Permissions,
values(ConsentorUPN) AS ConsentingUsers
BY ConsentorIP, _time span=24h
| eval ThreatType="SuspiciousOAuth_ConsentGrant"
| eval ThreatActors="Midnight Blizzard, Storm-0558, Fancy Bear"
| sort - ConsentEvents SPL detection for illicit OAuth consent grants in Microsoft 365. Monitors Azure AD Audit logs for application consent operations that include sensitive permissions (mail, files, directory read access) and flags them for review.
Data Sources
Required Sourcetypes
False Positives & Tuning
- IT admin deploying approved SaaS integrations
- Microsoft 365 app setup wizard granting permissions for productivity tools
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.
- 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.