Skip to main content
Back
DemonstrationAWS
6 min read

Bucket Monopoly takeover of AWS service buckets with predictable names

Environment
An AWS account staged by Aqua Security's Nautilus researchers
When
First report to AWS; runs not dated – Jun 26, 2024Disclosed Aug 9, 2024
Entry
An S3 bucket created in the attacker's own account under the name an AWS service would later use for the victim, in a region the victim had not used.

Six AWS services created S3 buckets whose names a stranger could predict from a service prefix, an account identifier and the region, and S3 bucket names share one global namespace. In accounts of their own, Aqua Nautilus' researchers created such a bucket first in a region the victim had not used: the victim's CloudFormation template was written to it, a function added a role the attacker could assume before deployment, and a Glue job ran a script altered there. Aqua reported the issues to AWS from February 16, 2024, AWS fixed the services from March to June 2024, and no exploitation in the wild is reported.

What the demonstration did

Public sources
Public code and trackers
Internet
Amazon S3 APIwrites and reads objects
Victim AWS account
Attacker AWS account
AWS CloudFormation
AWS Glue job
Injected IAM role
Claimed service bucket
Template-editing function

Replaying Aqua's Bucket Monopoly demonstration / reported to AWS February 2024; the runs are not dated

  1. 1

    The service bucket is claimed first

    Not dated · reported to AWS February 16, 2024

    In its own account, the attacker creates the S3 bucket under the name CloudFormation will use for the victim in a region the victim has not used, opens it to the public and grants the AWS service read, write and list on it.

  2. 2

    Templates go to the attacker's bucket

    Not dated · reported to AWS February 16, 2024

    The victim's CloudFormation use in that region writes the uploaded template into the attacker's bucket, and a function triggered on the write adds a role the attacker can assume before the stack deploys.

  3. 3

    Code and roles land in the victim account

    Not dated · reported to AWS February 16, 2024

    CloudFormation deploys the altered template and creates the injected role where the deploying identity holds IAM permissions, and the victim's Glue job runs a script altered in a claimed bucket with the job's role.

Impact

In the demonstrations, a claimed bucket gave the attacker the victim's CloudFormation templates and a role injected into the victim's stack, and code execution in the victim's Glue job; EMR, SageMaker, Service Catalog and CodeStar showed tampering, data leakage or denial of service. No exploitation in the wild is reported.

Outcome

What Bucket Monopoly shows about your buckets

When a service writes to or reads from a bucket by a name that someone else can predict, the account that creates that name first receives your files; in Aqua's demonstrations that gave the bucket's owner the templates, a role in the stack and code in a Glue job. In your AWS organization, a service control policy that denies S3 reads and writes outside the organization bounds the write and the read, and one that requires a permissions boundary caps a role a stack creates; neither binds the management account. A resource control policy keeps principals outside the organization from assuming your roles, and became available in November 2024, after this research. AWS fixed the six services from March to June 2024.

Would the controls have stopped it?

In hindsight, no control would have stopped it. 4 controls would have limited how far it went. 2 steps have no cloud-provider control. The counts below are control assessments, not attack stages: several can address the same step. The same replay with the controls in place before the incident shows where each phase would have been refused or bounded.

0
Prevented
4
Contained
2
Not covered

How it could have been prevented

The same replay with the controls in place. Green marks where a step is refused, blue where it is bounded, and red where no control reaches it. Open a row to read the control, why it acts, and its caveat.

Public sources
Public code and trackers
Internet
Amazon S3 APIwrites and reads objects
Victim AWS account
Attacker AWS account
AWS CloudFormation
AWS Glue job
Injected IAM role
Claimed service bucket
Template-editing function

Replaying Aqua's Bucket Monopoly demonstration / reported to AWS February 2024; the runs are not dated

1 · The service bucket is claimed first

1 Not covered3 on other clouds

2 · Templates go to the attacker's bucket

1 Contained1 Not covered3 on other clouds

3 · Code and roles land in the victim account

3 Contained6 on other clouds

Key facts

  • Aqua Nautilus reported the CloudFormation, Glue, EMR, SageMaker and CodeStar issues to AWS on February 16, 2024, and the Service Catalog issue on February 18
  • The 6 affected AWS services built bucket names from a service prefix, an account identifier and, in most patterns, the region; Aqua found the CloudFormation account hashes in public code repositories and issue trackers
  • In the CloudFormation demonstration, the victim's template was written to the bucket in the researchers' own account, and a function triggered on writes added a role the attacker could assume before the stack deployed; the write-up does not state that the role was assumed
  • In the Glue demonstration, the victim's job ran a script the researchers had altered in the claimed bucket, and the console showed a cached copy
  • EMR, SageMaker Canvas, Service Catalog and CodeStar showed tampering, data leakage or denial of service
  • AWS confirmed fixes from March 16 to June 26, 2024 that pick another name when the bucket exists, and stopped new CodeStar projects; AWS told The Register that no customer action is required, and no exploitation in the wild is reported

Sources

Every fact in this breakdown comes from the public reporting below. The replay is a model of that reporting, not a reconstruction of the environment it describes.

  1. 1.
    Bucket Monopoly: Breaching AWS Accounts Through Shadow ResourcesAqua Security · Aug 9, 2024 · Researchnaming pattern, bucket claim, bucket policy, CloudFormation template tampering, deployment identity, Glue script tampering, EMR, SageMaker Canvas, Service Catalog, CodeStar, disclosure timeline, AWS fixes, recommendations
  2. 2.
    AWS 'Bucket Monopoly' attacks could allow complete account takeoverThe Register · Aug 7, 2024 · NewsAWS statement, venue, affected services, hash discovery in public code

The estate in the replay follows the researchers' description of their own test environment. Verdicts describe what a control does when it is in place before the run. They are not an assessment of any company's security program.

More cloud attack breakdowns

All breakdowns