AWS Security Hub · KMS
KMS.2: Decrypt is granted on all KMS keys
Written and reviewed by Emnode · Last reviewed
What does AWS Security Hub KMS.2 check?
KMS.2 fails when an IAM principal has an inline policy allowing kms:Decrypt or kms:ReEncryptFrom on all keys (Resource: "*") rather than on specific key ARNs. The control inspects inline policies attached to users, groups, and roles.
Why does KMS.2 matter?
Decrypt on "*" means a single compromised principal can decrypt anything in the account that any key protects. In the 2019 Capital One breach the second act was exactly this — the compromised role's broad kms:Decrypt let the attacker get AWS to decrypt 100M+ records for them. Scoping the action to the handful of keys a workload actually uses stops a stolen credential from unlocking the whole estate.
How do I fix KMS.2?
- Inventory inline policies and flag kms:Decrypt or kms:ReEncryptFrom paired with Resource: "*".
- Determine which keys each principal genuinely uses from CloudTrail.
- Rewrite the Resource element to list those specific key ARNs.
- Where an exact ARN list is impractical, narrow with condition keys such as kms:ViaService or encryption-context constraints.
Remediation script · bash
# Stop the irreversible clock first: cancel any scheduled deletion, then re-enable.
for k in $(aws kms list-keys --query 'Keys[].KeyId' --output text); do
state=$(aws kms describe-key --key-id "$k" \
--query 'KeyMetadata.KeyState' --output text)
if [ "$state" = "PendingDeletion" ]; then
aws kms cancel-key-deletion --key-id "$k"
aws kms enable-key --key-id "$k" # cancel leaves it Disabled
echo "$k: deletion cancelled and re-enabled"
fi
done
# Turn rotation on for eligible customer-managed symmetric keys.
for k in $(aws kms list-keys --query 'Keys[].KeyId' --output text); do
read -r mgr spec <<<"$(aws kms describe-key --key-id "$k" \
--query 'KeyMetadata.[KeyManager,KeySpec]' --output text)"
if [ "$mgr" = "CUSTOMER" ] && [ "$spec" = "SYMMETRIC_DEFAULT" ]; then
aws kms enable-key-rotation --key-id "$k"
fi
done Full walkthrough (console steps, edge cases and verification) in the lesson Manage KMS encryption keys.