
AWS S3 Enumeration

Scenario
It’s your first day on the red team, and you’ve been tasked with examining a website that was found in a phished employee’s bookmarks. Check it out and see where it leads! In scope is the company’s infrastructure, including cloud services.
Lab prerequisites
Basic Linux command line knowledge
AWS cli installed in your linux, if not check out this post AWS cli installation
Familiarity with the AWS CLI
Basic S3 enumeration and credential exfiltration
An awareness of how this scenario could be been prevented
Difficulty
Beginner
Focus
Red
Real-world context
Amazon S3 (Simple Storage Service) is a very popular (and the second oldest!) AWS service that is used to store files and backups, and can even be used to serve websites. This multi-use functionality has led some to argue that this service would be more secure if it were split into separate public web hosting and private file storage services. In recent years AWS have introduced more visual warnings when customers are making buckets world-readable, but still, if this setting is available, people will set it! Misconfigurations and overly permissive settings in S3 have resulted in many data breaches over the years.
Walkthrough
We were given a URL to start our enumeration: http://dev.huge-logistics.com
.
Its nothing but a normal webpage
After inspecting the page source, we noticed it was hosted on an S3 bucket.
We used the AWS CLI for further enumeration.
S3 Enumeration
First, we attempted to list the bucket contents:
1 | ➜ S3 enumeration aws s3 ls s3://dev.huge-logistics.com |
Since credentials were missing, it returned an error. We retried with the --no-sign-request
option to check for public access
The bucket allowed access, displaying several directories:
1 | ➜ S3 enumeration aws s3 ls s3://dev.huge-logistics.com --no-sign-request |
The bucket was publicly accessible and contained several directories. We can try to check each folder and files.
1 | ➜ S3 enumeration aws s3 ls s3://dev.huge-logistics.com/admin --no-sign-request |
Only the shared folder was accessible, containing a file named hl_migration_project.zip
. We downloaded it:
1 | ➜ S3 enumeration aws s3 ls s3://dev.huge-logistics.com/shared/ --no-sign-request |
1 | # AWS Configuration |
Inside the ZIP file, we found migrate_secrets.ps1 containing an AWS access key and secret key. We configured the credentials and checked their validity:
1 | ➜ S3 enumeration aws configure --profile s3-enum |
This provided us additional access:
1 | ➜ S3 enumeration aws sts get-caller-identity --profile s3-enum |
With this, we accessed previously restricted directories, including admin and migration-files.
1 | ➜ S3 enumeration aws s3 ls s3://dev.huge-logistics.com/admin --profile s3-enum |
We copied both migrate_secrets.ps1
and test-export.xml
file to our machine and checked, migrate_secrets.ps1
is the same old file which we got before. In test-export.xml
we got AWS IT Admin
‘s secret and access keys which we can use to access admin directory.
1 | ➜ S3 enumeration cat test-export.xml |
We can configure it again and check for any other interesting things.
1 | ➜ S3 enumeration aws configure --profile it-admin |
And we got access to admin directory and our flag and website_transactions_export.csv
file.
1 | ➜ S3 enumeration aws s3 cp s3://dev.huge-logistics.com/admin/flag.txt ./ --profile it-admin |
Conclusion
With escalated privileges, we accessed the admin directory, containing a flag and transaction data. This concluded our enumeration, highlighting the risks associated with misconfigured S3 permissions and the importance of securing sensitive files in cloud environments.
- Title: AWS S3 Enumeration
- Author: Sebin Thomas
- Created at : 2024-11-03 12:14:00
- Updated at : 2025-02-24 21:01:48
- Link: https://0xsebin-blogs.vercel.app/2024/11/03/AWS-S3-Enumeration/
- License: All Rights Reserved © Sebin Thomas