25 of 50 in All Controls
aws

Enforce Customer Managed KMS Keys and Key Rotation for Audit Logs

IDAWS-LOG-003
Severity
high
Automation
Auto
Category
logging
Enforcementmandatory
Complexity / Impact
medium(none impact)
Risk Profile
medium likelihood(low residual)
Cloud Scopeaws:account
Environments
all
Target Resources
AWS::KMS::KeyAWS::CloudTrail::TrailAWS::S3::Bucket
Services
kmscloudtrails3iam
Tags
loggingencryptionkmscmkkey-rotationlanding-zonesecurity
Frameworks
CIS AWSNIST 800-53ISO 27001SOC 2PCI DSSHIPAA
Governance
Cloud Security (quarterly)
Created
2026-05-03
Last Updated
2026-08-21

Specification & Description

Enforce the use of Customer Managed Keys (CMKs) with automated key rotation enabled and strict cross-account key policies for encrypting centralized CloudTrail and audit log archives.

Technical Specifications

Default AWS-managed keys (aws/s3 or aws/cloudtrail) are insufficient for enterprise Landing Zone audit logging because their key policies cannot be modified to restrict access, cannot be shared across accounts with granular IAM conditions, and do not provide detailed KMS access logs for forensic investigation.

1. Customer Managed Key (CMK) Governance

  • All audit trails and centralized log archive buckets must use dedicated AWS KMS Customer Managed Keys.
  • CMKs provide granular control over key administration versus key usage permissions.
  • Decryption capabilities can be isolated to dedicated security and forensic roles, preventing unauthorized member account admins from decrypting sensitive organizational audit trails.

2. Automated Key Rotation

  • Regular automated key rotation must be enabled on the KMS key.
  • When rotation occurs, KMS automatically creates a new backing key while retaining previous versions to seamlessly decrypt historical logs without manual key migration.

3. Multi-Account KMS Key Policy Guardrails

  • Key policies must explicitly allow the cloudtrail.amazonaws.com service principal to generate data keys across the organization using aws:SourceOrgID conditions.
  • Key policies must prevent kms:DisableKey, kms:ScheduleKeyDeletion, or policy modifications by unauthorized principals.

Security Rationale

Using KMS Customer Managed Keys with automated rotation ensures cryptographic separation of duties and maintains log confidentiality. Even if an attacker compromises an S3 bucket policy or acquires raw S3 object permissions, they cannot decrypt the forensic logs without explicit KMS key permissions. Automated key rotation limits the cryptanalytic blast radius of any individual key version.

Business & Security Impact

Using default AWS-managed keys prevents multi-account log aggregation and leaves decryption uncontrolled. Failure to rotate keys increases cryptographic exposure risks over long retention periods.

Compliance Framework Mappings (6)

Regulatory baselines and industry standards mapped to this control specification.

Beta
Framework / StandardMapped Requirements & ControlsControls
CIS AWS Foundations Benchmark v3.0CIS AWS
3.73.8
2
NIST 800-53 Rev 5NIST 800-53
SC-28SC-12AU-9
3
ISO 27001:2022ISO 27001
A.8.24
1
SOC 2SOC 2
CC6.1
1
PCI DSS v4.0PCI DSS
10.5.13.5.1
2
HIPAA Security RuleHIPAA
164.312(a)(2)(iv)
1

* Compliance framework mappings are provided for informational architectural reference. Always verify control alignment against your organization's formal audit requirements.

Automated Detection & Rule Logic

Detection Engine: aws-api • Automated: Yes

Verifies that the KMS key configured for CloudTrail and log archive storage is a Customer Managed Key (not an AWS managed key) and that key rotation is currently enabled.

AWS CLI: Check KMS Key Rotation and CloudTrail Keybash
# 1. Check CloudTrail KMS Key ID
aws cloudtrail describe-trails \
  --query 'trailList[*].[Name, KmsKeyId]' \
  --output table

# 2. Verify Key Rotation Status
aws kms get-key-rotation-status \
  --key-id KEY_ID
Python (Boto3): Audit KMS Key Policy and Rotation Statuspython
import json
import boto3

kms = boto3.client('kms')
cloudtrail = boto3.client('cloudtrail')

