AWS Builder Center
Can Anyone Access Your S3 Bucket? A Hands-On AWS Security Investigation

Can Anyone Access Your S3 Bucket? A Hands-On AWS Security Investigation

Learn how to investigate S3 bucket exposure, understand public access controls, and use IAM Access Analyzer to identify risky permissions before they become security incidents.

I'm a student at the ECU Sri Lanka Campus.

๐Ÿšจ One Misconfiguration. One S3 Bucket. A Potential Data Exposure.

Imagine you're working as a Cloud Security Analyst.
During a routine security review, you discover an Amazon S3 bucket containing application files, configuration data, and internal documents.
Everything looks normal until you inspect its permissions.
A bucket policy contains a wildcard principal (ย "Principal": "*"ย ) granting read access to objects.
Now comes the important question:
Can anyone on the internet access the data, or is another security control preventing it?
This is exactly the kind of question cloud security professionals need to investigate.
Amazon S3 is one of the most widely used AWS storage services. But understanding who can access an S3 bucket isn't always as simple as checking whether its permissions say "public" or "private."
Multiple security controls work together to determine access.
In this hands-on tutorial, we'll investigate S3 permissions, understand common misconfigurations, and use AWS IAM Access Analyzer to identify potentially risky access.
Best of all, we'll keep our lab bucket private throughout the exercise.
Let's get started! ๐Ÿš€

๏ปฟ

๐Ÿ›ก๏ธ 1. Understanding Amazon S3 Security

Before jumping into the AWS console, we need to understand the controls that protect S3 resources.
Amazon Simple Storage Service (Amazon S3) is an object storage service commonly used for application assets, backups, logs, and other data.
In S3, data is stored as objects inside buckets.
An important part of protecting that data is making sure that only authorized identities and services can access it.
There are four key security concepts worth understanding.

๐Ÿ” 1. IAM Policies

AWS Identity and Access Management (IAM) policies define what actions an IAM identity is allowed to perform.
For example, an application role might need permission to:
  • Read objects using ย s3:GetObjectย .
  • Upload objects using ย s3:PutObjectย .
  • List objects using ย s3:ListBucketย .
A properly designed IAM policy grants only the permissions needed for the application to function.
This principle is called least privilege.

๐Ÿ“œ 2. S3 Bucket Policies

Bucket policies are resource-based policies attached directly to S3 buckets.
They can specify which principals are allowed or denied access, which actions they can perform, and which resources those permissions apply to.
For example, a bucket policy might allow a particular AWS role to retrieve objects.
However, a poorly designed bucket policy might accidentally grant access to a much wider audience.
A statement containing ย "Principal": "*"ย  means that the principal is unrestricted by that element. Whether access is actually public depends on the complete policy, its conditions, and other applicable controls.

๐Ÿšซ 3. S3 Block Public Access

Amazon S3 Block Public Access provides additional protection against unintended public access.
It includes four settings:
Setting
Purpose
BlockPublicAcls
Rejects requests that attempt to set public ACLs
IgnorePublicAcls
Ignores public permissions granted through ACLs
BlockPublicPolicy
Rejects bucket policies that would allow public access
RestrictPublicBuckets
Restricts public and cross-account access through public bucket policies
New S3 buckets have all four Block Public Access settings enabled by default.
These protections can operate at the bucket, account, and organization levels, with S3 enforcing the most restrictive applicable settings.
Important: Block Public Access is an additional safeguard. It doesn't replace the need to review IAM policies, bucket policies, and other access controls.

๐Ÿงฉ 4. Access Control Lists (ACLs)

ACLs are another mechanism historically used to manage S3 access.
However, new general purpose S3 buckets use Bucket owner enforced Object Ownership by default, meaning ACLs are disabled.
For most modern use cases, AWS recommends keeping ACLs disabled and managing access through policies.

Key lesson

A bucket's security depends on the interaction between its access policies and the controls that enforce them.
That's why a proper security investigation involves examining multiple settings rather than trusting a single indicator.

๏ปฟ

โš™๏ธ 2. Hands-On Lab: Creating a Secure S3 Bucket

