S3 Bucket Enumeration
S3 Bucket Enumeration
Cloud computing is a term used to describe the delivery of computing services over the
Internet. It offers a range of services, including storage, applications, and processing
power.
In cloud computing, a bucket refers to a logical container for storing objects. It is a term
used in Amazon Web Services (AWS) Simple Storage Service (S3) to refer to a storage
resource used to store and organize data objects.
S3 bucket is a cloud-based storage service provided by AWS, where users can store
and access any type of data. It is an object storage service that allows users to upload,
store, and retrieve any type of data, including files, images, videos, and documents. The
S3 bucket is highly scalable, secure, and durable, making it an ideal choice for
businesses of all sizes.
However, with the increasing use of cloud storage, there has been a rise in the number
of misconfigured S3 buckets that are publicly accessible.
3. Security and Access Control: S3 offers robust security features to protect your
data. You can configure access control policies using AWS Identity and Access
Management (IAM) to grant fine-grained permissions to users or applications.
Encryption options are available to secure data at rest and in transit, including
server-side encryption with AWS Key Management Service (KMS) or client-side
encryption.
4. Lifecycle Management: S3 enables you to define lifecycle policies to
automatically transition objects between storage classes based on their age or
other criteria. For example, you can automatically move infrequently accessed
data to a lower-cost storage class or archive data to Glacier for long-term
retention.
5. Versioning and Version Control: S3 allows you to enable versioning for your
buckets, which keeps multiple versions of an object over time. This helps you
track changes and recover from both unintended deletions and application
failures.
In AWS (Amazon Web Services), there are several types of policies used to manage
access and permissions for various services.
Here are the most common types of policies and their differences:
1. IAM (Identity and Access Management) Policies: IAM policies are used to
manage permissions for AWS Identity and Access Management (IAM) users,
groups, and roles. These policies define what actions are allowed or denied on
AWS resources. IAM policies can be attached to IAM entities and are written in
JSON (JavaScript Object Notation) or AWS policy language.
2. Bucket Policies: Bucket policies are used in Amazon S3 (Simple Storage Service)
to manage access to S3 buckets and objects. These policies control permissions
for resources within a bucket. Bucket policies are written in JSON and define who
can access the bucket and what actions they can perform.
3. AWS Service Policies: AWS service policies are used to manage permissions for
specific AWS services. These policies are created and managed by the AWS
service itself and allow or deny actions for resources within that service. Service
policies are typically managed through the AWS Management Console or AWS
Command Line Interface (CLI).
6. Permission Boundaries: Permission boundaries are IAM policies that define the
maximum permissions an IAM entity (user or role) can have. These policies are
used to set limits on the permissions granted to a user or role, allowing fine-
grained control over their access and preventing excessive privileges.
Each of these policy types serves a specific purpose and operates at different levels
within the AWS environment. IAM policies manage user and role permissions, bucket
policies control access to S3 buckets, service policies manage permissions for specific
AWS services, organizations policies enforce policies across multiple accounts,
resource-based policies control access to individual resources, and permission
boundaries set limits on entity permissions.
S3 bucket policies in AWS (Amazon Web Services) are used to control access to S3
buckets at a fine-grained level.
A bucket policy is a JSON-based document that specifies the permissions for the
bucket and its contents. It allows you to define who can perform certain actions on the
bucket and its objects, and from which sources these actions are allowed.
Let's say you have an S3 bucket named "example-bucket" and you want to allow public
read access to all objects within the bucket.
1. Create an S3 bucket: Firstly, you would create the S3 bucket named "example-
bucket" using the AWS Management Console, AWS CLI, or an SDK.
2. Define the bucket policy: Next, you would define the bucket policy for "example-
bucket" by creating a JSON document. In this case, the bucket policy would look
like this:
"Version": "2012-10-17",
"Statement": [
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "",
"Action": [
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::example-bucket/"
1. Version: Specifies the version of the policy language. In this case, it is set to
"2012-10-17", which is the current version.
2. Statement: Contains an array of statements that define the permissions. You can
have multiple statements within a bucket policy.
3. Sid: The statement ID is an optional identifier for the statement. It helps you identify
and manage individual statements.
4. Effect: Specifies whether the statement allows or denies access. In this example, the
effect is set to "Allow".
5. Principal: Defines the AWS identity or user to which the policy applies. In this case,
it is set to "*", which means it applies to all users.
6. Action: Specifies the action that is allowed or denied. Here, "s3:GetObject" allows
the "GetObject" action, which enables reading objects from the bucket.
7. Resource: Specifies the Amazon Resource Name (ARN) of the bucket or objects to
which the policy applies. In this example, the ARN is set to "arn:aws:s3:::example-
bucket/*", which means it applies to all objects within the bucket.
Attach the bucket policy: After creating the bucket policy, you would attach it to the
"example-bucket". You can do this through the AWS Management Console, AWS CLI, or
an SDK. Once attached, the bucket policy takes effect immediately.
Verify the access: At this point, anyone with the appropriate URL can access the objects
in the bucket. For example, if there is an object named "example-object.txt" in the bucket,
it can be accessed using the URL: https://example-
bucket.s3.amazonaws.com/example-object.txt.
This example demonstrates how an S3 bucket policy can allow public read access to
objects within a bucket. However, it's important to note that granting public access
should be carefully evaluated to ensure that sensitive or confidential data is not exposed
unintentionally.
AWS (Amazon Web Services) provides various storage options to cater to different
needs and use cases. Here are some of the main types of storage services offered by
AWS:
1. Amazon S3 (Simple Storage Service): Amazon S3 is an object storage service
that provides industry-leading scalability, durability, and security for storing and
retrieving any amount of data. It is commonly used for backup and restore, data
archiving, content distribution, and static website hosting.
2. Amazon EBS (Elastic Block Store): Amazon EBS provides block-level storage
volumes for EC2 instances. It offers persistent, high-performance storage that
can be attached to an EC2 instance and used as a primary storage device for
running applications or as a database storage solution.
3. Amazon EFS (Elastic File System): Amazon EFS is a scalable and fully managed
file storage service that provides shared file storage for EC2 instances. It allows
multiple instances to access the same file system simultaneously, making it
suitable for content management systems, web serving, and big data analytics
workloads.
4. Amazon Glacier: Amazon Glacier is a low-cost storage service designed for long-
term data archiving and backup. It offers durable and secure storage for
infrequently accessed data, with retrieval times ranging from minutes to hours.
5. Amazon FSx: Amazon FSx provides fully managed file systems that are optimized
for specific workloads. Currently, there are two types of file systems available:
Amazon FSx for Windows File Server (for Windows-based workloads) and
Amazon FSx for Lustre (for high-performance computing, machine learning, and
video processing).
6. Amazon S3 Glacier: Amazon S3 Glacier is a storage class within Amazon S3
designed for archiving and long-term backup of data. It offers a low-cost, durable,
and secure storage solution with configurable retrieval options.
9. Amazon S3 Glacier Deep Archive: Amazon S3 Glacier Deep Archive is the lowest-
cost storage class within Amazon S3. It is designed for long-term data archiving
where retrieval times of 12 hours or more are acceptable.
Method 3:
Right-click on any image of the target application and open the image in a new
tab. If the image of the URL looks like this:
http://xyz.s3.amazonaws.com/images/bI .gif,
It means that the target application is storing the data in the Amazon server and
the bucket name is “xyz”.
1. Limit Public Access: Ensure that S3 buckets are not publicly accessible by
default. Restrict access to only authenticated and authorized users or
applications.
3. Regularly Audit Bucket Permissions: Periodically review and audit the access
permissions of your S3 buckets. Identify and revoke any excessive or
unnecessary access permissions.
4. Enable Logging and Monitoring: Enable access logging for S3 buckets and
integrate them with AWS CloudTrail. This helps you monitor and detect any
unauthorized access attempts or suspicious activities.
5. Monitor Publicly Accessible Buckets: Regularly scan your AWS environment for
any publicly accessible S3 buckets using automated tools or services. Identify
and rectify any unintended public access configurations.
6. Regularly Update and Patch: Keep your AWS infrastructure, including S3, up to
date with the latest patches and security updates. This helps protect against
known vulnerabilities and exploits.
REFERENCE
https://www.geeksforgeeks.org/s3-bucket-enumeration-and-exploitation/
https://hackernoon.com/untangling-iam-policy-s3-bucket-policy-and-s3-acl
https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html
https://binaryguy.tech/aws/s3/iam-policies-vs-s3-policies-vs-s3-bucket-acls/
https://cloudian.com/blog/s3-bucket-policies-a-practical-guide/
https://www.simplilearn.com/tutorials/aws-tutorial/aws-s3