Azure AD Service Principal Created

 Original Source: [splunk source]
Name:Azure AD Service Principal Created
id:f8ba49e7-ffd3-4b53-8f61-e73974583c5d
version:11
date:None
author:Gowthamaraj Rajendran, Mauricio Velazco, Splunk
status:production
type:TTP
Description:The following analytic detects the creation of a Service Principal in an Azure AD environment. It leverages Azure Active Directory events ingested through EventHub, specifically monitoring the "Add service principal" operation. This activity is significant because Service Principals can be used by adversaries to establish persistence and bypass multi-factor authentication and conditional access policies. If confirmed malicious, this could allow attackers to maintain single-factor access to the Azure AD environment, potentially leading to unauthorized access to resources and prolonged undetected activity.
Data_source:
  • -Azure Active Directory Add service principal
search:`azure_monitor_aad` operationName="Add service principal" properties.initiatedBy.user.id=*

| rename properties.* as *

| rename targetResources{}.displayName as displayName

| rename targetResources{}.type as type

| fillnull

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

| `security_content_ctime(firstTime)`

| `security_content_ctime(lastTime)`

| `azure_ad_service_principal_created_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 thorough an EventHub. This analytic was written to be used with the azure:monitor:aad sourcetype leveraging the AuditLog log category.
known_false_positives:Administrator may legitimately create Service Principal. Filter as needed.
References:
  -https://docs.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals
  -https://docs.microsoft.com/en-us/powershell/azure/create-azure-service-principal-azureps?view=azps-8.2.0
  -https://www.truesec.com/hub/blog/using-a-legitimate-application-to-create-persistence-and-initiate-email-campaigns
  -https://www.inversecos.com/2021/10/how-to-backdoor-azure-applications-and.html
  -https://attack.mitre.org/techniques/T1136/003/
drilldown_searches:
 name:'View the detection results for - "$displayName$"'
 search:'%original_detection_search% | search displayName = "$displayName$"'
 earliest_offset:'$info_min_time$'
 latest_offset:'$info_max_time$'
 name:'View risk events for the last 7 days for - "$displayName$"'
 search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$displayName$") | 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'
analytic_story:['Azure Active Directory Persistence', 'NOBELIUM Group']

asset_type:Azure Active Directory

mitre_attack_id:['T1136.003']

product:['Splunk Enterprise', 'Splunk Enterprise Security', 'Splunk Cloud']

category:cloud

security_domain:threat

tags:

tests:
 name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1136.003/azure_ad_add_service_principal/azure-audit.log
  source: Azure AD
  sourcetype: azure:monitor:aad
 test_type:'unit'
manual_test:None