Buckets and Public Storage
Object storage (S3 on AWS, Blob on Azure, Cloud Storage on GCP) is one of the most used cloud services and, due to lax configurations, one of the biggest sources of data leaks in recent history. A misconfigured bucket can expose backups, databases, credentials, source code, and personal data to anyone with the URL. Discovering and assessing buckets is almost mandatory in every cloud pentest.
The problem
Section titled “The problem”Buckets can be configured for public access (read, list, and even write). Historically public access has been easy to enable by mistake, and predictable names (company-backups) make them easy to find. Result: countless breaches from open buckets (Verizon, Accenture, Capital One, and a long etcetera).
Discover buckets
Section titled “Discover buckets”# name patterns to trytarget, target-backups, target-dev, target-prod, target-assets, target-logs...# discovery toolscloud_enum -k target # S3 + Azure Blob + GCS at onces3scanner scan -f buckets.txt# search engines for already-indexed bucketsGrayhatWarfare (buckets.grayhatwarfare.com)# Google dorking (see recon-dorking)site:s3.amazonaws.com targetCheck access (AWS S3)
Section titled “Check access (AWS S3)”# list the contents (if public listing is allowed)aws s3 ls s3://<bucket> --no-sign-requestcurl https://<bucket>.s3.amazonaws.com/ # lists XML if public# download everythingaws s3 sync s3://<bucket> ./loot --no-sign-request# write? (very serious: upload files, webshell, defacement)aws s3 cp test.txt s3://<bucket>/ --no-sign-request# bucket permissions/ACLaws s3api get-bucket-acl --bucket <bucket> --no-sign-request--no-sign-request tests anonymous access. Anonymous write access is critical (content poisoning, malware hosting).
Azure Blob and GCS
Section titled “Azure Blob and GCS”# Azure Blobhttps://<account>.blob.core.windows.net/<container>?restype=container&comp=list# GCSgsutil ls gs://<bucket> # if publiccurl https://storage.googleapis.com/<bucket>What to look for inside
Section titled “What to look for inside”# the juiciestbackups (.sql, .bak), .env, config, keys (.pem, id_rsa, service-account.json)source code, DB dumps, personal data, logs with secrets# after downloading, search for secretsgrep -rniE 'password|secret|api_key|AKIA' ./loottrufflehog filesystem ./lootBeyond listing: other vectors
Section titled “Beyond listing: other vectors”- Public snapshots/EBS, public AMIs, shared RDS snapshots → exposed data without being “buckets”.
- Subdomain takeover if a CNAME points to a no-longer-existing bucket (see Subdomain takeover).
- Overly open bucket policies (not just ACLs):
Principal: *.
For the defense
Section titled “For the defense”- Block Public Access at the account level (AWS) / public access disabled by default (Azure/GCP).
- Minimal policies and ACLs: never
Principal: *orAllUsers; review with tools (Prowler/ScoutSuite flag public buckets). - Encryption at rest, versioning, and access logging (S3 access logs / CloudTrail data events).
- Don’t put secrets in buckets; use secret managers. Unpredictable names are not a defense.
- Monitor anonymous access and policy changes; remediate public snapshots/AMIs.
Testing checklist
Section titled “Testing checklist”- Discover buckets by patterns and tools (cloud_enum/GrayhatWarfare)
- Test anonymous listing (—no-sign-request / curl)
- Download content and search for secrets (trufflehog)
- Test anonymous write (critical)
- Review bucket ACLs and policies
- Azure Blob and GCS equivalents
- Public snapshots/AMIs/RDS
- Subdomain takeover via nonexistent bucket (Subdomain takeover)