2024-04-11 14:23:07 +00:00
|
|
|
id: s3-public-write-acp
|
|
|
|
info:
|
|
|
|
name: S3 Bucket with Public WRITE_ACP Access
|
|
|
|
author: princechaddha
|
|
|
|
severity: critical
|
|
|
|
description: |
|
|
|
|
Checks if Amazon S3 buckets are secured against public WRITE_ACP access, preventing unauthorized modifications to access control permissions.
|
|
|
|
reference:
|
|
|
|
- https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-acl.html
|
2024-06-07 10:04:29 +00:00
|
|
|
metadata:
|
|
|
|
max-request: 2
|
2024-04-11 14:23:07 +00:00
|
|
|
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": "WRITE_ACP"'
|
|
|
|
|
|
|
|
extractors:
|
|
|
|
- type: dsl
|
|
|
|
dsl:
|
|
|
|
- '"The S3 bucket " + bucket +" have public WRITE_ACP access"'
|
2024-06-08 16:02:17 +00:00
|
|
|
# digest: 490a0046304402204de77d0507f74d782786aef08b62ecbcf9c82eea8522955eb98af9573cccdeb102206b485a9f8b358d4a10de5c2aa8f2c8a0592eb8a32a757b2cd49de953f7c58de5:922c64590222798bb761d5b6d8e72950
|