Skip to main content

More Info:

Ensure that your Amazon Secrets Manager secrets (i.e. database credentials, API keys, OAuth tokens, etc) are encrypted with Amazon KMS Customer Master Keys (CMKs) instead of default encryption keys that Secrets Manager service creates for you, in order to have a more granular control over secret data encryption and decryption process, and meet compliance requirements.

Risk Level

High

Address

Security

Compliance Standards

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

Triage and Remediation

Remediation

Using Console

Here are the step-by-step instructions to remediate the “Secret Manager Secrets Should Be Encrypted With CMKs” misconfiguration in AWS using the AWS console:
  1. Log in to the AWS Management Console and navigate to the AWS Secrets Manager service.
  2. Click on the secret that needs to be remediated.
  3. Under the “Encryption” section, click on the “Edit” button.
  4. Select the “AWS KMS customer master key (CMK)” option.
  5. Choose the appropriate CMK from the list or create a new one.
  6. Click on the “Save” button to save the changes.
  7. Ensure that the secret is now encrypted with the selected CMK by checking the “Encryption” section.
That’s it! Following these steps should remediate the “Secret Manager Secrets Should Be Encrypted With CMKs” misconfiguration in AWS.

To remediate the misconfiguration “Secret Manager Secrets Should Be Encrypted With CMKs” for AWS using AWS CLI, you can follow the below steps:
  1. Open the AWS CLI on your local machine or EC2 instance.
  2. Run the following command to list all the secrets in the Secret Manager:
  3. Note down the ARN of the secret that needs to be encrypted with a CMK.
  4. Create a new KMS customer managed key (CMK) by running the following command:
  5. Note down the ARN of the newly created CMK.
  6. Run the following command to update the secret to use the newly created CMK:
    Replace <ARN-of-secret> with the ARN of the secret that needs to be encrypted with a CMK, and <ARN-of-new-CMK> with the ARN of the newly created CMK.
  7. Verify that the secret is now encrypted with the new CMK by running the following command:
    This command should return the details of the secret, including the KMS key ID.
By following the above steps, you can remediate the misconfiguration “Secret Manager Secrets Should Be Encrypted With CMKs” for AWS using AWS CLI.
To remediate the misconfiguration “Secret Manager Secrets Should Be Encrypted With CMKs” in AWS using Python, you can follow the below steps:
  1. Create a Customer Managed Key (CMK) in AWS Key Management Service (KMS) if not already created.
  1. Enable Key Rotation for the CMK created in step 1.
  1. Update the Secrets in AWS Secret Manager to use the CMK created in step 1 for encryption.
Note: Replace CMK_ARN with the ARN of the CMK created in step 1 and SECRET_NAME with the name of the Secret in AWS Secret Manager that needs to be updated.By following these steps, you can remediate the misconfiguration “Secret Manager Secrets Should Be Encrypted With CMKs” for AWS using Python.
Substitute:
  • NEW_SECRET_NAME_FOR_ASSET_LABEL with the new secret name you want.
  • KMS_CMK_KEY_ARN with the ARN of your customer-managed KMS key.
You must separately supply the secret value (e.g., via aws_secretsmanager_secret_version, external data source, or a module variable) and update all applications to use the new secret’s ARN. The original secret must then be deleted/scheduled for deletion (you can import it as a separate aws_secretsmanager_secret resource and remove it from configuration to let Terraform call DeleteSecret with the configured recovery_window_in_days).Changing kms_key_id on an existing aws_secretsmanager_secret forces replacement, so terraform plan should show the old secret being destroyed and a new CMK-encrypted secret created (with a different ARN) or, if you model both, the old secret being scheduled for deletion and the new CMK-encrypted secret being created.

Additional Reading: