id: s3-auth-fullcontrol info: name: Restrict S3 Buckets FULL_CONTROL Access for Authenticated Users author: princechaddha severity: critical description: | Checks if Amazon S3 buckets grant FULL_CONTROL access to authenticated users, preventing unauthorized operations reference: - https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html metadata: max-request: 2 tags: cloud,devops,aws,amazon,s3,aws-cloud-config flow: | code(1) for(let bucketName of iterate(template.buckets)){ set("bucket", bucketName) code(2) } self-contained: true code: - engine: - sh - bash source: | aws s3api list-buckets --query 'Buckets[*].Name' extractors: - type: json # type of the extractor internal: true name: buckets json: - '.[]' - engine: - sh - bash source: | aws s3api get-bucket-acl --bucket $bucket --query 'Grants[?(Grantee.URI==`http://acs.amazonaws.com/groups/global/AuthenticatedUsers`)]' matchers: - type: word words: - '"Permission": "FULL_CONTROL"' extractors: - type: dsl dsl: - '"FULL_CONTROL is enabled for Authenticated Users on S3 Bucket " + bucket' # digest: 4a0a00473045022030e1999b1896b95b962ca877986fb0cf30c6804d6833dd62593a6f4e679759cc022100e43b6694c7aa13dff4686ad1d99e980cef361871b9267b06da36f2878c923a60:922c64590222798bb761d5b6d8e72950