Skip to content
Pwnversity
CLOUD-S3intermediate · 6 min · upd. 2026-10

Buckets and Public Storage

OWASP A02:2025

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.

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]
Ventana de terminal
# name patterns to try: target, target-backups, target-dev, target-prod, target-assets, target-logs...
# multi-cloud discovery by keyword
cloud_enum -k target # S3 + Azure Blob + GCS at once
s3scanner scan -f buckets.txt
# search engines for already-indexed buckets
# GrayhatWarfare -> buckets.grayhatwarfare.com
# Google dorking (see recon-dorking)
# site:s3.amazonaws.com target

--no-sign-request tests anonymous access:

Ventana de terminal
# list contents (if public listing is allowed)
aws s3 ls s3://<bucket> --no-sign-request
curl https://<bucket>.s3.amazonaws.com/ # XML listing if public
# download everything
aws s3 sync s3://<bucket> ./loot --no-sign-request
# write? (very serious)
echo test > test.txt
aws s3 cp test.txt s3://<bucket>/ --no-sign-request
# bucket ACL/permissions
aws s3api get-bucket-acl --bucket <bucket> --no-sign-request
Ventana de terminal
# Azure Blob (list a public container)
curl "https://<account>.blob.core.windows.net/<container>?restype=container&comp=list"
# GCS
gsutil ls gs://<bucket> # if public
curl https://storage.googleapis.com/<bucket>
Ventana de terminal
# the juiciest: backups (.sql, .bak), .env, config, keys (.pem, id_rsa, service-account.json),
# source code, DB dumps, personal data, logs with secrets
grep -rniE 'password|secret|api_key|AKIA' ./loot
trufflehog filesystem ./loot
  • 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/*"
}
]
}
  • Block Public Access at account level (AWS); public access disabled by default (Azure/GCP).
  • Minimal policies and ACLs: never Principal: "*" or AllUsers; 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.
  • 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)