Amazon_S3_37

Ensure S3 buckets are not publicly accessible without a condition

Description

Misconfigured S3 buckets can leak private information to the entire internet or allow unauthorized data tampering / deletion. S3 bucket policy should ensure that principal of least privilege is being followed. A condition statement can be used to control the scope of the policy.

Remediation

From Portal:
1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.
2. In the Buckets list, choose the name of the bucket that you want to create a bucket policy for or whose bucket policy you want to edit.
3. Choose Permissions.
4. Under Bucket policy, choose Edit. This opens the Edit bucket policy page.
5. On the Edit bucket policy page, explore Policy examples in the Amazon S3 User Guide, choose Policy generator to generate a policy automatically, or edit the JSON in the Policy section.
Here add a policy statement with required principals and appropriate condition.
6. In the Policy box, edit the existing policy or paste the bucket policy from the Policy generator. Make sure to resolve security warnings, errors, general warnings, and suggestions before you save your policy.
7. Choose Save changes, which returns you to the Bucket Permissions page.

From Command Line:
To add a policy with required permissions and appropriate condition as needed, run:

aws s3api put-bucket-policy –bucket BUCKET-NAME –policy file://policy.json

References:
1. https://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-policy.html
2. https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html

Service

S3

Severity

High

Compliance

Mapping

We are now live on AWS Marketplace.
The integrated view of your cloud infrastructure is now easier than ever!