ID | Technique | Tactic |
---|---|---|
T1098.003 | Additional Cloud Roles | Persistence |
T1098 | Account Manipulation | Privilege Escalation |
Detection: Azure AD Service Principal Privilege Escalation
Description
This detection identifies when an Azure Service Principal elevates privileges by adding themself to a new app role assignment.
Search
1`azure_monitor_aad` category=AuditLogs operationName="Add app role assignment to service principal" properties.initiatedBy.app.displayName=* properties.result=Success
2| spath path=properties{}.targetResources{}.modifiedProperties{} output=targetResources
3| stats min(_time) as _time values(eval(mvfilter(match(targetResources, "AppRole.Value")))) as appRole, values(eval(mvfilter(match(targetResources, "ServicePrincipal.DisplayName")))) as targetServicePrincipal values(eval(mvindex('properties.targetResources{}.displayName',0))) as targetAppContext values(user_agent) as user_agent values(identity) as servicePrincipal values(properties.initiatedBy.app.servicePrincipalId) as servicePrincipalId by operationName tenantId correlationId
4| spath input=appRole path=newValue output=appRole
5| spath input=targetServicePrincipal path=newValue output=targetServicePrincipal
6| eval appRole=trim(replace(appRole, "\"", "")), targetServicePrincipal=trim(replace(targetServicePrincipal, "\"", ""))
7| where servicePrincipal=targetServicePrincipal
8| table _time operationName servicePrincipal servicePrincipalId appRole targetAppContext user_agent tenantId correlationId
9| `azure_ad_service_principal_privilege_escalation_filter`
Data Source
Name | Platform | Sourcetype | Source |
---|---|---|---|
Azure Active Directory Add app role assignment to service principal | Azure | 'azure:monitor:aad' |
'Azure AD' |
Macros Used
Name | Value |
---|---|
azure_monitor_aad | sourcetype=azure:monitor:aad |
azure_ad_service_principal_privilege_escalation_filter | search * |
azure_ad_service_principal_privilege_escalation_filter
is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
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 Notable | Yes |
Rule Title | %name% |
Rule Description | %description% |
Notable Event Fields | user, dest |
Creates Risk Event | True |
Implementation
The Splunk Add-on for Microsoft Cloud Services add-on is required to ingest EntraID audit logs via Azure EventHub. See reference for links for further details on how to onboard this log source.
Known False Positives
Unknown
Associated Analytic Story
Risk Based Analytics (RBA)
Risk Message:
Service Principal $servicePrincipal$ has elevated privileges by adding themself to app role $appRole$
Risk Object | Risk Object Type | Risk Score | Threat Objects |
---|---|---|---|
servicePrincipal | user | 100 | user_agent |
References
-
https://docs.splunk.com/Documentation/AddOns/released/MSCloudServices/Install
-
https://posts.specterops.io/microsoft-breach-what-happened-what-should-azure-admins-do-da2b7e674ebc
Detection Testing
Test Type | Status | Dataset | Source | Sourcetype |
---|---|---|---|---|
Validation | ✅ Passing | N/A | N/A | N/A |
Unit | ✅ Passing | Dataset | Azure AD |
azure:monitor:aad |
Integration | ✅ Passing | Dataset | Azure AD |
azure:monitor:aad |
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: 1