Detect Cloud Services in Sumo Logic CSE
Adversaries may log into accessible cloud services within a compromised environment using Valid Accounts that are synchronized with or federated to on-premises user identities. Many enterprises federate user identities to cloud services (Azure AD/Entra ID, AWS, GCP, M365), allowing adversaries with compromised on-premises credentials to move laterally into cloud control planes. APT29 leveraged synced high-privileged accounts to move into Office 365/Azure. Storm-0501 abused Entra Connect Sync Server for hybrid lateral movement. Scattered Spider used existing AWS EC2 instances for lateral movement. Methods include cloud CLI tools (Connect-AZAccount, gcloud auth, aws configure), web console access, and Application Access Tokens.
MITRE ATT&CK
- Tactic
- Lateral Movement
- Technique
- T1021 Remote Services
- Sub-technique
- T1021.007 Cloud Services
- Canonical reference
- https://attack.mitre.org/techniques/T1021/007/
Sumo Detection Query
(_sourceCategory=*Windows/Sysmon* OR _sourceCategory=*Windows/Security* OR _sourceCategory=*Azure/SignIn* OR _sourceCategory=*AWS/CloudTrail*)
| json auto maxdepth 5 nodrop
// Normalize command line field across log sources
| if (!isBlank(CommandLine), CommandLine,
if (!isBlank(command_line), command_line,
if (!isBlank(process.command_line), process.command_line, "")
)
) as cmd_line
// Normalize actor field across log sources
| if (!isBlank(SubjectUserName), SubjectUserName,
if (!isBlank(properties.userPrincipalName), properties.userPrincipalName,
if (!isBlank(userIdentity.arn), userIdentity.arn, "-")
)
) as actor
// Normalize source IP across log sources
| if (!isBlank(IpAddress), IpAddress,
if (!isBlank(properties.ipAddress), properties.ipAddress,
if (!isBlank(sourceIPAddress), sourceIPAddress, "-")
)
) as src_ip
// Detection filter
| where
// Pattern 1: Cloud CLI execution
(
cmd_line matches "*Connect-AzAccount*"
OR cmd_line matches "*Connect-MgGraph*"
OR cmd_line matches "*Connect-ExchangeOnline*"
OR cmd_line matches "*az login*"
OR cmd_line matches "*az account*"
OR cmd_line matches "*aws configure*"
OR cmd_line matches "*aws sts*"
OR cmd_line matches "*gcloud auth*"
)
// Pattern 2: Risky Azure AD sign-in
OR (
!isBlank(properties.riskLevelDuringSignIn)
AND (properties.riskLevelDuringSignIn = "medium" OR properties.riskLevelDuringSignIn = "high")
AND properties.status.errorCode = 0
)
OR (
!isBlank(properties.networkLocationDetails)
AND properties.networkLocationDetails matches "*anonymizedIP*"
AND properties.status.errorCode = 0
)
// Pattern 3: AWS Console login without MFA
OR (
eventName = "ConsoleLogin"
AND responseElements.ConsoleLogin = "Success"
AND additionalEventData.MFAUsed = "No"
)
// Classify cloud platform
| if(
cmd_line matches "*Connect-Az*" OR cmd_line matches "*az login*" OR cmd_line matches "*az account*" OR !isBlank(properties.riskLevelDuringSignIn),
"Azure",
if(cmd_line matches "*aws*" OR eventName = "ConsoleLogin", "AWS",
if(cmd_line matches "*gcloud*", "GCP", "Unknown")
)
) as CloudPlatform
// Classify detection type
| if(!isBlank(cmd_line) AND cmd_line != "", "CloudCLI_Execution",
if(!isBlank(properties.riskLevelDuringSignIn) OR properties.networkLocationDetails matches "*anonymizedIP*",
"RiskyAzureSignin", "AWSConsoleNoMFA")
) as DetectionType
| count by _sourceCategory, actor, src_ip, CloudPlatform, DetectionType, cmd_line
| sort by _count desc Detects T1021.007 cloud lateral movement across Windows endpoint (Sysmon/Security), Azure Sign-in Logs, and AWS CloudTrail sources in Sumo Logic. Uses json auto field normalization to handle schema differences between log sources. Covers cloud CLI tool invocations, risky Azure AD sign-ins with medium/high risk level or anonymized IP, and AWS Console logins without MFA. Adjust _sourceCategory values to match your environment's configured source categories.
Data Sources
Required Tables
False Positives & Tuning
- Cloud platform engineering teams and developers authenticate to Azure, AWS, and GCP via CLI tools as part of daily infrastructure and development work on managed corporate endpoints
- Automated runbooks, Terraform and Ansible provisioning scripts, and CI/CD pipeline agents authenticate using service principals or IAM roles, frequently without MFA requirements
- Azure Identity Protection risk scoring may flag legitimate users traveling internationally, accessing via split-tunnel VPN, or logging in from new devices as medium risk
Other platforms for T1021.007
Testing Methodology
Validate this detection against 4 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.
- Test 1Authenticate to Azure via Azure CLI from Compromised Endpoint
Expected signal: Sysmon Event ID 1: az.cmd (or az) process creation with 'login' in command line. Sysmon Event ID 3: outbound HTTPS connections to login.microsoftonline.com. Azure AD SigninLogs entry for the authenticated user from the endpoint's IP address.
- Test 2Authenticate to Azure PowerShell (Connect-AzAccount)
Expected signal: Sysmon Event ID 1: powershell.exe with Connect-AzAccount in command line. Sysmon Event ID 3: HTTPS connections to login.microsoftonline.com, management.azure.com. Azure AD SigninLogs showing PowerShell client sign-in.
- Test 3Configure AWS CLI with Stolen Credentials
Expected signal: Linux auditd EXECVE for aws CLI binary. File creation/modification of ~/.aws/credentials. HTTPS connection to sts.amazonaws.com. AWS CloudTrail event for GetCallerIdentity API call from the source IP.
- Test 4List and Access Cloud Resources After Authentication
Expected signal: Sysmon Event ID 1 for each az command execution. HTTPS connections to management.azure.com API. Azure Activity Log: List operations for subscriptions, resources, and key vaults. Entra ID audit log for authenticated session activities.
References (8)
- https://attack.mitre.org/techniques/T1021/007/
- https://learn.microsoft.com/en-us/cli/azure/
- https://learn.microsoft.com/en-us/powershell/azure/
- https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1021.007/T1021.007.md
- https://www.mandiant.com/resources/blog/remediation-hardening-strategies-microsoft-365
- https://www.microsoft.com/security/blog/2024/09/26/storm-0501-ransomware-attacks-expanding-to-hybrid-cloud-environments/
- https://specterops.io/blog/credential-storage/
Unlock Pro Content
Get the full detection package for T1021.007 including response playbook, investigation guide, and atomic red team tests.