Now let's move into the AWS Management Console.
Our objective is to create a private S3 bucket, examine its permissions, and verify that anonymous users cannot retrieve its objects.

Prerequisites

You'll need:
  • An AWS account with appropriate S3 and IAM Access Analyzer permissions.
  • Access to the AWS Management Console.
  • A test environment where you're authorized to create resources.
  • A simple text file containing non-sensitive sample data.
Cost awareness: S3 storage and requests can incur charges. IAM Access Analyzer external access findings are available without additional analyzer charges, but other analyzer types and custom policy checks may be billable.
Review AWS pricing before creating resources.

Step 1: Create the S3 bucket

  1. Sign in to the AWS Management Console.
  1. Search for S3.
  1. Navigate to General purpose buckets.
  1. Click Create bucket.
  1. Select your preferred AWS Region.
  1. Enter a globally unique bucket name.
For this tutorial, we'll use the example name:
ย aws-security-investigation-demo-12345ย 
Replace this with your own unique name.
Under Object Ownership, keep the default:
ACLs disabled (Bucket owner enforced)
Under Block Public Access settings, make sure:
Block all public access is enabled.
Leave the other security settings at their defaults unless your environment requires otherwise.
Click Create bucket.
Congratulations! You've created your first resource for this security investigation.

Step 2: Upload a sample object

Open your newly created bucket.
  1. Navigate to Objects.
  1. Click Upload.
  1. Create a text file named ย security-test.txtย .
  1. Add the following content:
ย This is a test file for an AWS S3 security investigation.ย 
  1. Upload the file.
Do not upload real credentials, API keys, personal information, or sensitive organizational data.
We now have a private test object that we can use to examine access behavior.

๏ปฟ

๐Ÿ” 3. Investigating the Bucket's Permissions

This is where we start thinking like a cloud security analyst.
Navigate to your bucket's Permissions tab.
We want to answer three important questions.

Question 1: Is Block Public Access enabled?

Locate the Block public access (bucket settings) section.
Because we kept the default configuration, all four protection settings should be enabled.
This is our first positive security observation.
However, remember that Block Public Access focuses on public exposure. It doesn't guarantee that every IAM identity or external account has the correct permissions.

Question 2: Is there a bucket policy?

Scroll to the Bucket policy section.
For our new bucket, there should normally be no bucket policy attached.
This makes sense because we haven't configured any resource-based permissions.
In a real investigation, this is where we'd review policy statements for:
  • Wildcard principals
  • Excessively broad actions
  • Unexpected external AWS accounts
  • Missing or overly broad conditions
  • Permissions that aren't required for the bucket's intended purpose
We also need to consider identity-based IAM permissions and other applicable access controls.

Question 3: Are ACLs enabled?

Locate the Object Ownership and Access control list (ACL) sections.
Our bucket should have:
Object Ownership: Bucket owner enforced
This means ACLs are disabled and no longer control access to objects in the bucket.
Access is managed through policies instead.

What have we learned?

So far, our bucket has three useful security characteristics:
โœ… Block Public Access is enabled.
โœ… No unnecessary bucket policy has been configured.
โœ… ACLs are disabled.
But let's go one step further.
Instead of relying only on console settings, let's test what happens when someone tries to access an object without authentication.

๏ปฟ

๐Ÿงช 4. Testing Anonymous Access

Open the Objects tab and select ย security-test.txtย .
Find its Object URL in the object properties.
Copy the URL and open it in a private or incognito browser window.
Make sure you're using the regular object URL, not a presigned URL.
Because our bucket doesn't grant anonymous read permissions, the request should fail.
You will normally see an error similar to:
403 AccessDenied
Why does this happen?
The browser makes an unauthenticated request for the object.
Since our bucket hasn't granted public read access, S3 denies the request.
This is the expected result.

SOC Analyst Observation

