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) using OAuth-authenticated applications. It leverages the ClientInfoString field to identify EWS interactions and aggregates metrics such as access counts, timing, and client IP addresses, categorized by user, ClientAppId, OperationCount, and AppId. Monitoring OAuth applications accessing emails through EWS is crucial for identifying potential abuse or unauthorized data access. If confirmed malicious, this activity could lead to unauthorized email access, data exfiltration, or further compromise of sensitive information.

Query · spl

`o365_management_activity` Workload=Exchange Operation=MailItemsAccessed AppId=* ClientAppId=*
  | regex ClientInfoString="^Client=WebServices;ExchangeWebServices"
  | fillnull
  | stats count earliest(_time) as firstTime latest(_time) as lastTime values(ClientIPAddress) as src
    BY user ClientAppId OperationCount
       AppId vendor_account vendor_product
       dest signature ClientInfoString
  | `security_content_ctime(firstTime)`
  | `security_content_ctime(lastTime)`
  | `o365_oauth_app_mailbox_access_via_ews_filter`

Implementation guide

You must install the Splunk Microsoft Office 365 Add-on and ingest Office 365 management activity events.

Known false positives

  • OAuth applications may access mailboxes for legitimate purposes, you can use the src_ip to add trusted sources to an allow list.

Analyst notes

Known false positives: OAuth applications may access mailboxes for legitimate purposes, you can use the src_ip to add trusted sources to an allow list.

Raw source O365 OAuth App Mailbox Access via EWS · SPL
Esc
Published by splunk/security_content ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
name: O365 OAuth App Mailbox Access via EWS
id: e600cf1a-0bef-4426-b42e-00176d610a4d
version: 11
creation_date: '2024-02-14'
modification_date: '2026-05-13'
author: Mauricio Velazco, Splunk
status: production
type: TTP
description: The following analytic detects when emails are accessed in Office 365 Exchange via Exchange Web Services (EWS) using OAuth-authenticated applications. It leverages the ClientInfoString field to identify EWS interactions and aggregates metrics such as access counts, timing, and client IP addresses, categorized by user, ClientAppId, OperationCount, and AppId. Monitoring OAuth applications accessing emails through EWS is crucial for identifying potential abuse or unauthorized data access. If confirmed malicious, this activity could lead to unauthorized email access, data exfiltration, or further compromise of sensitive information.
data_source:
    - O365 MailItemsAccessed
search: |-
    `o365_management_activity` Workload=Exchange Operation=MailItemsAccessed AppId=* ClientAppId=*
      | regex ClientInfoString="^Client=WebServices;ExchangeWebServices"
      | fillnull
      | stats count earliest(_time) as firstTime latest(_time) as lastTime values(ClientIPAddress) as src
        BY user ClientAppId OperationCount
           AppId vendor_account vendor_product
           dest signature ClientInfoString
      | `security_content_ctime(firstTime)`
      | `security_content_ctime(lastTime)`
      | `o365_oauth_app_mailbox_access_via_ews_filter`
how_to_implement: You must install the Splunk Microsoft Office 365 Add-on and ingest Office 365 management activity events.
known_false_positives: OAuth applications may access mailboxes for legitimate purposes, you can use the src_ip to add trusted sources to an allow list.
references:
    - https://attack.mitre.org/techniques/T1114/002/
    - https://www.microsoft.com/en-us/security/blog/2024/01/25/midnight-blizzard-guidance-for-responders-on-nation-state-attack/
    - https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/ews-applications-and-the-exchange-architecture
drilldown_searches:
    - name: View the detection results for - "$user$"
      search: '%original_detection_search% | search  user = "$user$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$user$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$user$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
      earliest_offset: 7d
      latest_offset: "0"
finding:
    title: An OAuth application identified with id $ClientAppId$ accesed mailboxes through the Graph API.
    entity:
        field: user
        type: user
        score: 50
analytic_story:
    - Office 365 Collection Techniques
    - NOBELIUM Group
asset_type: O365 Tenant
mitre_attack_id:
    - T1114.002
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: cloud
security_domain: threat
tests:
    - name: True Positive Test
      attack_data:
        - data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1114.002/o365_oauth_app_ews_mailbox_access/o365_oauth_app_ews_mailbox_access.log
          sourcetype: o365:management:activity
          source: o365
      test_type: unit

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.