Detection of AWS EC2 Deprecated AMI Discovery
Detection of reconnaissance activity where AWS users or roles query the EC2 API for deprecated Amazon Machine Images, a technique used by adversaries to identify vulnerable or outdated system images for potential exploitation.
What's new
This detection brief addresses the reconnaissance technique where an AWS identity queries for deprecated Amazon Machine Images (AMIs). Attackers often perform this discovery during the post-compromise or initial access phases to identify outdated or unpatched system images that may contain known vulnerabilities. By leveraging the DescribeImages API call with the includeDeprecated parameter set to true, an adversary can enumerate images that are no longer recommended for use but may still be available in the environment. While these queries are not inherently malicious and can occur during legitimate maintenance or security assessments, they provide a strong signal of unauthorized discovery when originating from unexpected identities or sources. Defenders should monitor these API calls to correlate them with subsequent instance launch activity or lateral movement attempts within the AWS account.
Impact
Successful reconnaissance of deprecated AMIs can lead to the identification of legacy systems that lack critical security patches, potentially exposing the environment to RCE or privilege escalation if an attacker manages to launch and compromise these instances. Monitoring this activity assists in reducing the attack surface by identifying images that should be decommissioned or restricted via IAM policies.
Recommendation
- Deploy the provided detection rule to monitor CloudTrail logs for the
DescribeImagesAPI action with theincludeDeprecatedparameter enabled. - Restrict IAM permissions for the
ec2:DescribeImagesaction to ensure only authorized service principals and administrators can perform these lookups. - Perform a quarterly audit of all AMIs in use within the AWS environment to identify and replace deprecated images with current, hardened versions.
- Use the
aws.cloudtrail.user_identity.arnandsource.ipfields to investigate the context of flagged queries, cross-referencing these with any subsequentRunInstancesAPI calls.
Immediate actions
Deploy the Sigma rule to monitor for DescribeImages API calls with includeDeprecated=true
Threat Hunt
Identify all IAM identities that have performed DescribeImages with includeDeprecated=true in the last 30 days
Data: CloudTrail logs
Mitigations
Review and restrict IAM policies allowing DescribeImages
T1580
Detection coverage 3
AWS EC2 Deprecated AMI Discovery
lowDetects when an AWS identity queries for deprecated Amazon Machine Images via the DescribeImages API call.
Detect AWS EC2 Full Network Packet Capture
mediumDetects successful creation of an Amazon EC2 Traffic Mirroring session, which can be abused for covert network sniffing.
Detect AWS EC2 Route Table Modification or Deletion
lowDetects potentially unauthorized modifications or deletions of AWS route tables via CloudTrail events which may indicate persistence or network disruption attempts.
Detection queries are available on the platform. Get full rules →