Test: Anonymous HTTP request to an S3 object.
Expected result: Access denied.
Observed result: Record the actual HTTP response from your test.
Interpretation: The tested object wasn't publicly retrievable through that unauthenticated request.
However, there's an important limitation.
A 403 response alone doesn't prove that a bucket is completely secure.
It doesn't tell us whether other objects, IAM identities, bucket policies, or cross-account permissions introduce additional risks.
For that, we need more visibility.
That's where IAM Access Analyzer becomes useful.

๏ปฟ

๐Ÿ”Ž 5. Using IAM Access Analyzer to Investigate S3 Exposure

AWS IAM Access Analyzer helps identify AWS resources that grant access to external principals.
For Amazon S3, it can identify external access granted through supported bucket policies, ACLs, and access point policies.
Instead of manually opening every bucket and checking its permissions, analysts can use Access Analyzer findings to prioritize resources that might require investigation.

Step 1: Enable external access analysis

Open the IAM console.
  1. Navigate to Access Analyzer.
  1. Select Analyzer settings.
  1. Choose Create analyzer.
  1. Select Resource analysis โ€“ External access.
  1. Enter an analyzer name such as ย s3-security-analyzerย .
  1. Select Current account as the zone of trust.
  1. Make sure you're configuring the intended AWS Region.
  1. Create the analyzer.
If an appropriate account-level external access analyzer already exists, you can use that instead.
Important: External access analysis is Regional. You'll need an analyzer in each Region where you want to analyze supported resources.

Step 2: Review external access findings

Return to the Amazon S3 console.
Open General purpose buckets and expand the External access summary.
You can also navigate to Access analyzer for S3 from the S3 console.
This interface helps identify buckets that grant public or cross-account access.
Depending on your environment, you may find information such as:
  • Bucket name
  • Access level
  • External principal
  • How the access is granted
  • Finding status
For example, a finding could indicate that a bucket allows an external AWS account to read objects through its bucket policy.
That information gives an analyst a starting point for reviewing the access.

Step 3: Interpret our lab result

Here's something important.
Our newly created private bucket shouldn't normally generate an external-access finding.
Why?
Because we haven't granted external access to it.
IAM Access Analyzer isn't designed to generate an alert for every bucket. It identifies supported resources that grant access beyond the selected zone of trust.
An empty findings list can therefore be an expected result.
It doesn't mean the tool is broken.
It also doesn't guarantee that every other security risk has been eliminated.
Another detail worth remembering: findings aren't always instantaneous. AWS documentation notes that policy changes can take time to appear in the analyzer, and the S3 External access summary has its own refresh cycle.

๏ปฟ

๐Ÿšจ 6. Understanding a Potentially Dangerous S3 Bucket Policy

Now let's investigate a common misconfiguration without exposing our lab bucket.
Consider this hypothetical bucket policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadExample",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::example-bucket/*"
}
]
}
โš ๏ธ This policy is for analysis only. Do not apply it to your bucket.
Let's break it down.

ย "Effect": "Allow"ย 

The policy statement grants the specified permission.

ย "Principal": "*"ย 

The statement doesn't restrict access to a particular principal.
In this example, there are no conditions limiting which principals can use the permission.

ย "Action": "s3:GetObject"ย 

The permission allows reading S3 objects.
It doesn't automatically allow listing the entire bucket, modifying objects, or deleting objects.

ย "Resource": "arn:aws:s3:::example-bucket/*"ย 

The permission applies to objects inside the specified example bucket.

Why is this risky?

If this policy were accepted and no other applicable controls prevented anonymous access, it could make the bucket's objects publicly readable.
Anyone who knew an object's location could potentially retrieve it.
That could expose sensitive information if such data were stored in the bucket.
But here's the critical distinction:
If the relevant S3 Block Public Access settings are enabled, Amazon S3 can reject this public policy or restrict the access it would otherwise grant.
A suspicious-looking policy must therefore be assessed alongside the effective security controls.

What about legitimate public buckets?

Not every public bucket represents a security incident.
Some applications intentionally distribute public files.
For example, a business might need to serve publicly available website assets.
The analyst's responsibility is to determine whether the access is:
Expected and authorized, or unintended and potentially dangerous.
For website content, Amazon CloudFront with Origin Access Control (OAC) is often a better architecture because it can serve public content while keeping direct S3 access private.

