How to Check if Your S3 Buckets Are Publicly Exposed (Free Tool)
Public S3 buckets are still one of the most common findings in external pentests, and almost never because someone typed "make this public" on purpose. A bucket gets opened for a static site, a partner integration or a quick demo, and nobody closes it again. This guide covers two ways to find out where you stand: an outside-in check with our S3 Bucket Inspector, and a set of read-only AWS CLI commands you can run from inside the account to confirm what the scanner sees and fix it.
Why S3 exposure still happens in 2026
AWS has tightened the defaults a lot. Since April 2023, every new S3 bucket has S3 Block Public Access enabled and ACLs disabled by default, whether you create it from the console, CLI, SDKs or CloudFormation. Before that, buckets were private by default but Block Public Access wasn't always switched on when you created them through the API.
The defaults don't protect you in three situations:
- Older buckets. Anything created before the change keeps whatever settings it had. Many startups have a 2019-era
assetsoruploadsbucket that nobody has looked at since. - Deliberate overrides. The defaults can be turned off. AWS's own announcement explains that if you need a public bucket you remove the public access block with
DeletePublicAccessBlock, and plenty of Terraform modules and tutorials do exactly that. - "Not public" doesn't mean "safe". A bucket policy that grants access to another AWS account, or to
AuthenticatedUsersthrough an old ACL, may not count as public in AWS's definition but can still give access to people who shouldn't have it.
So the useful question isn't whether AWS defaults are secure. It's what each bucket you actually own allows right now.
Option 1: Check from the outside with the S3 Bucket Inspector
The fastest way to see what an attacker sees is to test from the internet, without credentials. The S3 Bucket Inspector checks S3 buckets associated with your verified domain from the outside, the way an anonymous user on the internet would, and reports whether they can be listed or read without credentials.
How it works on SecurityInfinity:
- Verify your domain. We only scan domains you've proved you own, using a DNS TXT record or a matching work email. This is a hard requirement, not a formality.
- Run the scan. Checks are read-only. The agent tries the same unauthenticated requests anyone else could make, and it never writes, deletes or changes anything.
- Review the findings. Each exposed bucket comes with the evidence (the request and the response) so your engineers can reproduce it.
The free Starter plan gives you 100 credits and one verified domain with no card required, which is enough to try the attack-surface and web checks. The dedicated S3 Bucket Inspector and continuous re-scans are part of Pro ($9/month); details are on the pricing page. If you want a wider sweep, the cloud misconfiguration scanner and the JS secrets scanner catch the two things that usually sit next to an open bucket: other misconfigured cloud services and hardcoded access keys in front-end code.
An outside-in scan only finds buckets it can connect to your domain. To get the full inventory, also run the checks below inside your AWS account.
Option 2: Manual checks with the AWS CLI
Every command in this section is read-only. You'll need credentials with the matching s3:Get* permissions, for example s3:GetBucketPolicyStatus for the policy status call, as the AWS CLI reference notes.
Step 1: List your buckets
aws s3api list-buckets --query "Buckets[].Name" --output text
Keep this list. You'll loop over it in the steps that follow.
Step 2: Check account-level Block Public Access
Account-level settings apply to every bucket in the account, so check them first:
aws s3control get-public-access-block --account-id 123456789012
A fully locked-down account returns all four settings as true:
{
"PublicAccessBlockConfiguration": {
"BlockPublicAcls": true,
"IgnorePublicAcls": true,
"BlockPublicPolicy": true,
"RestrictPublicBuckets": true
}
}
If you get a NoSuchPublicAccessBlockConfiguration error instead, there is no account-level block, and each bucket's own settings are all that stands between it and the internet.
Here's what each setting does, per the AWS CLI reference for get-public-access-block:
| Setting | What it does |
|---|---|
BlockPublicAcls | Rejects new public ACLs on buckets and objects. Doesn't change existing ACLs. |
IgnorePublicAcls | Makes S3 ignore all public ACLs, including existing ones. |
BlockPublicPolicy | Rejects new bucket policies that grant public access. Doesn't change existing policies. |
RestrictPublicBuckets | Limits buckets with public policies to AWS service principals and authorized users in the owning account. |
The two "Block" settings only stop new changes. The "Ignore" and "Restrict" settings are the ones that neutralise exposure that already exists, so if you can only switch some of them on, start with those.
AWS applies the most restrictive combination of organization, account, bucket and access point settings. If the account level is fully on, a bucket-level gap is covered.
Step 3: Check bucket-level Block Public Access
aws s3api get-public-access-block --bucket my-bucket
The output has the same four fields. Again, a NoSuchPublicAccessBlockConfiguration error means nothing is set at the bucket level.
Step 4: Ask S3 whether the bucket policy is public
Don't read every JSON policy by hand. S3 will tell you whether it considers a bucket's policy public:
aws s3api get-bucket-policy-status --bucket my-bucket
{
"PolicyStatus": {
"IsPublic": true
}
}
IsPublic: true is the finding. If the bucket has no policy, the command returns a NoSuchBucketPolicy error, which is fine.
AWS's definition of "public" is stricter than most people expect. A policy is non-public only if it grants access to fixed values, meaning no wildcards, for things like specific principals, aws:SourceArn, aws:SourceVpc/aws:SourceVpce or aws:SourceIp CIDR blocks. AWS also notes that aws:SourceIp conditions with very broad ranges, wider than /8 for IPv4 or /32 for IPv6 (excluding RFC 1918 private ranges), count as public.
To see the policy itself:
aws s3api get-bucket-policy --bucket my-bucket --query Policy --output text
Look for "Principal": "*" or "Principal": {"AWS": "*"} with no restricting Condition, and for cross-account principals you don't recognise.
Step 5: Check ACLs and Object Ownership
First check whether ACLs are even active on the bucket:
aws s3api get-bucket-ownership-controls --bucket my-bucket
If ObjectOwnership is BucketOwnerEnforced, ACLs are disabled, and per the S3 ACL documentation only policies control access. Otherwise, inspect the bucket ACL for the two dangerous predefined groups:
aws s3api get-bucket-acl --bucket my-bucket \
--query "Grants[?Grantee.URI=='http://acs.amazonaws.com/groups/global/AllUsers' || Grantee.URI=='http://acs.amazonaws.com/groups/global/AuthenticatedUsers']"
An empty [] is what you want. AWS's documentation spells out the difference: AllUsers means anyone in the world, signed or anonymous, and AuthenticatedUsers means any AWS account, not just accounts in your organization. A READ grant on a bucket lets the grantee list objects. A WRITE grant lets them upload objects you'll pay to store.
Step 6: Run all of it across every bucket
for b in $(aws s3api list-buckets --query "Buckets[].Name" --output text); do
status=$(aws s3api get-bucket-policy-status --bucket "$b" \
--query PolicyStatus.IsPublic --output text 2>/dev/null || echo "no-policy")
echo "$b policy_public=$status"
done
This is a quick triage pass rather than an audit. Buckets in other regions, or with errors you suppressed, deserve a second look.
Step 7: Confirm from an unauthenticated client
To confirm a finding, test the way an attacker would, with no credentials:
aws s3 ls s3://my-bucket --no-sign-request
curl -s https://my-bucket.s3.amazonaws.com/ | head -c 500
--no-sign-request is a global AWS CLI option that sends the request without loading credentials. If either command returns an object listing (<ListBucketResult> in the curl output), the bucket is publicly listable. An AccessDenied response is the result you want.
Step 8: Use IAM Access Analyzer for the cross-account view
The CLI checks focus on public access. To see buckets shared with other accounts, use IAM Access Analyzer for S3 in the S3 console. It flags buckets that are public or shared outside your zone of trust. That's where forgotten vendor and contractor access usually turns up.
How to fix a publicly exposed bucket
Before changing anything, work out whether the bucket is meant to serve public content. Breaking a production asset bucket at 5pm on a Friday is its own incident.
1. If the bucket shouldn't be public, enable all four bucket-level settings:
aws s3api put-public-access-block --bucket my-bucket \
--public-access-block-configuration \
BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
2. Enforce it at the account level once you've confirmed no bucket legitimately needs public access:
aws s3control put-public-access-block --account-id 123456789012 \
--public-access-block-configuration \
BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
3. Disable ACLs by setting Object Ownership to BucketOwnerEnforced. AWS recommends keeping ACLs disabled unless you need per-object access control. Read the AWS guidance on migrating existing ACL grants before you switch, because existing ACL-based access stops working.
4. If the bucket serves a website or assets, don't make the bucket public. Put CloudFront in front of it and restrict the bucket to CloudFront using origin access control. Users still get the content, and the bucket itself stays private.
5. Treat exposed data as compromised. If the bucket held backups, exports, logs or user uploads, assume someone has already listed it. Check S3 server access logs or CloudTrail data events if you had them enabled, rotate any credentials found in the files, and bring in whoever owns incident response.
6. Prevent regressions. Add a policy-as-code check in CI (for example, fail Terraform plans that set any Block Public Access flag to false) and keep re-scanning from the outside.
Where this fits in a SOC 2 or customer security review
Auditors and enterprise security questionnaires will ask how you prevent public exposure of customer data. "We enabled account-level Block Public Access, and we scan externally on a schedule" is a much stronger answer than "we think everything's private." If you need a formal report, our engineer-delivered pentest gives you engineer-verified findings with evidence, fixes, OWASP Top 10 mapping and a free retest, starting at $499 for an external assessment. The $999 authenticated tier adds SOC 2 and ISO 27001 mapping and a signed attestation letter.
Check your buckets now
Verify your domain and run a scan to see which buckets tied to your domain are reachable from the internet, then use the CLI steps above to confirm and close each one. Start with the S3 Bucket Inspector, or browse all scanners to cover the rest of your attack surface.
Frequently asked questions
Are new S3 buckets public by default?
No. S3 buckets have always been private by default, and since April 2023 AWS also enables all four Block Public Access settings and disables ACLs on every new bucket. Buckets created before then, or buckets where someone removed the public access block, can still be exposed.
What does aws s3api get-bucket-policy-status tell me?
It returns PolicyStatus.IsPublic, which is S3's own judgement of whether the bucket policy grants public access under AWS's definition of "public". It doesn't evaluate ACLs, so check get-bucket-acl and Object Ownership separately.
Is a bucket with Block Public Access enabled completely safe?
It's protected from public access, but a bucket policy can still grant access to specific external AWS accounts, and an IAM user in your own account can still have too much access. Use IAM Access Analyzer for S3 to review cross-account sharing as well.
Can I check if someone else's S3 bucket is public?
Only test buckets you own or are explicitly authorised to test. SecurityInfinity enforces this by requiring DNS TXT or work-email verification of the domain before any scan runs.
Is the S3 Bucket Inspector free?
You can try it with the free Starter plan's 100 credits on one verified domain, with no card required. Continuous monitoring, re-scans and the full set of agents are on Pro at $9/month or $90/year.