Bucket Monopoly: Breaching AWS Accounts Through Shadow Resources
AWS services such as CloudFormation automatically create S3 buckets with predictable names based on a per-account hash and region. An attacker who knows the hash can pre-create the bucket in an unused region, then read or modify victim templates, potentially injecting an admin role.
Published on aquasec.com
Yakir KadkodaOfek ItachMichael Katchinskiy
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 services generate S3 bucket names using a predictable pattern (a per-account hash or account ID plus region) and then trust any existing bucket with that name, without verifying ownership.
Impact
An attacker could read sensitive data from templates, cause denial of service, or inject resources including an admin role, though the attack requires knowing the hash and waiting for the victim to use a new region.
What the attacker needed
Knowledge of victim's CloudFormation hash; victim uses a new AWS region; attacker can create S3 buckets
The fix
AWS fixed the vulnerabilities in the affected services, and users should avoid exposing their CloudFormation hash.
How it was found
- The attacker learns the victim's CloudFormation hash (e.g., from public code or issues).
- The attacker creates a bucket with the predictable name in a region the victim hasn't used.
- The attacker makes the bucket public and adds a permissive bucket policy allowing the victim's service to read and write.
- The attacker sets up a Lambda function triggered by new objects in the bucket to modify uploaded templates.
- The victim uploads a CloudFormation template via the console in that region, and the file lands in the attacker's bucket.
- The Lambda modifies the template to inject an admin role, and the victim deploys it, allowing the attacker to assume the role.
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.
When you use some AWS services, they quietly create storage buckets (S3) for you. The names of these buckets follow a pattern that includes a secret code unique to your account. If an attacker learns that code, they can create the bucket first in a region you haven't used yet. Then, when you use the service there, your files go into the attacker's bucket, letting them read or change them.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.