This rule ensures that S3 buckets restrict public write access to maintain data security.
Rule | S3 buckets should prohibit public write access |
Framework | NIST 800-171 Revision 2 |
Severity | ✔ High |
Rule Description:
The rule states that S3 buckets should have a policy in place that prohibits public write access. This rule is specifically aligned with the security requirements specified in NIST 800-171 Revision 2.
Troubleshooting Steps:
If you encounter any issues or non-compliance with this rule, you can follow these troubleshooting steps:
Necessary Codes:
There are certain IAM policies and bucket policies that you can implement to enforce the prohibition of public write access. Here are the necessary codes you can use:
IAM Policy:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyPublicWriteAccess", "Effect": "Deny", "Action": [ "s3:PutObject", "s3:PutObjectAcl", "s3:PutObjectVersionAcl" ], "Resource": "arn:aws:s3:::bucket-name/*", "Condition": { "StringEquals": { "aws:PrincipalArn": "arn:aws:iam::*:root" } } } ] }
Bucket Policy:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyPublicWriteAccess", "Effect": "Deny", "Principal": "*", "Action": [ "s3:PutObject", "s3:PutObjectAcl", "s3:PutObjectVersionAcl" ], "Resource": "arn:aws:s3:::bucket-name/*" } ] }
Replace "bucket-name" with the name of your S3 bucket in the code snippets above.
Step-by-Step Guide for Remediation:
To remediate the S3 bucket and enforce the prohibition of public write access, follow these step-by-step guidelines:
Replace "bucket-name" with the name of your S3 bucket.{ "Sid": "DenyPublicWriteAccess", "Effect": "Deny", "Principal": "*", "Action": [ "s3:PutObject", "s3:PutObjectAcl", "s3:PutObjectVersionAcl" ], "Resource": "arn:aws:s3:::bucket-name/*" }
Replace "bucket-name" with the name of your S3 bucket.{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyPublicWriteAccess", "Effect": "Deny", "Principal": "*", "Action": [ "s3:PutObject", "s3:PutObjectAcl", "s3:PutObjectVersionAcl" ], "Resource": "arn:aws:s3:::bucket-name/*" } ] }
By following these steps, you will enforce the prohibition of public write access for your S3 buckets, aligning with the NIST 800-171 Revision 2 requirements.