Skip to content
Info disclosure Write-up Intermediate

Identifying the AWS account ID from a public S3 bucket

A public S3 bucket's AWS account ID could be discovered by brute-forcing the account ID using the S3:ResourceAccount condition key, and the account ID was then used to find a publicly exposed EBS snapshot. An attacker could use the account ID to enumerate IAM users and roles or find public snapshots.

medium.com

Published on medium.com

The art of cloud reconnaissance: How to transform a simple exposed bucket into the key piece for mapping and enumerating critical AWS resources.

Ronaldsecurit, on medium.com

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 S3 bucket policy allowed the S3:ResourceAccount condition to be evaluated, enabling an attacker to brute-force the account ID digit by digit.

Impact

An attacker could discover the AWS account ID and use it to enumerate IAM users and roles or find publicly exposed EBS and RDS snapshots, potentially leading to further access.

What the attacker needed

Public S3 bucket; AWS account for snapshot search; knowledge of bucket name

The fix

The bucket policy should be configured to avoid exposing the account ID through the S3:ResourceAccount condition, and public snapshots should be reviewed and restricted.

How it was found

  1. Identify open ports on the destination IP address.
  2. Identify the website on the open port and review its source code.
  3. Notice that the website's images are stored in an AWS S3 bucket.
  4. Use the S3 bucket name with a tool to brute-force the AWS account ID.
  5. Get the AWS region from the S3 bucket response headers using curl.
  6. Create an AWS account, go to EC2 snapshots, select public snapshots, and search for the discovered account ID.

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.

Every AWS account has a unique number called an account ID. If a website stores files in a public S3 bucket, that bucket belongs to an AWS account, and the account ID can sometimes be guessed using a special permission check. Once you know the account ID, you can search for other public resources owned by that account, like disk snapshots.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.