Direct Cloud VM Connections
Adversaries may leverage Valid Accounts to log directly into cloud-hosted virtual infrastructure using cloud-native connection methods. Cloud providers offer interactive console access to VMs that bypasses traditional network controls: Azure Serial Console, AWS EC2 Instance Connect, AWS Systems Manager Session Manager (SSM), and GCP OS Login. These methods authenticate via the cloud IAM layer rather than network credentials, can bypass firewall rules and security groups, and often provide SYSTEM or root-level access by default. Adversaries who compromise cloud IAM credentials can pivot to VM instances using these native APIs, even when SSH/RDP is blocked at the network level.
// Detect direct cloud VM connections via cloud-native methods
// Azure Serial Console and Run Command detections
AzureActivity
| where TimeGenerated > ago(24h)
| where OperationNameValue in~ (
"MICROSOFT.COMPUTE/VIRTUALMACHINES/RUNCOMMAND/ACTION",
"MICROSOFT.COMPUTE/VIRTUALMACHINES/EXTENSIONS/WRITE",
"MICROSOFT.SERIALCONSOLE/CONSOLESERVICES/ACCESS"
)
| extend Caller = tostring(Caller)
| extend ResourceGroup = tostring(ResourceGroup)
| extend VMName = tostring(Resource)
| project TimeGenerated, Caller, OperationNameValue, ResourceGroup, VMName,
HTTPRequest, Properties, Level
| union (
// Detect SSM Session Manager connections (via CloudTrail if AWS logs ingested)
// Using CommonSecurityLog for forwarded AWS/GCP events
CommonSecurityLog
| where TimeGenerated > ago(24h)
| where DeviceVendor == "Amazon" and DeviceProduct == "CloudTrail"
| where Activity in~ ("StartSession", "ResumeSession", "SendCommand", "StartAutomationExecution")
| project TimeGenerated, SourceUserName, Activity, DestinationHostName, SourceIP
)
| sort by TimeGenerated desc Data Sources
Required Tables
False Positives
- DevOps and cloud operations teams using Azure Serial Console or Run Command for legitimate VM troubleshooting and patch management
- Automated configuration management pipelines using AWS SSM Run Command to apply configurations at scale
- IT operations using EC2 Instance Connect as a replacement for SSH bastion hosts in approved workflows
- Cloud platform teams testing instance connectivity and emergency recovery procedures via serial console
- Managed service providers performing authorized maintenance via cloud-native access tools
References (7)
- https://attack.mitre.org/techniques/T1021/008/
- https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/serial-console-overview
- https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html
- https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Connect-using-EC2-Instance-Connect.html
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1021.008/T1021.008.md
- https://www.mandiant.com/resources/blog/sim-swapping-and-abuse-of-the-microsoft-azure-serial-console
- https://www.cisa.gov/news-events/cybersecurity-advisories/aa23-320a
Unlock Pro Content
Get the full detection package for T1021.008 including response playbook, investigation guide, and atomic red team tests.