AWS CloudQuarry: Digging For Secrets In Public AMIs
Publicly shared Amazon Machine Images (AMIs) often contained sensitive data such as credentials, private Git repositories, and access keys. An attacker could launch instances from these AMIs and extract secrets, potentially leading to unauthorised access to cloud resources and other services.
Published on securitycafe.ro
Money, secrets and mass exploitation: This research unveils a quarry of sensitive data stored in public AMIs. Digging through each AMI we managed to collect 500 GB of credentials, private repositories, access keys and more.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the root cause is that users published AMIs without removing sensitive files such as credentials and private keys, and AWS allows public sharing of AMIs with only a warning.
Impact
The exposed secrets could allow attackers to access AWS accounts, private Git repositories, and other services, potentially leading to data breaches and financial loss.
What the attacker needed
AWS account with all regions enabled; AWS CLI access; Ability to launch EC2 instances
How it was found
- Enable all AWS regions in an AWS account.
- Use the AWS CLI to list all public AMIs in each region, including deprecated ones.
- Store the collected AMI metadata in a database for analysis.
- Filter out AMIs from the AWS Marketplace, those owned by AWS, and those with instance-store root devices.
- Further filter out owners with more than 50 public AMIs to focus on likely non-vendor accounts.
- For the remaining AMIs, launch instances or mount their volumes to search for secrets.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
An Amazon Machine Image (AMI) is a template for creating virtual servers in AWS. If someone makes their AMI public, anyone can start a server from it and see all the files that were left inside, including passwords and keys. This research found many public AMIs that accidentally contained such secrets.
What is Leaked secrets?
Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.