T1087.004 Splunk · SPL

Detect Cloud Account in Splunk

Adversaries may attempt to get a listing of cloud accounts. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. With authenticated access, tools such as Get-MsolRoleMember, az ad user list, aws iam list-users, aws iam list-roles, and gcloud iam service-accounts list can enumerate cloud accounts across Azure AD, AWS IAM, and GCP. Tools like ROADTools, AADInternals, AzureHound, and Pacu have been used by threat actors including APT29 and Storm-0501 to conduct this activity.

MITRE ATT&CK

Tactic
Discovery
Technique
T1087 Account Discovery
Sub-technique
T1087.004 Cloud Account
Canonical reference
https://attack.mitre.org/techniques/T1087/004/

SPL Detection Query

Splunk (SPL)
spl
index=wineventlog (sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1)
  (Image="*\\powershell.exe" OR Image="*\\pwsh.exe" OR Image="*\\cmd.exe" OR Image="*\\python.exe" OR Image="*\\python3.exe")
| eval CommandLine=lower(CommandLine)
| eval AzureEnum=if(match(CommandLine, "(get-msolrolemember|get-msoluser|get-azureaduser|get-azaduser|az\s+ad\s+user\s+list|az\s+ad\s+sp\s+list|az\s+role\s+assignment\s+list|az\s+account\s+list|get-msolserviceprincipal|get-msolgroup)"), 1, 0)
| eval AWSEnum=if(match(CommandLine, "(aws\s+iam\s+list-users|aws\s+iam\s+list-roles|aws\s+iam\s+list-groups|aws\s+iam\s+get-account-authorization-details|aws\s+iam\s+list-attached)"), 1, 0)
| eval GCPEnum=if(match(CommandLine, "(gcloud\s+iam\s+service-accounts\s+list|gcloud\s+projects\s+get-iam-policy|gcloud\s+organizations\s+get-iam-policy)"), 1, 0)
| eval OffensiveTool=if(match(CommandLine, "(invoke-azurehound|azurehound|roadrecon|roadtools|aadinternals|get-aadint|invoke-pacu|pacu)"), 1, 0)
| eval TotalScore=AzureEnum + AWSEnum + GCPEnum + OffensiveTool
| where TotalScore > 0
| eval CloudPlatform=case(
    AzureEnum=1, "Azure/M365",
    AWSEnum=1, "AWS",
    GCPEnum=1, "GCP",
    OffensiveTool=1, "Multi/Unknown",
    1=1, "Unknown"
  )
| eval Severity=if(OffensiveTool=1, "HIGH", "MEDIUM")
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine, CloudPlatform, AzureEnum, AWSEnum, GCPEnum, OffensiveTool, Severity
| sort - _time
medium severity high confidence

Detects cloud account enumeration using Sysmon Event ID 1 process creation events. Evaluates command lines against known Azure/M365, AWS, and GCP enumeration patterns as well as known offensive tools (AzureHound, ROADTools, AADInternals, Pacu). Assigns severity based on whether known offensive tooling is detected. Covers PowerShell, cmd, and Python-based execution methods.

Data Sources

Process: Process CreationCommand: Command ExecutionSysmon Event ID 1

Required Sourcetypes

XmlWinEventLog:Microsoft-Windows-Sysmon/Operational

False Positives & Tuning

  • IT administrators running legitimate user audits or access reviews using AZ CLI, AWS CLI, or PowerShell modules
  • Security teams running authorized Identity Governance assessments or access certifications
  • Automated scripts for user provisioning/deprovisioning that enumerate existing accounts before making changes
  • Cloud cost optimization or compliance tooling that enumerates IAM resources for reporting
  • DevOps pipeline scripts that validate service account existence before deployment
Download portable Sigma rule (.yml)

Other platforms for T1087.004


Testing Methodology

Validate this detection against 5 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1Azure AD User Enumeration via AZ CLI

    Expected signal: Sysmon Event ID 1: Process Create with Image=cmd.exe or powershell.exe, CommandLine containing 'az ad user list'. The Azure AD Audit Log will record 'List users' operations attributed to the authenticated service principal or user.

  2. Test 2AWS IAM User and Role Enumeration

    Expected signal: Sysmon Event ID 1: Process Create for each aws CLI invocation with CommandLine containing 'aws iam list-users', 'aws iam list-roles', and 'aws iam get-account-authorization-details'. Sysmon Event ID 11: File Create for iam_dump.json in TEMP directory. AWS CloudTrail will record ListUsers, ListRoles, GetAccountAuthorizationDetails API calls.

  3. Test 3Azure AD Enumeration via PowerShell MSOnline Module

    Expected signal: Sysmon Event ID 1: Process Create with Image=powershell.exe, CommandLine containing 'Get-MsolUser', 'Get-MsolRoleMember'. PowerShell ScriptBlock Log Event ID 4104 with full module import and cmdlet invocation. Sysmon Event ID 11: File Create for msol_users.csv. Azure AD Audit Logs will record 'List users' and 'Get member' operations.

  4. Test 4GCP IAM Service Account Enumeration

    Expected signal: Linux auditd or syslog: process execution of gcloud with arguments 'iam service-accounts list' and 'projects get-iam-policy'. GCP Cloud Audit Logs will record iam.serviceAccounts.list and cloudresourcemanager.projects.getIamPolicy Admin Activity operations attributed to the authenticated user or service account.

  5. Test 5Azure AD Enumeration via ROADTools (roadrecon)

    Expected signal: Sysmon Event ID 1: Process Create for pip install (python.exe) and roadrecon.exe invocations with 'auth' and 'gather' subcommands. Sysmon Event ID 11: File Create for roadrecon_output.db in TEMP directory. Network connections from python.exe to login.microsoftonline.com and graph.microsoft.com. Azure AD Audit Logs will show bulk 'List users', 'List groups', 'List applications' operations.

Unlock Pro Content

Get the full detection package for T1087.004 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections