The OAuth App Asked For Permission
The sign-in looked legitimate.
MFA succeeded.
Then the user clicked Accept.
In this Agent Foskett investigation, we examine how OAuth consent abuse can provide access to Microsoft 365 data without stealing a password.
Investigation focus
Learn how OAuth consent abuse can grant application access to Microsoft 365 data even when MFA appears to work correctly.
The suspicious detail
A user approved an application that requested access to Microsoft 365 data. The request looked routine, but the application was not part of the organisation's normal software stack.
OAuth consent abuse is dangerous because it can survive password resets, avoid traditional phishing patterns and create persistent access through an app registration or service principal.
First hunt: find consent-related activity
- 1
- 2
- 3
- 4
- 5
- 6
- 7
CloudAppEvents | where Timestamp > ago(30d) | where ActionType has_any ("Consent", "Grant", "Application", "OAuth") | project Timestamp, AccountDisplayName, ActionType, Application, IPAddress, RawEventData | order by Timestamp desc
Show me recent Microsoft 365 activity where users or administrators may have granted application permissions.
What Agent Foskett checks next
Second hunt: review service principal activity
- 1
- 2
- 3
- 4
- 5
- 6
- 7
AuditLogs | where TimeGenerated > ago(30d) | where OperationName has_any ("Add service principal", "Update service principal", "Consent to application") | project TimeGenerated, OperationName, InitiatedBy, TargetResources, Result | order by TimeGenerated desc
Third hunt: look for application access patterns
- 1
- 2
- 3
- 4
- 5
- 6
- 7
CloudAppEvents | where Timestamp > ago(30d) | where isnotempty(Application) | summarize EventCount = count(), Users = dcount(AccountDisplayName) by Application | order by EventCount desc
The investigation lesson
Sometimes the compromise begins with a legitimate-looking prompt and a user who clicks Accept. The attacker does not need to steal the password if the application has already been granted permission to access the data.
Common mistakes
Related Agent Foskett investigations and KQL guides
Continue with The User Passed MFA But It Wasn't Really Them, The Session Token Never Expired, The Conditional Access Policy Was In Report-Only Mode, KQL Threat Hunting Guide, Agent Foskett Academy, Microsoft Security and the GEMXIT Security Review.
Develop IT. Protect IT. GEMXIT PTY LTD | GEMXIT UK LTD