id: cloudtrail-log-integrity info: name: CloudTrail Log Integrity Validation not Enabled author: princechaddha severity: high description: | Ensure CloudTrail log file integrity validation is enabled to detect unauthorized file modifications. impact: | Without log file integrity validation, it's harder to detect if CloudTrail logs have been tampered with, potentially hiding malicious activity. remediation: | Enable log file integrity validation on all CloudTrail trails to ensure the integrity and authenticity of your logs. reference: - https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-log-file-validation-intro.html metadata: max-request: 2 tags: cloud,devops,aws,amazon,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 describe-trails --region $region --trail-name-list $trail --query 'trailList[*].LogFileValidationEnabled' matchers: - type: word words: - "false" extractors: - type: dsl dsl: - '"The log file integrity validation is not enabled for CloudTrail trail" + trail' # digest: 4a0a00473045022100e301d2ce8df52b0170dbbbee6ca44cc69ea46fd81c0ff3dd3264dc81a8548c2402206321af47afdb4655e6ed862dbdc015d73cf98840e24c43636f0a2a28e2feb81c:922c64590222798bb761d5b6d8e72950