LoFP LoFP / administrators may legitimately assign the privileged roles to service principals as part of administrative tasks. filter as needed.

Techniques

Sample rules

Azure AD Privileged Role Assigned to Service Principal

Description

The following analytic detects potential privilege escalation threats in Azure Active Directory (AD). The detection is made by running a specific search within the ingested Azure Active Directory events to leverage the AuditLogs log category. This detection is important because it identifies instances where privileged roles that hold elevated permissions are assigned to service principals. This prevents unauthorized access or malicious activities, which occur when these non-human entities access Azure resources to exploit them. False positives might occur since administrators can legitimately assign privileged roles to service principals.

Detection logic

 `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) 
| lookup privileged_azure_ad_roles azureadrole AS role OUTPUT isprvilegedadrole description 
| search isprvilegedadrole = True 
| stats count min(_time) as firstTime max(_time) as lastTime values(displayName) as displayName by initiatedBy, result, operationName, role 
| `security_content_ctime(firstTime)` 
| `security_content_ctime(lastTime)` 
| `azure_ad_privileged_role_assigned_to_service_principal_filter`