๏ปฟ

๐Ÿ•ต๏ธ 7. Investigating an S3 Exposure Like a SOC Analyst

Now let's move from configuration review to security operations.
Imagine IAM Access Analyzer identifies an existing production bucket with a policy granting external read access.
What should we do?
Immediately declare a breach?
Delete the bucket?
Disable every permission?
No. A finding indicates potential exposure, not necessarily successful exploitation.
We need to investigate.
A useful starting point is the Five Ws framework.

๐Ÿ‘ค WHO โ€” Who can access the bucket?

Identify the principal involved.
Is access granted to:
  • Everyone through a public policy?
  • A specific external AWS account?
  • A trusted third-party service?
  • An unexpected IAM role?
This helps establish the scope of authorized or potentially unauthorized access.

๐Ÿ“‚ WHAT โ€” What permissions have been granted?

Determine what the principal can do.
For example:
  • ย s3:GetObjectย  โ€” Read objects
  • ย s3:PutObjectย  โ€” Upload or overwrite objects
  • ย s3:DeleteObjectย  โ€” Delete objects
  • ย s3:ListBucketย  โ€” List objects in a bucket
The type of permission helps determine the potential impact.
Unintended public read access can create confidentiality risks.
Unintended write or delete permissions may introduce additional integrity and availability risks.

๐Ÿ•’ WHEN โ€” When did the permission change?

Find out when the potentially unsafe configuration was introduced.
AWS CloudTrail can help investigate relevant management API operations, such as ย PutBucketPolicyย  or ย PutPublicAccessBlockย .
These events may provide useful context about who made a configuration change and when it occurred.
Important distinction: S3 object-level actions, such as ย GetObjectย , are CloudTrail data events.
Data events are not logged by default in CloudTrail trails or event data stores. They must be explicitly configured, and additional charges can apply.
Therefore, CloudTrail might help identify a policy change even when historical object downloads aren't available in your logs.

๐ŸŒ WHERE โ€” Which resources are affected?

Identify:
  • AWS account
  • Bucket name and Region
  • Affected objects or prefixes
  • External principal or account
  • Relevant application or business owner
An exposure involving public application images has a different impact from one involving customer records or credentials.

โ“ WHY โ€” Is the access suspicious?

Determine the intended business purpose.
Was the bucket supposed to support public downloads?
Does an application legitimately require cross-account access?
Was the permission introduced accidentally?
Does the access violate the organization's security requirements?
This context is essential before deciding whether the finding represents a misconfiguration, an accepted exception, or a security incident.

๏ปฟ

๐Ÿ› ๏ธ 8. Remediation: What Should an Analyst Do Next?

Once we've identified unintended or unauthorized exposure, the next step is remediation.
The appropriate action depends on the impact, the affected workload, and the organization's incident response procedures.

Step 1: Contain the exposure

If public access is not required, ensure that the appropriate Block Public Access settings are enabled.
For a production bucket, review potential application dependencies before changing permissions.
If active exposure presents an urgent risk, follow the organization's incident containment and escalation procedures.

Step 2: Correct the root cause

Review the policy or permission responsible for granting access.
Remove unnecessary permissions and replace broad access with narrowly scoped permissions.
For example, instead of permitting unrestricted access, grant only the required actions to specific authorized IAM roles.
Avoid wildcard permissions unless they're genuinely necessary and appropriately constrained.

Step 3: Review evidence of possible access

Investigate available CloudTrail management events, configured S3 data events, and any other relevant access logs.
Look for evidence of unexpected configuration changes or object access.
Be careful not to overstate the evidence.
An externally accessible bucket doesn't automatically mean its contents were downloaded.
Likewise, missing logs don't prove that no unauthorized activity occurred.

Step 4: Validate the fix

After remediation:
  1. Review the bucket's effective permissions.
  1. Confirm the necessary Block Public Access settings.
  1. Recheck IAM Access Analyzer findings.
  1. Test authorized application access.
  1. Verify that unintended anonymous or external access is blocked.
