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.

 1`o365_graph` status.errorCode=65004
 2  
 3| rename userPrincipalName as user
 4  
 5| rename ipAddress as src_ip
 6  
 7| stats min(_time) as firstTime max(_time) as lastTime
 8    BY user src_ip appDisplayName
 9       status.failureReason
10  
11| `security_content_ctime(firstTime)`
12  
13| `security_content_ctime(lastTime)`
14  
15| `o365_user_consent_denied_for_oauth_application_filter`

Data Source

Name Platform Sourcetype Source
O365 Other 'o365:management:activity' 'o365'

Macros Used

Name Value
security_content_ctime convert timeformat="%Y-%m-%dT%H:%M:%S" ctime($field$)
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

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1528 Steal Application Access Token Credential Access
Exploitation
DE.CM
CIS 10

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 Finding (Notable) Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Intermediate Finding (Risk Event) No
TTP detections generate a Finding (Notable) and may generate Intermediate Findings (Risk Events) for associated entities.

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

Finding

Title Entity Field Entity Type Risk Score
User $user$ denifed consent for an OAuth application. user user 50

Threat Objects

Field Type
src_ip ip_address

References

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: 11