Techniques
Sample rules
AWS EC2 Instance Launched With User Data by Rare User
- source: elastic
- technicques:
- T1578
Description
Identifies the first time, within a lookback window, an identity launches an EC2 instance that includes user data via the “RunInstances” API. Adversaries supply user data to execute code automatically on instance boot (cloud-init), enabling command execution, persistence, or credential theft from a newly created, attacker-controlled instance. This is a New Terms rule detecting a rare occurrence of the “cloud.account.id”, “user.name”, and “source.as.organization.name” tuple for instance launches carrying user data.
Detection logic
data_stream.dataset: "aws.cloudtrail"
and event.provider: "ec2.amazonaws.com"
and event.action: "RunInstances"
and event.outcome: "success"
and source.ip: *
and cloud.account.id: *
and user.name: *
and aws.cloudtrail.request_parameters: *userData*
and source.as.organization.name: (
* and not (
"Google LLC" or "Amazon.com, Inc." or "Microsoft Corporation" or "GOOGLE-CLOUD-PLATFORM"
or "MICROSOFT-CORP-MSN-AS-BLOCK" or "AMAZON-AES" or "AMAZON-02"
)
)
and not aws.cloudtrail.user_identity.invoked_by: ("autoscaling.amazonaws.com" or "cloudformation.amazonaws.com")
and not user_agent.original: (*Terraform*)