ba58a1e7cc
* new hunt queries for aws * sendcommand and getuserpassword queries * s3 bucket access and secrets manager requests added * ssm start session and service logging deleted added * adding federated authentication queries * added ec2 modify instance attribute query * adding backdoor role creation query * 2 new queries for discovery; added lookback windows * added new hunting query for IAM activity with no MFA session * added missing time windows * adding new query for lambda add permissions * adjusted query format * added new query for ec2 instance deployment anomalies * updated queries based on feedback; regenerated docs * fixed queries * removed new rule
2.4 KiB
2.4 KiB
High EC2 Instance Deployment Count Attempts by Single User or Role
Metadata
-
Author: Elastic
-
Description: This hunting query identifies when a user makes EC2
RunInstancesAPI calls with a high instance deployment count within a 7-day window. TheRunInstancesAPI call launches one or more instances in a specified subnet. High instance deployment counts may indicate an adversary attempting to deploy a large number of instances for cryptomining or other malicious activities. This may also aid in identifying potential resource abuse or misconfigurations. -
UUID:
c3d24ae8-655d-11ef-a990-f661ea17fbcc -
Integration: aws.cloudtrail
-
Language:
[ES|QL] -
Source File: High EC2 Instance Deployment Count Attempts by Single User or Role
Query
from logs-aws.cloudtrail-*
| where @timestamp > now() - 7 day
| where
event.dataset == "aws.cloudtrail"
and event.provider == "ec2.amazonaws.com"
and event.action == "RunInstances"
and aws.cloudtrail.request_parameters RLIKE ".*minCount.*maxCount.*"
| eval date = DATE_FORMAT("YYYY-mm-dd", @timestamp)
| dissect aws.cloudtrail.request_parameters "%{}subnetId=%{subnet_id},"
| dissect aws.cloudtrail.request_parameters "%{}minCount=%{min_count},"
| dissect aws.cloudtrail.request_parameters "%{}maxCount=%{max_count}}]},"
| dissect aws.cloudtrail.request_parameters "%{}instanceType=%{instance_type},"
| stats
target_instance_count = sum(to_integer(max_count) - to_integer(min_count) + 1),
user_attempts = count(*) by user.name, date, subnet_id, instance_type, event.outcome
| where target_instance_count >= 10
Notes
- Use the
aws.cloudtrail.user_identity.arnfield to identify the user making the requests and their role permissions - Review
cloud.regionto identify the regions where theRunInstancesAPI calls were made subnet_idshould be reviewed to identify the subnet where the instances are being deployed but can also help pivot and narrow down the scope of further queriesinstance_typeshould be reviewed to identify the type of instances being deployed. Cryptomining campaigns often deploy specific instance types to maximize mining efficiency
MITRE ATT&CK Techniques
License
Elastic License v2