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.
Threat model
Section titled “Threat model”Buckets can be configured for public read, list, and even write access. Historically it’s been easy to enable by mistake, and predictable names (company-backups) make them easy to find. The attacker discovers them by name brute-forcing or search engines, tests anonymous access and, if present, downloads everything and hunts for secrets; anonymous write access is critical (content poisoning, malware hosting, defacement). Real cases of open-bucket breaches include Accenture and the S3 component of the Capital One incident (2019).
flowchart TD
A[Org name] --> B[Generate candidates]
B -->|company-backups, -dev, -logs| C[Test anonymous access]
C -->|--no-sign-request / curl| D{Access?}
D -->|read/list| E[Download and hunt secrets]
D -->|write| F[Upload webshell / poison]
E --> G[Credentials -> account access]
G --> H[cloud-iam]
Theory: discovering buckets
Section titled “Theory: discovering buckets”# name patterns to try: target, target-backups, target-dev, target-prod, target-assets, target-logs...# multi-cloud discovery by keywordcloud_enum -k target # S3 + Azure Blob + GCS at onces3scanner scan -f buckets.txt# search engines for already-indexed buckets# GrayhatWarfare -> buckets.grayhatwarfare.com# Google dorking (see recon-dorking)# site:s3.amazonaws.com targetRed Team
Section titled “Red Team”Check access (AWS S3)
Section titled “Check access (AWS S3)”--no-sign-request tests anonymous access:
# list contents (if public listing is allowed)aws s3 ls s3://<bucket> --no-sign-requestcurl https://<bucket>.s3.amazonaws.com/ # XML listing if public# download everythingaws s3 sync s3://<bucket> ./loot --no-sign-request# write? (very serious)echo test > test.txtaws s3 cp test.txt s3://<bucket>/ --no-sign-request# bucket ACL/permissionsaws s3api get-bucket-acl --bucket <bucket> --no-sign-requestAzure Blob and GCS
Section titled “Azure Blob and GCS”# Azure Blob (list a public container)curl "https://<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 juiciest: backups (.sql, .bak), .env, config, keys (.pem, id_rsa, service-account.json),# source code, DB dumps, personal data, logs with 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 → data exposed without being “buckets”.
- Subdomain takeover if a CNAME points to a bucket that no longer exists (see Subdomain takeover).
- Bucket policies too open (not just ACLs):
Principal: "*". Example of a dangerous policy:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::company-backups/*" } ]}Blue Team
Section titled “Blue Team”- Block Public Access at 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.
Checklist
Section titled “Checklist”- Discover buckets by patterns and tools (cloud_enum/GrayhatWarfare)
- Test anonymous listing (
--no-sign-request/ curl) - Download content and hunt secrets (trufflehog)
- Test anonymous write (critical)
- Review bucket ACLs and policies (
Principal: "*") - Azure Blob and GCS equivalents
- Public snapshots/AMIs/RDS
- Subdomain takeover via nonexistent bucket (Subdomain takeover)