51 lines
1.4 KiB
YAML
51 lines
1.4 KiB
YAML
id: s3-public-write
|
|
info:
|
|
name: S3 Bucket with Public WRITE Access
|
|
author: princechaddha
|
|
severity: critical
|
|
description: |
|
|
Checks if Amazon S3 buckets are secured against public WRITE access, preventing unauthorized modifications to access control permissions.
|
|
reference:
|
|
- https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-acl.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/AllUsers`)]'
|
|
|
|
matchers:
|
|
- type: word
|
|
words:
|
|
- '"Permission": "WRITE"'
|
|
|
|
extractors:
|
|
- type: dsl
|
|
dsl:
|
|
- '"The S3 bucket " + bucket +" have public WRITE access"'
|
|
# digest: 4b0a00483046022100845642c440c897503168e56980b76b3c167ec82fe1804b8302f0b8de3e0b2578022100f876c6d5ef3bb7c84e665b0c31fc7614bf7c9ec46b630fa6cb90f72e7f7f2d78:922c64590222798bb761d5b6d8e72950 |