Detection: Azure AD Service Principal Enumeration
Description
This detection leverages azure graph activity logs to identify when graph APIs have been used to identify 10 or more service principals. This type of behaviour is associated with tools such as Azure enumberation tools such as AzureHound or ROADtools.
Search
1`azure_monitor_aad` category IN (MicrosoftGraphActivityLogs) TERM(servicePrincipals)
2
3| fillnull
4
5| rex field="properties.requestUri" "https\:\/\/graph.microsoft.com\/beta\/servicePrincipals\/(?P<servicePrincipalb>.*?)\/"
6
7| rex field="properties.requestUri" "https\:\/\/graph.microsoft.com\/v1.0\/servicePrincipals\/(?P<servicePrincipalv1>.*?)\/"
8
9| eval spn=coalesce(servicePrincipalb,servicePrincipalv1)
10
11| fillnull
12
13| stats count min(_time) as _time dc(spn) as spn_count values(user_id) as user_id
14 BY dest user src
15 vendor_account vendor_product signature
16
17| where spn_count>9
18
19| `azure_ad_service_principal_enumeration_filter`
Data Source
Macros Used
| Name |
Value |
| azure_monitor_aad |
sourcetype=azure:monitor:aad |
| azure_ad_service_principal_enumeration_filter |
search * |
azure_ad_service_principal_enumeration_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
| ID |
Technique |
Tactic |
| T1087.004 |
Cloud Account |
Discovery |
| T1526 |
Cloud Service Discovery |
Discovery |
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 Finding (Notable) |
Yes |
| Rule Title |
%name% |
| Rule Description |
%description% |
| Notable Event Fields |
user, dest |
| Creates Intermediate Finding (Risk Event) |
No |
TTP detections generate a Finding (Notable) and may generate Intermediate Findings (Risk Events) for associated entities.
Implementation
Run this detection over historical data to identify then tune out any known services which may be performing this action. Thresholds can be lowered or raised to meet requirements. The Splunk Add-on for Microsoft Cloud Services add-on is required to ingest MicrosoftGraphActivityLogs via Azure EventHub. See reference for links for further details on how to onboard this log source.
Known False Positives
No false positives have been identified at this time.
Associated Analytic Story
Finding
| Title |
Entity Field |
Entity Type |
Risk Score |
| $spn_count$ Service Principals have been enumerated by $user_id$ from IP $src$ |
user |
user |
50 |
Threat Objects
| Field |
Type |
| src |
ip_address |
References
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: 10