Skip to main content

More Info:

KMS key policies should be designed to limit the number of users who can perform encrypt and decrypt operations. Each application should use its own key to avoid over exposure.

Risk Level

Low

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of KMS Key Policies should be designed to limit the number of KMS Admins in AWS, follow the below steps using AWS Console:
  1. Open the AWS KMS Console.
  2. From the left navigation pane, choose “Customer managed keys”.
  3. Select the KMS key for which you want to remediate the misconfiguration.
  4. In the Key policy section, choose “Edit”.
  5. Update the key policy to include only the required number of IAM users or roles who need administrative access to the KMS key.
  6. Remove any unnecessary IAM users or roles from the key policy.
  7. Choose “Review policy”.
  8. Review the policy changes and ensure that the policy is designed to limit the number of KMS admins.
  9. Choose “Save changes” to save the updated key policy.
  10. Verify that only the required IAM users or roles have administrative access to the KMS key.
By following these steps, you can remediate the misconfiguration of KMS Key Policies should be designed to limit the number of KMS Admins in AWS.

To remediate this issue for AWS, you can follow these steps using AWS CLI:
  1. Identify the KMS key ID that needs to be remediated.
  2. Create a new IAM policy that grants the required permissions for KMS key management.
  3. Attach the new IAM policy to an IAM user or role that needs to manage the KMS key.
  4. Remove the KMS key administrator permissions from the existing IAM users or roles.
Here are the detailed steps:Step 1: Identify the KMS key ID that needs to be remediatedUse the following command to list all the KMS keys in your AWS account:
Identify the KMS key ID that needs to be remediated.Step 2: Create a new IAM policy that grants the required permissions for KMS key managementCreate a new IAM policy that grants the required permissions for KMS key management. Here’s an example of a policy that allows a user to manage a specific KMS key:
Replace the KMS key ARN with the ARN of the KMS key that needs to be managed.Step 3: Attach the new IAM policy to an IAM user or role that needs to manage the KMS keyUse the following command to attach the new IAM policy to an IAM user or role:
Replace <user-name> with the name of the IAM user or role that needs to manage the KMS key, and <policy-arn> with the ARN of the new IAM policy.Step 4: Remove the KMS key administrator permissions from the existing IAM users or rolesUse the following command to remove the KMS key administrator permissions from the existing IAM users or roles:
Replace <key-id> with the ID of the KMS key, and <grant-id> with the ID of the grant that needs to be revoked.Repeat this command for each grant that needs to be revoked.By following these steps, you can remediate the misconfiguration of KMS key policies that should be designed to limit the number of KMS admins for AWS.
To remediate this misconfiguration in AWS using Python, you can follow these steps:
  1. First, you need to identify the KMS keys that have overly permissive key policies. You can use the boto3 library in Python to list all the KMS keys and their key policies.
  1. Once you have identified the KMS keys with overly permissive key policies, you need to update their policies to limit the number of KMS admins. You can use the put_key_policy method to update the key policy.
In the above code, you need to replace the KeyId with the ID of the KMS key that you want to update, and replace the AWS ARNs with the ARNs of the IAM users who should have KMS admin permissions.
  1. Repeat step 2 for all the KMS keys with overly permissive key policies.
By following these steps, you can remediate the misconfiguration of KMS key policies being designed to limit the number of KMS admins in AWS using Python.
This policy removes wildcard principals and explicitly lists only the root account (for administration) and specific application principals for encrypt/decrypt and related usage actions; updating this argument replaces the entire key policy but does not force key replacement.Verification with terraform plan should show an in-place update on aws_kms_key.APP_KEY with a change to the policy argument only.

Additional Reading: