Calendar Icon White
December 5, 2026
Clock Icon
8
 min read

Public S3 Buckets: How to Find and Fix Them

How to find every public S3 bucket in your AWS account, fix it with Block Public Access, and serve files that should be public through CloudFront instead.

Public S3 Buckets: How to Find and Fix Them
ChatGPT
Perplexity
Grok
Google AI
Claude
Summarize and analyze this article with:

TL;DR

A public S3 bucket is one that a bucket policy, ACL or access point lets anyone on the internet read or list. To find one, run aws s3api get-bucket-policy-status on every bucket and check the ACLs; to fix it, turn on S3 Block Public Access and serve anything meant to be public through CloudFront.

Public buckets remain one of the most common ways cloud data leaks, and they rarely start as a decision. They start as a quick share, a demo or a static site, and stay open long after anyone remembers why. This guide covers how to find them, how to close them, and how to keep public files public without a public bucket.

Strac Comply cloud posture view showing an S3 bucket without Block Public Access as a critical finding with a CLI fix
An S3 bucket without Block Public Access is a critical finding in Strac.

✨ What makes a public S3 bucket public

AWS treats a bucket as public when its policy or ACLs grant access to everyone. The exact definition is broad on purpose: a policy is public unless every statement is restricted to fixed principals, IP ranges or VPCs. There are four places to look:

Four ways an S3 bucket becomes public: bucket policy, bucket ACL, object ACL, access point policy

The one people miss is AuthenticatedUsers. It sounds like your users. It means anyone with any AWS account, which is the same as public.

Are S3 buckets public by default?

No, and not for a while. AWS began applying two defaults to all new buckets in April 2023: S3 Block Public Access on, and ACLs disabled through the Bucket owner enforced setting. That applies to buckets created from the console, API, CLI, SDKs and CloudFormation.

The catch is the word new. Buckets created before April 2023 kept their settings. So did buckets where someone turned the defaults off to make a share work. If your account is older than that, assume you have at least one bucket worth checking.

How to find every public S3 bucket in your account

Start at the account level. If account-wide Block Public Access is fully on, no bucket in the account can be public, whatever its policy says:

ACCOUNT=$(aws sts get-caller-identity --query Account --output text)
aws s3control get-public-access-block --account-id "$ACCOUNT"

If any of the four settings is false, check every bucket. get-bucket-policy-status answers whether the policy makes it public; the ACL check catches the older grant system:

for b in $(aws s3api list-buckets --query 'Buckets[].Name' --output text); do
  pol=$(aws s3api get-bucket-policy-status --bucket "$b" \
        --query 'PolicyStatus.IsPublic' --output text 2>/dev/null || echo none)
  acl=$(aws s3api get-bucket-acl --bucket "$b" \
        --query "Grants[?Grantee.URI!=null].Grantee.URI" --output text)
  echo "$b  policy_public=$pol  acl_groups=$acl"
done

Any bucket showing policy_public=True or an acl_groups value ending in AllUsers or AuthenticatedUsers is public. For a continuous view, IAM Access Analyzer for S3 lists buckets shared publicly or with other accounts, and Strac checks Block Public Access on every bucket daily as part of its AWS security checklist.

S3 bucket public access: the four Block Public Access settings

S3 Block Public Access is four independent switches, available at the account level and on each bucket. The most restrictive setting wins. Turning all four on is the default and the right answer for almost every bucket.

SettingWhat it doesBlocks
BlockPublicAclsRejects requests that add a public ACLNew public ACLs
IgnorePublicAclsIgnores public ACLs that already existExisting public ACLs
BlockPublicPolicyRejects bucket policies that grant public accessNew public policies
RestrictPublicBucketsLimits buckets with public policies to AWS services and the owner accountExisting public policies

The split matters when you fix a bucket. The two Block settings stop new public grants; the Ignore and Restrict settings neutralize grants already in place. You want both halves. AWS documents each setting in the Block Public Access guide.

Bucket policies vs. ACLs

ACLs are the original S3 permission system and they predate IAM. They grant read or write to a bucket or a single object, and they are easy to miss because they do not show in the bucket policy. AWS now recommends turning them off with Object Ownership set to Bucket owner enforced, so policies are the only thing that grants access:

aws s3api put-bucket-ownership-controls --bucket my-bucket \
  --ownership-controls 'Rules=[{ObjectOwnership=BucketOwnerEnforced}]'

Before you do, check whether anything writes objects with ACLs from another account, such as a log delivery service or a partner upload. Those writes start failing once ACLs are disabled unless the writer stops sending ACL headers.

✨ How to fix a public S3 bucket, step by step

Four steps to fix a public S3 bucket: confirm intent, block access, clean up, check exposure

First, ask whoever owns the bucket whether it is meant to be public. Then turn on all four settings for that bucket:

aws s3api put-public-access-block --bucket my-bucket \
  --public-access-block-configuration \
  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

Blocking makes the bucket private immediately. Then remove the public statement from the policy, or delete the policy if that was its only statement with aws s3api delete-bucket-policy --bucket my-bucket, and disable ACLs as above. Cleaning up matters because the next person to relax Block Public Access would otherwise reopen the bucket in one click.

Turn on Block Public Access for the whole account

Fixing buckets one by one is a cleanup. Turning it on for the account is the control:

aws s3control put-public-access-block --account-id "$ACCOUNT" \
  --public-access-block-configuration \
  BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true

In AWS Organizations, add a service control policy that denies s3:PutAccountPublicAccessBlock to everyone except a break-glass role, so the setting cannot be quietly switched off in a member account. This is the single setting that removes the most S3 risk for the least effort.

✨ When a bucket is meant to be public: use CloudFront

Marketing images, downloads and static sites do need to be public. The bucket does not. Put CloudFront with Origin Access Control in front of a private bucket, and the files are public through your CDN while the bucket stays locked.

CloudFront with Origin Access Control serving files from a private S3 bucket

The bucket policy trusts only your distribution:

{
  "Version": "2012-10-17",
  "Statement": [{
    "Sid": "AllowCloudFrontOAC",
    "Effect": "Allow",
    "Principal": { "Service": "cloudfront.amazonaws.com" },
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::my-public-assets/*",
    "Condition": {
      "StringEquals": {
        "AWS:SourceArn": "arn:aws:cloudfront::123456789012:distribution/EDFDVBD6EXAMPLE"
      }
    }
  }]
}

This policy is not public under AWS's definition, because the condition pins it to one distribution, so it works with all four Block Public Access settings on. You also get HTTPS, caching and access logs for free.

Want every bucket checked for public access every day?

Book a demo of Strac CSPM

How buckets end up public in the first place

Almost every public bucket has a reasonable origin story. Knowing them helps you find the next one before a scanner does:

  • Static website hosting. S3 website endpoints need a public policy, so the bucket was opened years ago and never moved behind CloudFront.
  • A partner or customer share. Someone needed to send a large file and made a bucket or object public instead of using a pre-signed URL.
  • Copied infrastructure code. An old Terraform module or tutorial with acl = "public-read" that nobody questioned.
  • Data science exports. A notebook writes a dataset to a bucket that was opened so a colleague could download it.

The fix for the last three is the same: a safe default in code, so the easy path is the private one. In Terraform, ship every bucket with its public access block and ownership controls:

resource "aws_s3_bucket_public_access_block" "this" {
  bucket                  = aws_s3_bucket.this.id
  block_public_acls       = true
  ignore_public_acls      = true
  block_public_policy     = true
  restrict_public_buckets = true
}

resource "aws_s3_bucket_ownership_controls" "this" {
  bucket = aws_s3_bucket.this.id
  rule { object_ownership = "BucketOwnerEnforced" }
}

Get alerted when someone opens a bucket

A daily check catches a public bucket within a day. For the buckets that matter most you may want minutes. CloudTrail records the API calls that open a bucket, so an EventBridge rule can alert on them as they happen:

{
  "source": ["aws.s3"],
  "detail-type": ["AWS API Call via CloudTrail"],
  "detail": {
    "eventName": ["PutBucketPolicy", "PutBucketAcl", "DeletePublicAccessBlock",
                  "PutPublicAccessBlock"]
  }
}

Route the rule to an SNS topic or your chat tool, and review each event. Real-time alerts tell you something changed; a daily posture check tells you what the state is and keeps the record your auditor wants. Most teams want both.

After the fix: what was exposed?

Closing the bucket stops new access. It does not tell you what already left. Check S3 server access logs or CloudTrail data events for GetObject and ListBucket calls from outside your accounts during the window the bucket was open. Then look at what the bucket actually held.

That second question is a data security question, and it is where Strac's background as a data security company shows. Strac's data loss prevention product scans S3 for PII, PHI, card numbers and secrets, as covered in our guide to scanning sensitive data in S3 buckets. A public bucket full of build artifacts is a cleanup. A public bucket with customer records is an incident.

Public S3 buckets and SOC 2

Auditors test public access under SOC 2 criterion CC6.6, boundary protection, and they test it across the whole audit period. Two things make that easy:

  • Daily evidence. A check that runs every day and saves its result proves buckets stayed private, not just that they were private the day you took a screenshot.
  • Documented exceptions. In Strac, a bucket that is meant to be public is accepted with a reason. It shows in the waiver register for your auditor and comes back for review on the date you set, 12 months by default.

For the broader hardening list beyond public access, including encryption, versioning and logging, see our older guide on how to secure S3 buckets in AWS. For tools that run these checks across clouds, see the best CSPM tools.

Public access signals at a glance

You seeIt meansDo this
IsPublic: trueThe bucket policy grants public accessBlock, then fix the policy
AllUsers grant in the ACLAnyone on the internetIgnorePublicAcls, then disable ACLs
AuthenticatedUsers grantAny AWS account in the worldTreat as public
Access Analyzer: publicPublic via policy or access pointReview the finding source
Pre-signed URL in useTime-limited access to one objectFine; keep expiry short
CloudFront with OACPublic through the CDN onlyFine; the bucket stays private

Strac checks this, and 94 other AWS settings, every day across every account you connect, and gives the CLI command to fix each finding. It does the same for public Azure blob containers and Google Cloud buckets granted to allUsers. See how Strac's CSPM works, or read what CSPM is for the bigger picture.

🌶️ Spicy FAQs about public S3 buckets

How do I know if my S3 bucket is public?

Run aws s3api get-bucket-policy-status --bucket NAME and check IsPublic, then check the bucket ACL for AllUsers or AuthenticatedUsers grants. IAM Access Analyzer and the S3 console also flag buckets with public access.

Are new S3 buckets public by default?

No. Since April 2023 AWS turns on S3 Block Public Access and disables ACLs for every new bucket. Buckets created before that keep whatever settings they had, so older accounts are where public buckets usually hide.

What is the difference between a bucket policy and an ACL?

A bucket policy is a JSON IAM-style policy on the bucket. ACLs are an older, per-bucket and per-object grant system. AWS recommends disabling ACLs with the Bucket owner enforced Object Ownership setting and controlling access with policies only.

How do I serve public files from S3 safely?

Keep the bucket private and put CloudFront in front of it with Origin Access Control. The bucket policy only allows the CloudFront distribution to read, so files are public through your CDN but the bucket itself is not.

Does Block Public Access break pre-signed URLs?

No. Pre-signed URLs are signed by an identity that already has access, so they keep working with Block Public Access on. They are the right way to share a single private object for a limited time.

Customer story

“Don’t just alert on problems, fix them.”

Scott Roberts, Chief Information Security Officer, UiPath

  • UiPath
  • Crypto.com
  • Inmar Intelligence
  • thredUP
  • Paymentology
  • Enveda
  • Genesis Molecular AI
  • MeridianLink
More customer stories →
How do I know if my S3 bucket is public?
Are new S3 buckets public by default?
What is the difference between a bucket policy and an ACL?
How do I serve public files from S3 safely?
Does Block Public Access break pre-signed URLs?
Discover & Protect Data on SaaS, AI, MCP, Endpoints & Cloud
Strac provides end-to-end data loss prevention for all SaaS and Cloud apps. Integrate in under 10 minutes and experience the benefits of live DLP scanning, live redaction, and a fortified SaaS environment.
Get compliant from $4,995

Latest articles

Browse all

Get Your Datasheet

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Close Icon