nuclei-templates/cloud/aws/s3/s3-versioning.yaml

52 lines
1.3 KiB
YAML

id: s3-versioning
info:
name: S3 Bucket Versioning not Enabled
author: princechaddha
severity: low
description: |
Verifies that Amazon S3 buckets have object versioning enabled, providing a safeguard for recovering overwritten or deleted objects
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-versioning --bucket $bucket --query 'Status'
matchers:
- type: word
words:
- "null"
- "Suspended"
extractors:
- type: dsl
dsl:
- '"Versioning is not enabled for S3 Bucket " + bucket'
# digest: 4a0a004730450220188c6eff76e5890e9487a7990ebc939706257a8d168f4e746b7a10b168f69882022100871f34e7125204a00ffb042ccaf984570af3f3a6a2c582613b4e8333a4f3ba87:922c64590222798bb761d5b6d8e72950