Detection rules › Splunk

O365 ApplicationImpersonation Role Assigned

Status
production
Severity
medium
Group by
aws::recipientAccountId, dest, signature, src, target_user, user, vendor_product
Author
Mauricio Velazco, Splunk
Source
github.com/splunk/security_content

The following analytic detects the assignment of the ApplicationImpersonation role in Office 365 to a user or application. It uses the Office 365 Management Activity API to monitor Azure Active Directory audit logs for role assignment events. This activity is significant because the ApplicationImpersonation role allows impersonation of any user, enabling access to and modification of their mailbox. If confirmed malicious, an attacker could gain unauthorized access to sensitive information, manipulate mailbox data, and perform actions as a legitimate user, posing a severe security risk to the organization.

MITRE ATT&CK coverage

Rule body splunk

name: O365 ApplicationImpersonation Role Assigned
id: 49cdce75-f814-4d56-a7a4-c64ec3a481f2
version: 11
creation_date: '2023-12-06'
modification_date: '2026-05-13'
author: Mauricio Velazco, Splunk
status: production
type: TTP
description: The following analytic detects the assignment of the ApplicationImpersonation role in Office 365 to a user or application. It uses the Office 365 Management Activity API to monitor Azure Active Directory audit logs for role assignment events. This activity is significant because the ApplicationImpersonation role allows impersonation of any user, enabling access to and modification of their mailbox. If confirmed malicious, an attacker could gain unauthorized access to sensitive information, manipulate mailbox data, and perform actions as a legitimate user, posing a severe security risk to the organization.
data_source:
    - O365
search: |-
    `o365_management_activity` Workload=Exchange Operation="New-ManagementRoleAssignment" Role=ApplicationImpersonation
      | rename User as target_user
      | fillnull
      | stats count min(_time) as firstTime max(_time) as lastTime
        BY signature dest user
           src vendor_account vendor_product
           target_user
      | `security_content_ctime(lastTime)`
      | `o365_applicationimpersonation_role_assigned_filter`
how_to_implement: You must install the Splunk Microsoft Office 365 Add-on and ingest Office 365 management activity events.
known_false_positives: While infrequent, the ApplicationImpersonation role may be granted for leigimate reasons, filter as needed.
references:
    - https://attack.mitre.org/techniques/T1098/002/
    - https://www.mandiant.com/resources/blog/remediation-and-hardening-strategies-for-microsoft-365-to-defend-against-unc2452
    - https://www.mandiant.com/media/17656
drilldown_searches:
    - name: View the detection results for - "$target_user$" and "$user$"
      search: '%original_detection_search% | search  target_user = "$target_user$" user = "$user$"'
      earliest_offset: $info_min_time$
      latest_offset: $info_max_time$
    - name: View risk events for the last 7 days for - "$target_user$" and "$user$"
      search: '| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$target_user$", "$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: $user$ granted the ApplicationImpersonation role to $target_user$
    entity:
        field: user
        type: user
        score: 50
intermediate_findings:
    entities:
        - field: target_user
          type: user
          score: 50
          message: $user$ granted the ApplicationImpersonation role to $target_user$
analytic_story:
    - Office 365 Persistence Mechanisms
    - Office 365 Collection Techniques
    - NOBELIUM Group
asset_type: O365 Tenant
mitre_attack_id:
    - T1098.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/T1098.002/application_impersonation_role_assigned/application_impersonation_role_assigned.log
          source: O365
          sourcetype: o365:management:activity
      test_type: unit

Stages and Predicates

Stage 1: search

`o365_management_activity` Workload=Exchange Operation="New-ManagementRoleAssignment" Role=ApplicationImpersonation

Stage 2: rename

| rename User as target_user

Stage 3: fillnull

| fillnull

Stage 4: stats

| stats count min(_time) as firstTime max(_time) as lastTime
    BY signature dest user
       src vendor_account vendor_product
       target_user

Stage 5: search

| `security_content_ctime(lastTime)`

Stage 6: search

| `o365_applicationimpersonation_role_assigned_filter`

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
Operationeq
  • "New-ManagementRoleAssignment"
Roleeq
  • ApplicationImpersonation
Workloadeq
  • Exchange
sourcetypeeq
  • o365:management:activity