def verify_log_encryption():
    trails = cloudtrail.describe_trails().get('trailList', [])
    results = []

    for trail in trails:
        kms_key_id = trail.get('KmsKeyId')
        if not kms_key_id:
            results.append({"trail": trail['Name'], "status": "NON_COMPLIANT", "reason": "No KMS key configured"})
            continue

        # Check key metadata and rotation
        key_meta = kms.describe_key(KeyId=kms_key_id).get('KeyMetadata', {})
        key_manager = key_meta.get('KeyManager')
        rotation = kms.get_key_rotation_status(KeyId=kms_key_id).get('KeyRotationEnabled', False)

        if key_manager == 'CUSTOMER' and rotation:
            results.append({"trail": trail['Name'], "status": "COMPLIANT", "key_arn": kms_key_id})
        else:
            results.append({
                "trail": trail['Name'],
                "status": "NON_COMPLIANT",
                "reason": f"CustomerKey: {key_manager == 'CUSTOMER'}, RotationEnabled: {rotation}"
            })

    return results

if __name__ == "__main__":
    result = verify_log_encryption()
    print(json.dumps(result, indent=2))

Preventative Enforcement Policies

KMS Key Policy for Multi-Account CloudTrail & S3 Log Encryptionjson
{
  "Version": "2012-10-17",
  "Id": "CloudTrailLogEncryptionKeyPolicy",
  "Statement": [
    {
      "Sid": "EnableIAMUserPermissions",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::LOG_ARCHIVE_ACCOUNT_ID:root"
      },
      "Action": "kms:*",
      "Resource": "*"
    },
    {
      "Sid": "AllowCloudTrailToEncryptLogs",
      "Effect": "Allow",
      "Principal": {
        "Service": "cloudtrail.amazonaws.com"
      },
      "Action": [
        "kms:GenerateDataKey*",
        "kms:DescribeKey"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:SourceOrgID": "o-xxxxxxxxxx"
        }
      }
    },
    {
      "Sid": "AllowSecurityTeamDecryption",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::LOG_ARCHIVE_ACCOUNT_ID:role/SecurityIncidentResponseRole"
      },
      "Action": [
        "kms:Decrypt",
        "kms:DescribeKey"
      ],
      "Resource": "*"
    }
  ]
}
Terraform: KMS Customer Managed Key with Automated Rotationhcl
resource "aws_kms_key" "log_encryption_key" {
  description             = "KMS CMK for Organization Audit Logs and CloudTrail"
  deletion_window_in_days = 30
  enable_key_rotation     = true
  policy                  = data.aws_iam_policy_document.kms_policy.json

  tags = {
    Environment = "LogArchive"
    ManagedBy   = "Terraform"
  }
}

resource "aws_kms_alias" "log_encryption_key_alias" {
  name          = "alias/central-audit-logs-key"
  target_key_id = aws_kms_key.log_encryption_key.key_id
}

Remediation Guide & Automation

Create a Customer Managed Key (CMK) in the Log Archive account with automated rotation enabled and a multi-account key policy, then update CloudTrail and S3 bucket configurations to utilize the CMK.

Step-by-Step Instructions

  1. Provision a KMS Customer Managed Key in the Log Archive account with `enable_key_rotation = true`.
  2. Configure the KMS key policy to allow `cloudtrail.amazonaws.com` service encryption constrained by `aws:SourceOrgID`.
  3. Restrict `kms:Decrypt` actions to authorized security and audit roles only.
  4. Update CloudTrail trail configuration (`--kms-key-id`) to use the new CMK ARN.
  5. Verify key rotation status using AWS CLI or Boto3.
AWS CLI: Enable Key Rotation and Update Trail KMS Keybash
# 1. Enable automated annual key rotation on the KMS CMK
aws kms enable-key-rotation \
  --key-id KEY_ID

# 2. Update CloudTrail trail to use the Customer Managed Key
aws cloudtrail update-trail \
  --name org-security-trail \
  --kms-key-id arn:aws:kms:us-east-1:LOG_ARCHIVE_ACCOUNT_ID:key/KEY_ID

We value your privacy

We use analytics cookies to understand how visitors interact with our site and to improve the user experience. You can choose to accept or decline these cookies.