More Info:
Ensure that your Amazon Secrets Manager secrets (i.e. database credentials, API keys, OAuth tokens, etc) are encrypted at rest using AWS KMS, as AWS Secrets Manager automatically encrypts every secret value using envelope encryption with a KMS key by default, in order to guarantee that sensitive data is protected at the storage level and meets baseline compliance requirements for data-at-rest encryption.Risk Level
HighAddress
SecurityCompliance 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
Remediation
Using Console
Using Console
In AWS, Secrets Manager secrets are always encrypted; remediation usually means ensuring they use a customer-managed AWS KMS key instead of the default AWS-managed key.Below are step‑by‑step instructions using the AWS Console.
This remediation ensures all Secrets Manager secrets are encrypted with a customer-managed AWS KMS key, satisfying controls that require non-default or customer-managed encryption.
1. Create (or identify) a customer-managed KMS key
- Sign in to the AWS Management Console.
- Go to AWS Key Management Service (KMS):
- In the search bar, type KMS and select Key Management Service.
- In the left navigation pane, choose Customer managed keys.
- Click Create key.
- Key type: select Symmetric and Encrypt and decrypt.
- Click Next.
- Add an Alias (e.g.,
alias/secretsmanager-default). - Configure Key administrators and Key users:
- Ensure the IAM roles/users and the Secrets Manager service role (if you use one) that will access the secrets are added as Key users.
- Complete the wizard by clicking Finish.
2. Update existing secrets to use the KMS CMK
You must do this per secret.- Go to AWS Secrets Manager in the console.
- On the Secrets page, click the secret you want to remediate.
- On the secret’s details page, click Edit.
- In the Encryption key section:
- Change from the default (e.g.,
aws/secretsmanager) to your customer-managed KMS key (e.g.,alias/secretsmanager-default).
- Change from the default (e.g.,
- Scroll down and click Save.
3. Ensure new secrets are encrypted with the CMK by default (process-wise)
There is no global “default CMK” switch for Secrets Manager; you enforce it by process or IaC. Using the console:- When you create a new secret in Secrets Manager:
- On the Store a new secret page, in the Encryption key dropdown, select your customer-managed KMS key.
- Complete the secret creation as usual.
- Update internal runbooks so all admins select the CMK.
- If you use CloudFormation/Terraform, set
KmsKeyIdto your CMK in those templates so all programmatically created secrets use that key automatically.
This remediation ensures all Secrets Manager secrets are encrypted with a customer-managed AWS KMS key, satisfying controls that require non-default or customer-managed encryption.
Using CLI
Using CLI
In AWS Secrets Manager, all secrets are always encrypted, but by default they use the AWS managed key
Note the
This ensures the secret is encrypted by your CMK rather than
For each secret that is not using your CMK, update it:You can script it, for example (bash):(Requires
And allow your admins/automation roles to use the CMK as well.
These steps ensure Secrets Manager secrets are encrypted by a customer-managed KMS key by default and remediate the “Secret Manager should be encrypted by default (AWS KMS)” finding.
aws/secretsmanager. To meet a “Secret Manager should be encrypted by default (with KMS CMK)” requirement, you typically must:- Create or identify a customer-managed KMS key.
- Ensure all new secrets are created with that key.
- Re‑encrypt existing secrets to use that key.
1. Create a customer-managed KMS key (if you don’t already have one)
"KeyId" from the output (for example: arn:aws:kms:us-east-1:111122223333:key/abcd-...).Optionally give it an alias:2. Use the CMK when creating new secrets
When creating a secret, specify--kms-key-id (either the key ARN or alias):aws/secretsmanager.If you’re using automation (CloudFormation, Terraform, pipelines, etc.), update those definitions to always pass the CMK.3. Re-encrypt existing secrets with the CMK
List your secrets:jq.)4. Ensure IAM permissions and key policy allow usage
Make sure principals that manage/use secrets can use the CMK:Example key policy snippet (attach/update viaput-key-policy or console):These steps ensure Secrets Manager secrets are encrypted by a customer-managed KMS key by default and remediate the “Secret Manager should be encrypted by default (AWS KMS)” finding.
Using Python
Using Python
In AWS Secrets Manager, every secret is encrypted with KMS, but many checks require that you use a customer-managed KMS key (CMK) instead of the default
Remediation with Python (boto3) is:
You can then reference the key as either
This remediates existing secrets by ensuring they are encrypted with your customer-managed KMS key.
To make this “default” in your environment:
aws/secretsmanager key.Remediation with Python (boto3) is:
- Prerequisites
- Python 3.x
boto3installed:- IAM permissions:
secretsmanager:ListSecrets,secretsmanager:DescribeSecret,secretsmanager:UpdateSecretkms:DescribeKey,kms:CreateKey,kms:ListAliases
Step 1: Choose or create a KMS key
Either use an existing CMK or create one. Example to create a CMK and alias via Python:key_id or arn or the alias alias/secretsmanager-default-kms.Step 2: Find secrets not using your CMK
This script:- Lists all secrets
- Checks if their
KmsKeyIdis set and whether it matches your target CMK - Prints the ones that need remediation
Step 3: Re-encrypt each secret with the desired CMK
UseUpdateSecret with KmsKeyId. This causes Secrets Manager to re-encrypt the secret value with the new KMS key.Step 4: Create new secrets always using your CMK (default behavior in code)
When creating new secrets in Python, always specifyKmsKeyId:- Ensure all IaC/templates and application code that call Secrets Manager always pass
KmsKeyId=<your CMK>. - Optionally enforce via code review, CI checks, or policy tools (e.g., CloudFormation Guard, Terraform rules).
Using Terraform
Using Terraform
kms_key_id on an existing aws_secretsmanager_secret is an in-place update and should not force replacement of the secret or cause downtime.Verification: terraform plan should show an in-place update (~) on the existing aws_secretsmanager_secret.SECRET_RESOURCE_NAME resource, with kms_key_id changing from null or the previous key ARN to the ARN of aws_kms_key.SECRETS_KMS_KEY.
