Detection rules › Splunk

Azure AD Privileged Role Assigned to Service Principal

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

The following analytic detects the assignment of privileged roles to service principals in Azure Active Directory (AD). It leverages the AuditLogs log category from ingested Azure AD events. This activity is significant because assigning elevated permissions to non-human entities can lead to unauthorized access or malicious activities. If confirmed malicious, attackers could exploit these service principals to gain elevated access to Azure resources, potentially compromising sensitive data and critical infrastructure. Monitoring this behavior helps prevent privilege escalation and ensures the security of Azure environments.

Known false positives

  • Administrators may legitimately assign the privileged roles to Service Principals as part of administrative tasks. Filter as needed.

MITRE ATT&CK coverage

Telemetry coverage

PlatformRecord / event type
AzureAdd member to role

Rules detecting the same action

These rules filter on the same operation.

Rule body

name: Azure AD Privileged Role Assigned to Service Principal
id: 5dfaa3d3-e2e4-4053-8252-16d9ee528c41
version: 14
creation_date: '2023-04-28'
modification_date: '2026-05-13'
author: Mauricio Velazco, Splunk
status: production
type: TTP
description: The following analytic detects the assignment of privileged roles to service principals in Azure Active Directory (AD). It leverages the AuditLogs log category from ingested Azure AD events. This activity is significant because assigning elevated permissions to non-human entities can lead to unauthorized access or malicious activities. If confirmed malicious, attackers could exploit these service principals to gain elevated access to Azure resources, potentially compromising sensitive data and critical infrastructure. Monitoring this behavior helps prevent privilege escalation and ensures the security of Azure environments.
data_source:
    - Azure Active Directory Add member to role
search: |-
    `azure_monitor_aad` operationName="Add member to role"
      | rename properties.* as *
      | search "targetResources{}.type"=ServicePrincipal
      | rename initiatedBy.user.userPrincipalName as initiatedBy
      | rename targetResources{}.modifiedProperties{}.newValue as roles
      | eval role=mvindex(roles,1)
      | rename targetResources{}.displayName as apps
      | eval displayName=mvindex(apps,0)
      | fillnull
      | stats count min(_time) as firstTime max(_time) as lastTime
        BY dest user src
           vendor_account vendor_product displayName
           initiatedBy result role
           signature
      | lookup privileged_azure_ad_roles azureadrole AS role OUTPUT isprvilegedadrole description
      | search isprvilegedadrole = True
      | `security_content_ctime(firstTime)`
      | `security_content_ctime(lastTime)`
      | `azure_ad_privileged_role_assigned_to_service_principal_filter`
how_to_implement: You must install the latest version of Splunk Add-on for Microsoft Cloud Services from Splunkbase (https://splunkbase.splunk.com/app/3110/#/details). You must be ingesting Azure Active Directory events into your Splunk environment. This analytic was written to be used with the azure:monitor:aad sourcetype leveraging the AuditLog log category.
known_false_positives: Administrators may legitimately assign the privileged roles to Service Principals as part of administrative tasks. Filter as needed.
references:
    - https://posts.specterops.io/azure-privilege-escalation-via-service-principal-abuse-210ae2be2a5
finding:
    title: A privileged Azure AD role was assigned to the Service Principal $displayName$ initiated by $initiatedBy$
    entity:
        field: initiatedBy
        type: user
        score: 50
analytic_story:
    - Azure Active Directory Privilege Escalation
    - NOBELIUM Group
    - Scattered Lapsus$ Hunters
asset_type: Azure Active Directory
mitre_attack_id:
    - T1098.003
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: cloud
security_domain: identity

Stages and Predicates

Stage 1: search

`azure_monitor_aad` operationName="Add member to role"

Stage 2: rename

| rename properties.* as *

Stage 3: search

| search "targetResources{}.type"=ServicePrincipal

Stage 4: rename

| rename initiatedBy.user.userPrincipalName as initiatedBy

Stage 5: rename

| rename targetResources{}.modifiedProperties{}.newValue as roles

Stage 6: eval

| eval role=mvindex(roles,1)

Stage 7: rename

| rename targetResources{}.displayName as apps

Stage 8: eval

| eval displayName=mvindex(apps,0)

Stage 9: fillnull

| fillnull

Stage 10: stats

| stats count min(_time) as firstTime max(_time) as lastTime
    BY dest user src
       vendor_account vendor_product displayName
       initiatedBy result role
       signature

Stage 11: lookup

| lookup privileged_azure_ad_roles azureadrole AS role OUTPUT isprvilegedadrole description
Lookup table
privileged_azure_ad_roles
Key field
azureadrole as role
Output columns
['isprvilegedadrole', 'isprvilegedadrole'], ['description', 'description']

Stage 12: search

| search isprvilegedadrole = True

Stage 13: search

| `security_content_ctime(firstTime)`

Stage 14: search

| `security_content_ctime(lastTime)`

Stage 15: search

| `azure_ad_privileged_role_assigned_to_service_principal_filter`

Indicators

These rows show field, operator, and value matches.