2.1.1 Ensure S3 Bucket Policy is set to deny HTTP requests

Information

At the Amazon S3 bucket level, you can configure permissions through a bucket policy, making the objects accessible only through HTTPS.

By default, Amazon S3 allows both HTTP and HTTPS requests. To ensure that access to Amazon S3 objects is only permitted through HTTPS, you must explicitly deny HTTP requests. Bucket policies that allow HTTPS requests without explicitly denying HTTP requests will not comply with this recommendation.

Solution

From Console:

- Login to the AWS Management Console and open the Amazon S3 console using

https://console.aws.amazon.com/s3/

.
- Select the check box next to the Bucket.
- Click on 'Permissions'.
- Click 'Bucket Policy'.
- Add either of the following to the existing policy, filling in the required information:

{
"Sid": <optional>,
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::<bucket_name>/*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}

or

{
"Sid": "<optional>",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::<bucket_name>",
"arn:aws:s3:::<bucket_name>/*"
],
"Condition": {
"NumericLessThan": {
"s3:TlsVersion": "1.2"
}
}
} <xhtml:ol start="6"> - Save
- Repeat for all the buckets in your AWS account that contain sensitive data.

From Console

Using AWS Policy Generator:

- Repeat steps 1-4 above.
- Click on Policy Generator at the bottom of the Bucket Policy Editor.
- Select Policy Type S3 Bucket Policy
- Add Statements:

- Effect = Deny
- Principal = *
- AWS Service = Amazon S3
- Actions = *
- Amazon Resource Name = <ARN of the S3 Bucket>

<xhtml:ol start="5"> - Generate Policy.
- Copy the text and add it to the Bucket Policy.

From Command Line:

- Export the bucket policy to a json file:

aws s3api get-bucket-policy --bucket <bucket_name> --query Policy --output text > policy.json <xhtml:ol start="2"> - Modify the policy.json file by adding either of the following:

{
"Sid": <optional>,
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": "arn:aws:s3:::<bucket_name>/*",
"Condition": {
"Bool": {
"aws:SecureTransport": "false"
}
}
}

or

{
"Sid": "<optional>",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::<bucket_name>",
"arn:aws:s3:::<bucket_name>/*"
],
"Condition": {
"NumericLessThan": {
"s3:TlsVersion": "1.2"
}
}
} <xhtml:ol start="3"> - Apply this modified policy back to the S3 bucket:

aws s3api put-bucket-policy --bucket <bucket_name> --policy file://policy.json

See Also

https://workbench.cisecurity.org/benchmarks/20495

Item Details

Category: ACCESS CONTROL, IDENTIFICATION AND AUTHENTICATION, SYSTEM AND COMMUNICATIONS PROTECTION

References: 800-53|AC-17(2), 800-53|IA-5, 800-53|IA-5(1), 800-53|SC-8, 800-53|SC-8(1), CSCv7|14.4

Plugin: amazon_aws

Control ID: 8c0c8e945fd0486748c56550108f5dc16c409bccbb78529152690d111d1567cd