π‘οΈ AWS S3 Bucket Policy allows public read or write accessπ’
- Contextual name: π‘οΈ Bucket Policy allows public read or write accessπ’
- ID:
/ce/ca/aws/s3/bucket-public-policy - Tags:
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicβ
- π§ prod.logic.yamlπ’
- π AWS S3 Bucket
- π AWS S3 Bucket - object.extracts.yaml
- π§ͺ test-data.json
Similar Policiesβ
- AWS Security Hub: [S3.2] S3 general purpose buckets should block public read access
- AWS Security Hub: [S3.3] S3 general purpose buckets should block public write access
Descriptionβ
Descriptionβ
This policy identifies AWS S3 Buckets whose bucket policies grant public read or write access.
A bucket policy is considered public if it contains a statement with
"Effect": "Allow"and a"Principal"set to"*"or{"AWS": "*"}. The evaluation focuses on permissions that allow reading (s3:GetObject,s3:GetObjectVersion,s3:ListBucket), writing (s3:PutObject,s3:DeleteObject,s3:DeleteObjectVersion,s3:PutObjectAcl,s3:PutBucketAcl,s3:PutBucketPolicy), or any broader permissions that implicitly include these actions (e.g.,"*",s3:*, ors3:Delete*).Rationaleβ
Publicly accessible bucket policies pose significant security risks. Granting
s3:GetObjectto a public principal allows anyone on the internet to read objects stored in the bucket, potentially resulting in data exposure. Similarly, granting write-related permissions, such ass3:PutObjectors3:DeleteObject, allows unauthorized users to upload, modify, or delete objects, jeopardizing data integrity and availability.... see more
Remediationβ
Remediationβ
Disable Public Access for S3 Bucket Policiesβ
Enable S3 Block Public Accessβ
Enabling Block Public Access provides a centralized and comprehensive safeguard against unintended public exposure of S3 bucket data. These settings take precedence over any existing ACLs or bucket policies that may otherwise permit public access.
From Command Lineβ
Use the following command to enable Block Public Access on the bucket:
aws s3api put-public-access-block \
--bucket {{bucket-name}} \
--public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"Update the Bucket Policyβ
To further restrict public access, review and update the bucket policy to replace broad public access (
"Principal": "*") with specific principals as needed.
Retrieve the current bucket policy and save it locally:
aws s3api get-bucket-policy \
--bucket {{bucket-name}} \
--query Policy \
--output text > policy.json... see more