Public object storage: finding and closing open buckets and containers

Buckets made public by mistake remain one of the most common cloud leaks. How to check S3, Azure Blob, and Google Cloud Storage exposure from the CLI, enable account-wide blocks, and share files safely instead.

Lesson 12 of 29 · 10 min read · practice only with authorization

Diagram

Checking one bucket’s exposure

Follow the path. One example at a time.

Step 1 of 4

Account block

Is public access blocked for the whole account?

Illustration: Account block
$ aws s3control get-public-access-block --account-id 111122223333
{"BlockPublicAcls":true,"IgnorePublicAcls":true,"BlockPublicPolicy":true,"RestrictPublicBuckets":true}

The example on the open step is one illustration, or the fix you can paste into an application you own.

What this page is made of

3 pieces. Each one says what fails, who is affected, what you would notice, and what you change.

  1. Account-level blocks

    What fails
    One setting can stop any bucket from going public.
    Who is affected
    Every bucket in the account.
    What you would notice
    Accounts without S3 Block Public Access, or Azure storage accounts with allowBlobPublicAccess true.
    What you change
    Enable account-level blocks and grant exceptions only for website buckets.
  2. Policies with Principal *

    What fails
    A bucket policy granting "*" makes objects readable by anyone.
    Who is affected
    People whose files are in the bucket.
    What you would notice
    Policy statements with Principal set to * and no condition.
    What you change
    Use specific principals or signed URLs.
  3. Access logs

    What fails
    Without logs you cannot tell whether exposed data was read.
    Who is affected
    The incident response team.
    What you would notice
    No server access logs or data events.
    What you change
    Enable access logging on sensitive buckets before you need it.

Azure and Google Cloud

The same checks exist on other providers.

$ az storage account show -n contosodata --query allowBlobPublicAccess
false
$ gcloud storage buckets describe gs://legal-exports --format="value(iam_configuration.public_access_prevention)"
enforced

If something was exposed

Close access first, then use access logs to find which objects were read and by whom, then decide on notification with legal counsel.

Check yourself

Recognition and the fix. Nothing here is a procedure.

1 / 3

Which single setting stops new public buckets across an AWS account?

Sibling techniques

Pages at the same depth, plus a lab and a glossary card for this one.

  1. MapCloud command lines: reading identity, not touring productionThe AWS, Azure, and Google Cloud CLIs are how you ask a cloud account what it believes.
  1. 01Cloud security fundamentals: shared responsibility, identity, and the audit trailWhat the provider secures and what you do, why identity is the cloud perimeter, and the first read-only commands to understand an AWS, Azure, or Google Cloud account you are responsible for.
  2. 02Cloud accounts and container environmentsCloud failure is usually identity and exposure.
  3. 03Workload identity instead of static keysA long-lived access key on a laptop or in a repository is a session that does not expire.
  4. 04Open security groups: SSH, RDP, and databases reachable from anywhereFirewall rules that allow 0.0.0.0/0 to management or database ports expose servers to constant scanning.
  5. 05Disabled metadata protections: IMDSv2 and why it blunts SSRFCloud instance metadata services hand out credentials to code on the machine.

Practice

  1. LabTenant deskTwo companies, one API. See what changes when the server checks ownership.

Glossary

  1. CardPublic object storageA bucket or blob container is world-readable or world-writable, so data leaks or is replaced.