All vulnerabilities
CRITICALInfra

CLOUD-BUCKET-MONOPOLY-2024

Cloud · AWS · AWS S3 bucket-name takeover

Summary

In research disclosed to AWS on February 16, 2024 and presented at Black Hat USA and DEF CON 32 in August 2024, Aqua Security's Nautilus team described a class of S3 bucket-name takeover attacks they called Bucket Monopoly, affecting CloudFormation, Glue, EMR, SageMaker, Service Catalog, and CodeStar. These services auto-created S3 buckets with predictable names built from static prefixes plus the account ID and region, such as cf-templates-{hash}-{region}, aws-glue-assets-{account-id}-{region}, and sagemaker-{region}-{account-id}, where account IDs are discoverable from ARNs, access keys, and public repos. Because S3 bucket names are globally unique, an attacker could pre-create a victim's predictably named bucket in a region the victim had not yet used (a Shadow Resource), then the victim's service would later read attacker-controlled content from it. This enabled data tampering, information disclosure, remote code execution by injecting malicious Glue or CloudFormation content, and in some cases full account takeover via planted admin roles; AWS remediated by adding randomized suffixes to bucket names and enforcing aws:ResourceAccount conditions. The class also covers reuse of abandoned or dangling bucket names that a victim configuration still references.

How to avoid it in your code

  • Use non-guessable bucket names with random suffixes instead of account-id/region patterns.
  • Add aws:ResourceAccount and expected-bucket-owner conditions so services only read buckets you own.
  • Pre-create or claim service buckets in every region you might use to block squatting.
  • Treat AWS account IDs as semi-secret and audit ARNs and repos that leak them.
  • Monitor for unexpected bucket creation matching service naming patterns and alert on it.

References

Related vulnerabilities

All Infra →