How to Secure Public AWS AMIs Against Look-Alike and Misconfigured Images

· Original article ↗

Summary

Public AWS AMIs can carry malware, exposed credentials, or outdated software; the whoAMI attack uses look-alike image names. Validate owner IDs, restrict trusted sources, scan images, and regularly rebuild Golden AMIs.

Key points

  • The whoAMI attack uses AMI names resembling trusted images to trick developers or pipelines that do not verify image owners.
  • Public or misconfigured AMIs may contain malware, vulnerable software, exposed credentials, or insecure settings.
  • A compromised source image can pass weaknesses into Golden AMIs and instances across accounts and regions.
  • The article recommends validating AMI owner IDs, using AWS Allowed AMIs, restricting public sharing, and regularly rebuilding Golden AMIs.
  • It also recommends monitoring CloudTrail for AMI activity, tracking image lineage, and scanning images before deployment.
  • Qualys says its snapshot-based AMI Scan can identify vulnerabilities and configuration issues before launch, but does not verify publisher authenticity or guarantee an image is malware-free.

Article Details

Defense Focus
Prevent malicious or misconfigured AMIs from entering deployment pipelines and detect or remediate risks inherited by workloads launched from those images.
Detection Methods
  • Monitor AMI creation, modification, sharing, and launch activity.
  • Detect EC2 instances launched from unknown or unapproved AMIs.
  • Alert when AMIs become publicly accessible and monitor image usage across AWS accounts.
  • Scan AMIs before deployment for vulnerabilities, missing patches, outdated software, and configuration issues.
  • Track Golden AMI drift and image lineage; continuously scan deployed workloads for inherited vulnerabilities.
Data Sources
  • AWS CloudTrail events for AMI creation, modification, sharing, and launch
  • AMI owner, publisher, metadata, and sharing permissions
  • Centralized AMI inventory and parent-child image lineage
  • AMI scan findings and deployed-workload vulnerability findings
  • Terraform and AWS CloudFormation templates
Platforms
  • AWS
  • Amazon EC2
  • CI/CD pipelines
  • Terraform
  • AWS CloudFormation
Defensive Actions
  • Validate each AMI's publisher and owner ID; do not select images by name alone.
  • Use AWS Allowed AMIs to restrict launches to vetted image sources.
  • Restrict public sharing of internal AMIs and remove sensitive data before any necessary publication.
  • Scan images before deployment and promotion into Golden AMI workflows.
  • Build and regularly rebuild Golden AMIs with current patches and hardened configurations; retire outdated images.
  • Maintain a centralized approved-image inventory, track lineage, and periodically review sharing permissions.
  • Integrate image validation into deployment workflows and remediate vulnerabilities in both running workloads and future image builds.

MITRE ATT&CK

Vendors

Products

Related Articles