Thursday, May 15, 2025
HomeAmazon AWSAmazon Machine Image Vulnerability Allows Hackers to Publish Fake Resources

Amazon Machine Image Vulnerability Allows Hackers to Publish Fake Resources

Published on

SIEM as a Service

Follow Us on Google News

 A new security vulnerability targeting Amazon Machine Images (AMIs) has emerged, exposing organizations and users to potential exploitation.

Dubbed the “whoAMI name confusion attack,” this flaw allows attackers to publish malicious virtual machine images under misleading names, tricking unsuspecting users into deploying them within their Amazon Web Services (AWS) infrastructure.

Understanding the AMI Vulnerability

Amazon Machine Images (AMIs) are pre-configured virtual machine templates used to launch EC2 instances in AWS.

- Advertisement - Google News
Launch EC2 instances in AWS.
Launch EC2 instances in AWS.

While AMIs can be private, public, or purchased through the AWS Marketplace, users often rely on AWS’s search functionality via the ec2:DescribeImages API to find the most recent AMIs for specific operating systems or configurations.

However, if users or organizations fail to apply specific security measures, such as specifying trusted “owners” during the AMI search process, they may inadvertently use an unverified or malicious image.

Attacker vs Victim
Attacker vs Victim

This vulnerability, classified as a name confusion attack, exploits situations where organizations rely on AMI names or patterns without verifying the image’s source or owner, as per a report by Data Dog Security Labs.

By publishing a malicious AMI with a name resembling legitimate ones (e.g., matching patterns such as “ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*”), attackers can ensure their AMI appears as the “latest” in search results.

Once deployed, these malicious AMIs can act as backdoors, exfiltrating sensitive data or enabling unauthorized access to systems.

Our Public Community AMI
Our Public Community AMI

In one reported instance, researchers demonstrated the attack by creating a malicious AMI named “ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-whoAMI” that mimicked legitimate resources.

 This malicious AMI was successfully retrieved and used by vulnerable configurations.

Attack Mechanics and Exploitation

The vulnerability arises due to a misconfiguration in how AMI searches are performed.

For example, using the following Terraform code for AMI retrieval can result in vulnerabilities if the “owners” attribute is omitted:

data "aws_ami" "ubuntu" {
  most_recent = true
  filter {
    name   = "name"
    values = ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"]
  }
}

This configuration results in Terraform querying the ec2:DescribeImages API, returning a list of all AMIs matching the search criteria—including those from untrusted or malicious sources.

Simple ec2 will use our AMI instead of an AMI from a verified provider
Simple ec2 will use our AMI instead of an AMI from a verified provider

If the most_recent=true attribute is applied, Terraform automatically selects the newest AMI, which could be an attacker’s malicious resource.

Attackers can exploit this by publishing public AMIs with names that include keywords like “amzn”, “ubuntu”, or other well-known patterns, ensuring that their AMI is selected by automated or human-driven searches.

Once selected, the malicious AMI can include backdoors, malware, or other harmful elements, making it a serious threat to cloud security.

Mitigation and Prevention

  1. Use Owner Filters: Always specify owners when querying AMIs. Trusted values include amazon, aws-marketplace, or well-known AWS account IDs such as 137112412989 (Amazon Linux).Example of a safer AWS CLI query:
aws ec2 describe-images \
  --filters "Name=name,Values=amzn2-ami-hvm-*-x86_64-gp2" \
  --owners "137112412989"
  1. Adopt AWS’s Allowed AMIs Feature: Introduced in December 2024, this feature allows AWS customers to create an allowlist of trusted AMI providers, ensuring that EC2 instances are only launched using images from verified accounts.
  2. Update Terraform and IaC Tools: Ensure you are using updated versions of Terraform or other infrastructure-as-code tools. Recent updates include warnings or errors for improper AMI searches (e.g., Terraform’s aws_ami provider now alerts users if most_recent=true is used without specifying owners).
  3. Perform Code Audits: Utilize tools like Semgrep to search for risky patterns in your codebase, including Terraform, CLI scripts, and programming languages like Python, Go, and Java.Example Semgrep rule to detect risks:

rules:

- id: missing-owners-in-aws-ami
    languages:
      - terraform
    patterns:
      - pattern: |
          data "aws_ami" $NAME {
            ...
            most_recent = true
          }
      - pattern-not: |
          owners = $OWNERS
  1. Monitor Current Instances: Use tools like the open-source whoAMI-scanner to audit your AWS accounts for instances launched from unverified AMIs. This tool provides a comprehensive list of instances using AMIs that are public or non-allowlisted.

AWS has acknowledged the potential impact of this vulnerability and has worked with researchers to address it.

According to their statement, the affected systems within AWS environments were non-production and had no customer data exposure.

In addition, AWS introduced the Allowed AMIs feature to mitigate such risks and encouraged customers to implement this guardrail.

The “whoAMI” vulnerability underscores the critical need for secure configurations and due diligence when operating in cloud environments.

Organizations must adopt secure practices, such as validating AMI ownership during searches and leveraging AWS’s new security features.

With thousands of accounts potentially affected, maintaining vigilance is essential to protecting sensitive workloads and data on AWS.

Investigate Real-World Malicious Links & Phishing Attacks With Threat Intelligence Lookup - Try for Free

Divya
Divya
Divya is a Senior Journalist at GBhackers covering Cyber Attacks, Threats, Breaches, Vulnerabilities and other happenings in the cyber world.

Latest articles

Threat Actors Leverage Weaponized HTML Files to Deliver Horabot Malware

A recent discovery by FortiGuard Labs has unveiled a cunning phishing campaign orchestrated by...

TA406 Hackers Target Government Entities to Steal Login Credentials

The North Korean state-sponsored threat actor TA406, also tracked as Opal Sleet and Konni,...

Google Threat Intelligence Releases Actionable Threat Hunting Technique for Malicious .desktop Files

Google Threat Intelligence has unveiled a series of sophisticated threat hunting techniques to detect...

New Adobe Photoshop Vulnerability Enables Arbitrary Code Execution

Adobe has released critical security updates addressing three high-severity vulnerabilities (CVE-2025-30324, CVE-2025-30325, CVE-2025-30326) in...

Resilience at Scale

Why Application Security is Non-Negotiable

The resilience of your digital infrastructure directly impacts your ability to scale. And yet, application security remains a critical weak link for most organizations.

Application Security is no longer just a defensive play—it’s the cornerstone of cyber resilience and sustainable growth. In this webinar, Karthik Krishnamoorthy (CTO of Indusface) and Phani Deepak Akella (VP of Marketing – Indusface), will share how AI-powered application security can help organizations build resilience by

Discussion points


Protecting at internet scale using AI and behavioral-based DDoS & bot mitigation.
Autonomously discovering external assets and remediating vulnerabilities within 72 hours, enabling secure, confident scaling.
Ensuring 100% application availability through platforms architected for failure resilience.
Eliminating silos with real-time correlation between attack surface and active threats for rapid, accurate mitigation

More like this

Threat Actors Leverage Weaponized HTML Files to Deliver Horabot Malware

A recent discovery by FortiGuard Labs has unveiled a cunning phishing campaign orchestrated by...

TA406 Hackers Target Government Entities to Steal Login Credentials

The North Korean state-sponsored threat actor TA406, also tracked as Opal Sleet and Konni,...

Google Threat Intelligence Releases Actionable Threat Hunting Technique for Malicious .desktop Files

Google Threat Intelligence has unveiled a series of sophisticated threat hunting techniques to detect...
OSZAR »