50 lines
1.4 KiB
YAML
50 lines
1.4 KiB
YAML
id: s3-public-read-acp
|
|
|
|
info:
|
|
name: S3 Bucket with Public READ_ACP Access
|
|
author: princechaddha
|
|
severity: critical
|
|
description: |
|
|
Verifies that Amazon S3 buckets do not permit public 'READ_ACP' (LIST) access to anonymous users, protecting against unauthorized data exposure
|
|
reference:
|
|
- https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-acl.html
|
|
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/AllUsers`)]'
|
|
|
|
matchers:
|
|
- type: word
|
|
words:
|
|
- '"Permission": "READ_ACP"'
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- '"The S3 bucket " + bucket +" have public READ_ACP access"'
|
|
# digest: 4b0a00483046022100ed3c7c8177b632e1968b920b9eef94ffdc0784d3b4cfef7073e31fa45879d929022100a4515cf3df6e19fdcc7f9c9460074d6310983bbdd4687e83cce86c290cb62c18:922c64590222798bb761d5b6d8e72950 |