ID | Technique | Tactic |
---|---|---|
T1528 | Steal Application Access Token | Credential Access |
Detection: O365 User Consent Denied for OAuth Application
Description
The following analytic identifies instances where a user has denied consent to an OAuth application seeking permissions within the Office 365 environment. This detection leverages O365 audit logs, focusing on events related to user consent actions. By filtering for denied consent actions associated with OAuth applications, it captures instances where users have actively rejected permission requests. This activity is significant as it may indicate users spotting potentially suspicious or unfamiliar applications. If confirmed malicious, it suggests an attempt by a potentially harmful application to gain unauthorized access, which was proactively blocked by the user.
Search
1`o365_graph` status.errorCode=65004
2| rename userPrincipalName as user
3| rename ipAddress as src_ip
4| stats max(_time) as lastTime by user src_ip appDisplayName status.failureReason
5| `security_content_ctime(lastTime)`
6| `o365_user_consent_denied_for_oauth_application_filter`
Data Source
Name | Platform | Sourcetype | Source | Supported App |
---|---|---|---|---|
O365 | N/A | 'o365:management:activity' |
'o365' |
N/A |
Macros Used
Name | Value |
---|---|
o365_graph | sourcetype=o365:graph:api |
o365_user_consent_denied_for_oauth_application_filter | search * |
o365_user_consent_denied_for_oauth_application_filter
is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
Setting | Value |
---|---|
Disabled | true |
Cron Schedule | 0 * * * * |
Earliest Time | -70m@m |
Latest Time | -10m@m |
Schedule Window | auto |
Creates Notable | Yes |
Rule Title | %name% |
Rule Description | %description% |
Notable Event Fields | user, dest |
Creates Risk Event | True |
Implementation
You must install the Splunk Microsoft Office 365 Add-on and ingest Office 365 events.
Known False Positives
OAuth applications that require mail permissions may be legitimate, investigate and filter as needed.
Associated Analytic Story
Risk Based Analytics (RBA)
Risk Message | Risk Score | Impact | Confidence |
---|---|---|---|
User $user$ denifed consent for an OAuth application. | 30 | 30 | 100 |
References
-
https://learn.microsoft.com/en-us/defender-cloud-apps/investigate-risky-oauth
-
https://www.alteredsecurity.com/post/introduction-to-365-stealer
Detection Testing
Test Type | Status | Dataset | Source | Sourcetype |
---|---|---|---|---|
Validation | ✅ Passing | N/A | N/A | N/A |
Unit | ✅ Passing | Dataset | o365 |
o365:graph:api |
Integration | ✅ Passing | Dataset | o365 |
o365:graph:api |
Replay any dataset to Splunk Enterprise by using our replay.py
tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
Source: GitHub | Version: 3