49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
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
|
|
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: 4b0a00483046022100ae50a09843b165ba2fcd9f5fb5774c60c2ba2ca3ec8461b893c6eb47cce50cf8022100ab31d7ca772ca4fdce476fb02441aaae4130fe68605b346dd30bcaa9f2fb0c3d:922c64590222798bb761d5b6d8e72950 |