LoFP LoFP / oauth applications may access mailboxes for legitimate purposes, you can use the clientappid to add trusted applications to an allow list.

Sample rules

O365 OAuth App Mailbox Access via Graph API

Description

This Splunk analytic detects when emails are accessed in Office 365 Exchange via the Microsoft Graph API, identified by the client ID ‘00000003-0000-0000-c000-000000000000’. It tracks the ‘MailItemsAccessed’ operation within the Exchange workload, focusing on OAuth-authenticated applications. The query compiles statistics on access frequency, timing, and client IP addresses, organized by user, client application ID, and AppId. For defenders, it’s crucial to maintain an inventory of all OAuth applications that read emails, using this data to scrutinize and identify any potential abusive access patterns.

Detection logic

 `o365_management_activity` Workload=Exchange Operation=MailItemsAccessed AppId=* AppId=00000003-0000-0000-c000-000000000000 
|  stats count earliest(_time) as firstTime latest(_time) as lastTime values(ClientIPAddress) by user ClientAppId OperationCount AppId 
| `security_content_ctime(firstTime)` 
| `security_content_ctime(lastTime)` 
| `o365_oauth_app_mailbox_access_via_graph_api_filter`

O365 OAuth App Mailbox Access via EWS

Description

The following analytic detects when emails are accessed in Office 365 Exchange via Exchange Web Services (EWS), as indicated by the ClientInfoString field starting with “Client=WebServices;ExchangeWebServices”. It monitors mailbox activities, focusing on OAuth-authenticated applications that interact with EWS. The query aggregates key metrics such as access counts, timing, and client IP addresses, categorized by user, ClientAppId, OperationCount, and AppId. For defenders, it is critical to keep track of OAuth applications using EWS to access emails, as this information is instrumental in identifying and preventing potential abuse or unauthorized data access.

Detection logic

 `o365_management_activity` Workload=Exchange Operation=MailItemsAccessed AppId=* ClientAppId=* 
| regex ClientInfoString="^Client=WebServices;ExchangeWebServices" 
|  stats count earliest(_time) as firstTime latest(_time) as lastTime values(ClientIPAddress) as src_ip by user ClientAppId OperationCount AppId ClientInfoString 
| `security_content_ctime(firstTime)` 
| `security_content_ctime(lastTime)` 
| `o365_oauth_app_mailbox_access_via_ews_filter`