Remember that Access Analyzer findings may take time to update.

Step 5: Document the investigation

A good SOC investigation should leave a clear record of what was discovered and how it was handled.
Here's an example using a hypothetical confirmed misconfiguration:
Finding: Unintended external read permission on an S3 bucket.
Affected resource: Production application storage bucket.
Security concern: A bucket policy granted object read access beyond the approved principals.
Investigation: Reviewed the resource policy, effective access controls, business requirements, and available audit records.
Action taken: Removed the unnecessary access, verified intended application functionality, and rechecked the effective permissions.
Outcome: The unintended permission was removed. Any conclusions about prior data access are limited to the available evidence.
This format helps other analysts understand the issue without needing to repeat the investigation from the beginning.

๏ปฟ

โœ… 9. S3 Security Investigation Checklist

Here's a checklist you can reuse when reviewing S3 resources.
  • Confirm the bucket belongs to the expected AWS account.
  • Review bucket-level and account-level Block Public Access.
  • Inspect bucket policies for broad or unexpected permissions.
  • Verify whether ACLs are disabled.
  • Check IAM Access Analyzer for external access findings.
  • Identify unexpected external principals or AWS accounts.
  • Review the legitimate business purpose of any shared access.
  • Investigate relevant CloudTrail records where available.
  • Remove unnecessary permissions using least privilege.
  • Validate the final access configuration.
  • Record the findings and remediation actions.
This checklist doesn't replace a complete cloud security assessment, but it provides a practical starting point for an S3 access investigation.

๏ปฟ

๐Ÿงน 10. Cleaning Up the Lab

After completing the tutorial, clean up resources that are no longer required.
  1. Open your test S3 bucket.
  1. Delete the ย security-test.txtย  object.
  1. If you no longer need the lab bucket, empty and delete it.
  1. Review the IAM Access Analyzer configuration and remove the test analyzer if it isn't needed.
Only delete resources that belong to your lab.
For real production environments, AWS recommends carefully considering whether to retain empty buckets to prevent their names from being reused by other accounts.
Also review your AWS billing dashboard to check for any unexpected usage.

๏ปฟ

๐ŸŽฏ Final Thoughts: Public Access Is a Configuration, Not a Verdict

One of the biggest lessons from this exercise is that cloud security isn't just about identifying suspicious settings.
It's about understanding what those settings actually allow.
A bucket policy containing a wildcard principal might look alarming, but the complete access decision depends on its conditions and other applicable controls.
An IAM Access Analyzer finding might indicate external access, but the analyst must determine whether that access is authorized.
And a private bucket without external access findings might still have excessive permissions granted to internal identities.
Security analysis requires both technical evidence and context.
Through this lab, we've explored how to:
  • Create and inspect a private S3 bucket.
  • Understand the security controls protecting S3 objects.
  • Test anonymous object access.
  • Use IAM Access Analyzer to review external access.
  • Recognize potentially risky bucket policies.
  • Approach misconfigurations through a SOC analyst's investigation workflow.
  • Apply least privilege and validate remediation.
If you're learning cloud security, SOC operations, or AWS security engineering, these are skills worth developing early.
Because identifying a potential misconfiguration is only the beginning.
The real skill is understanding the risk, investigating the evidence, and making the right security decision.

๏ปฟ

๐Ÿ“š Official AWS References

Here are the official AWS resources used to support this tutorial:

๏ปฟ

๐Ÿ’ฌ Let's Discuss!

If you discovered an S3 bucket with unexpected public access during a security investigation, what would you check first?
๐Ÿ” The bucket policy and effective permissions?
๐Ÿ“‹ CloudTrail activity?
๐Ÿ•ต๏ธ The affected data and whether anyone accessed it?
I'd love to hear how other AWS builders and security enthusiasts would approach this investigation.
If you found this walkthrough helpful, consider giving it a like ๐Ÿ‘ and sharing it with someone learning AWS or cloud security!
Keep building. Keep investigating. Keep securing. ๐Ÿ”โ˜๏ธ
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article