This rule ensures S3 buckets restrict public read access, promoting data security.
Rule | S3 buckets should prohibit public read access |
Framework | NIST 800-53 Revision 4 |
Severity | ✔ Medium |
Rule Description:
This rule enforces the prohibition of public read access for S3 buckets in compliance with the NIST 800-53 Revision 4 security framework. Public read access to S3 buckets can expose sensitive data to unauthorized access and pose a significant security risk.
Troubleshooting Steps:
Code Example:
To enforce the prohibition of public read access for S3 buckets, use the following bucket policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "DenyPublicRead",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::EXAMPLE-BUCKET/*",
"Condition": {
"StringEquals": {
"aws:PrincipalType": "Anonymous"
}
}
}
]
}
Remediation Steps:
Alternatively, you can use the AWS Command Line Interface (CLI) to apply the bucket policy. Follow these steps:
aws s3api put-bucket-policy --bucket EXAMPLE-BUCKET --policy '{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyPublicRead", "Effect": "Deny", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::EXAMPLE-BUCKET/*", "Condition": { "StringEquals": { "aws:PrincipalType": "Anonymous" } } } ] }'
By applying this bucket policy, you ensure that the S3 bucket does not allow public read access, thus aligning with the NIST 800-53 Revision 4 security requirement.