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

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
T1036.005 · Match Legitimate Resource Name or LocationIn the reported whoAMI scenario, attackers use AMI names resembling trusted vendor images to mislead developers or automated image-selection workflows.T1195 · Supply Chain CompromiseThe article describes compromised system images entering the infrastructure supply chain and propagating through Golden AMI workflows to downstream workloads.T1525 · Implant Internal ImageThe article describes attackers implanting malicious code in images within a victim cloud environment, where it may persist through subsequent deployments.T1608.001 · Upload MalwareThe article describes attackers uploading backdoored AMIs to public repositories, including AWS Community AMIs, for unsuspecting users to deploy.
Vendors
Products
Amazon InspectorAssess AMIs for vulnerabilities before deployment using services such as Amazon Inspector or Qualys TotalCloud AMI Scan.AWS Allowed AMIsValidating image owners, rebuilding Golden AMIs regularly, using AWS Allowed AMIs, and continuously monitoring with Qualys TotalCloud help keep malicious and misconfigured images out of production.AWS EC2An Amazon Machine Image (AMI) is a template used to launch Amazon EC2 instances.Qualys FlowQualys Flow and TotalCloud workflow automation capabilities can further help operationalize security findings through customized remediation workflows, incident routing, and supported integrations.Qualys Infrastructure as Code (IaC) SecurityQualys Infrastructure as Code (IaC) Security helps identify security misconfigurations in supported infrastructure templates before resources are deployed.Qualys Patch ManagementQualys Patch Management can support deploying applicable security patches to supported running workloads.Qualys TotalCloudValidating image owners, rebuilding Golden AMIs regularly, using AWS Allowed AMIs, and continuously monitoring with Qualys TotalCloud help keep malicious and misconfigured images out of production.Qualys VMDRQualys Vulnerability Management, Detection and Response (VMDR) helps identify and prioritize vulnerabilities across supported assets.
