id: cloudtrail-public-buckets info: name: Public CloudTrail Buckets author: princechaddha severity: critical description: | Identifies AWS CloudTrail S3 buckets that are publicly accessible, risking exposure of sensitive log data. impact: | Unauthorized access to CloudTrail logs can lead to data leakage, compromising the integrity and confidentiality of cloud operations. remediation: | Restrict S3 bucket access using bucket policies or IAM policies to ensure that CloudTrail logs are not publicly accessible. reference: - https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-find-log-files.html metadata: max-request: 2 tags: cloud,devops,aws,amazon,s3,aws-cloud-config variables: region: "ap-south-1" flow: | code(1) for(let CloudTrail of iterate(template.cloudtrailname)){ set("trail", CloudTrail) code(2) } self-contained: true code: - engine: - sh - bash source: | aws cloudtrail list-trails --region $region --query 'Trails[*].Name' --output json extractors: - type: json name: cloudtrailname internal: true json: - '.[]' - engine: - sh - bash source: | aws cloudtrail describe-trails --region $region --trail-name-list $trail --query 'trailList[*].IncludeGlobalServiceEvents' matchers: - type: word words: - "false" extractors: - type: dsl dsl: - '"CloudTrail trail" + trail + " is not configured to record API calls for AWS global services"' # digest: 4a0a004730450220153c8058c6e3274fd6caf2b309baa876492c64fa5978590b21938000e9416aa6022100faaf8886e0deb971d17b2f325fc402814e59ce66ff16ea343543e3b6b3f13773:922c64590222798bb761d5b6d8e72950