Detection rules › Panther

AWS CloudTrail Log Encryption

Severity
medium
Compliance
CIS 2.7
Tags
AWS, Data Protection, Discovery:Cloud Service Discovery
Reference
https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html
Source
github.com/panther-labs/panther-analysis

This policy validates that CloudTrail Logs are encrypted at rest with customer managed KMS key.

MITRE ATT&CK coverage

TacticTechniques
DiscoveryT1526 Cloud Service Discovery

Rule body yaml

AnalysisType: policy
Filename: aws_cloudtrail_log_encryption.py
PolicyID: "AWS.CloudTrail.LogEncryption"
DisplayName: "AWS CloudTrail Log Encryption"
Enabled: true
ResourceTypes:
  - AWS.CloudTrail
Tags:
  - AWS
  - Data Protection
  - Discovery:Cloud Service Discovery
Reports:
  CIS:
    - 2.7
  MITRE ATT&CK:
    - TA0007:T1526
Severity: Medium
Description: >
  This policy validates that CloudTrail Logs are encrypted at rest with customer managed KMS key.
Runbook: >
  https://docs.runpanther.io/alert-runbooks/built-in-policies/aws-cloudtrail-logs-encrypted-using-kms-cmk
Reference: >
  https://docs.aws.amazon.com/awscloudtrail/latest/userguide/encrypting-cloudtrail-log-files-with-aws-kms.html
Tests:
  - Name: KMS CMK Does Not Exist
    ExpectedResult: false
    Resource:
      {
        "EventSelectors":
          [
            {
              "DataResources": [{ "Type": "AWS::S3::Object", "Values": null }],
              "IncludeManagementEvents": false,
              "ReadWriteType": "All",
            },
          ],
        "CloudWatchLogsLogGroupArn": null,
        "CloudWatchLogsRoleArn": null,
        "HasCustomEventSelectors": true,
        "HomeRegion": "us-west-2",
        "IncludeGlobalServiceEvents": true,
        "IsMultiRegionTrail": false,
        "IsOrganizationTrail": false,
        "KmsKeyId": null,
        "LogFileValidationEnabled": true,
        "Name": "cloudtrail-name",
        "S3BucketName": "bucket-name",
        "S3KeyPrefix": null,
        "SnsTopicARN": null,
        "SnsTopicName": null,
        "TrailARN": "arn:aws:cloudtrail:us-west-2:112233445566:trail/cloudtrail-name",
        "Status":
          {
            "IsLogging": true,
            "LatestCloudWatchLogsDeliveryError": null,
            "LatestCloudWatchLogsDeliveryTime": null,
            "LatestDeliveryAttemptSucceeded": "2019-01-01T00:00:00Z",
            "LatestDeliveryAttemptTime": "2019-01-01T00:00:00Z",
            "LatestDeliveryError": null,
            "LatestDeliveryTime": "2019-01-01T00:00:00Z",
            "LatestDigestDeliveryError": null,
            "LatestDigestDeliveryTime": "2019-01-01T00:00:00Z",
            "LatestNotificationAttemptSucceeded": null,
            "LatestNotificationAttemptTime": null,
            "LatestNotificationError": null,
            "LatestNotificationTime": null,
            "StartLoggingTime": "2019-01-01T00:00:00Z",
            "StopLoggingTime": null,
            "TimeLoggingStarted": "2019-01-01T00:00:00Z",
            "TimeLoggingStopped": null,
          },
      }
  - Name: KMS CMK Exists
    ExpectedResult: true
    Resource:
      {
        "EventSelectors":
          [
            {
              "DataResources": [{ "Type": "AWS::S3::Object", "Values": null }],
              "IncludeManagementEvents": false,
              "ReadWriteType": "All",
            },
          ],
        "CloudWatchLogsLogGroupArn": null,
        "CloudWatchLogsRoleArn": null,
        "HasCustomEventSelectors": true,
        "HomeRegion": "us-west-2",
        "IncludeGlobalServiceEvents": true,
        "IsMultiRegionTrail": false,
        "IsOrganizationTrail": false,
        "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/1111-22-33-44-5555",
        "LogFileValidationEnabled": true,
        "Name": "cloudtrail-name",
        "S3BucketName": "bucket-name",
        "S3KeyPrefix": null,
        "SnsTopicARN": null,
        "SnsTopicName": null,
        "TrailARN": "arn:aws:cloudtrail:us-west-2:112233445566:trail/cloudtrail-name",
        "Status":
          {
            "IsLogging": true,
            "LatestCloudWatchLogsDeliveryError": null,
            "LatestCloudWatchLogsDeliveryTime": null,
            "LatestDeliveryAttemptSucceeded": "2019-01-01T00:00:00Z",
            "LatestDeliveryAttemptTime": "2019-01-01T00:00:00Z",
            "LatestDeliveryError": null,
            "LatestDeliveryTime": "2019-01-01T00:00:00Z",
            "LatestDigestDeliveryError": null,
            "LatestDigestDeliveryTime": "2019-01-01T00:00:00Z",
            "LatestNotificationAttemptSucceeded": null,
            "LatestNotificationAttemptTime": null,
            "LatestNotificationError": null,
            "LatestNotificationTime": null,
            "StartLoggingTime": "2019-01-01T00:00:00Z",
            "StopLoggingTime": null,
            "TimeLoggingStarted": "2019-01-01T00:00:00Z",
            "TimeLoggingStopped": null,
          },
      }

Detection logic

Condition

KmsKeyId not is_not_null

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
KmsKeyIdis_not_null(no value, null check)