id: cloudtrail-data-events info: name: CloudTrail S3 Data Events Logging author: princechaddha severity: low description: | Ensure Amazon CloudTrail trails log S3 data events to monitor object-level operations like GetObject, DeleteObject, and PutObject. impact: | Without logging S3 data events, you lose visibility into object-level operations which could help detect unauthorized access or modifications. remediation: | Enable data event logging in CloudTrail for S3 buckets to ensure detailed activity monitoring and logging for better security and compliance. reference: - https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html tags: cloud,devops,aws,amazon,s3,cloudtrail,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 get-event-selectors --region $region --trail-name $trail --query 'EventSelectors[*].DataResources[]' matchers: - type: word words: - "[]" extractors: - type: dsl dsl: - '"CloudTrail trail" + trail + " is not configured to capture resource operations performed on or within an AWS cloud resource"' # digest: 490a0046304402201faa9752ffea7342ad3012c17528ce7ac93a419f258bc0022f82daca0c116b060220047829932aa4d96d6a578faf2884e39bb46badf9ec8f4f4704a2cabdc2cc93a5:922c64590222798bb761d5b6d8e72950