Skip to main content

More Info:

Detect the KMS Keys that are scheduled to be destroyed. NOTE: Data encrypted using the key cannot be decrypted once the key has been destroyed.

Risk Level

High

Address

Operational Maturity, 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
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • HITRUST CSF
  • 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 detect KMS keys that are scheduled to be destroyed in GCP, follow these steps:
  1. Open the Google Cloud Console and select the project where the KMS key is located.
  2. In the left-hand menu, select “Security”.
  3. Click on “Key Management Service”.
  4. In the KMS dashboard, click on “Scheduled for destruction” in the left-hand menu.
  5. You will see a list of KMS keys that are scheduled for destruction.
To remediate this issue, you can either cancel the scheduled destruction or create a new key to replace the one that is scheduled for destruction. To cancel the scheduled destruction, follow these steps:
  1. Select the KMS key that is scheduled for destruction.
  2. Click on “Cancel destruction” in the top menu.
  3. Confirm the cancellation.
To create a new key to replace the one that is scheduled for destruction, follow these steps:
  1. Click on “Create key” in the top menu.
  2. Choose the key type and key version.
  3. Enter a name for the key.
  4. Click on “Create”.
Note: Be sure to update any applications or services that use the original KMS key with the new key.

To detect KMS keys that are scheduled to be destroyed in GCP, you can use the following steps:
  1. Open the Cloud Shell in your GCP console.
  2. Run the following command to list all the KMS keys that are scheduled for destruction:
  1. This command will return a list of all the KMS keys that are scheduled for destruction. Note down the name of the key that you want to remediate.
  2. To cancel the scheduled destruction of the key, run the following command:
Replace [KEY-NAME] with the name of the key that you want to remediate.
  1. This command will cancel the scheduled destruction of the key and the key will be available for use again.
  2. Verify that the key is no longer scheduled for destruction by running the first command again.
By following these steps, you can remediate the misconfiguration of scheduled destruction of KMS keys in GCP using GCP CLI.
To detect KMS keys that are scheduled to be destroyed in GCP using Python, you can use the Google Cloud KMS API. Here are the steps to remediate this issue:
  1. First, you need to authenticate and authorize your application to access the Google Cloud KMS API. You can use a service account key file for this purpose. You can create a service account and download the key file from the Google Cloud Console.
  2. Install the Google Cloud KMS API client library for Python using pip:
  3. Use the following Python code to detect KMS keys that are scheduled to be destroyed:
  4. Once you have identified the KMS keys that are scheduled to be destroyed, you can either cancel the destruction or rotate the keys to new ones. Here are the steps for each option:
    • To cancel the destruction, use the following Python code:
    • To rotate the keys to new ones, use the following Python code:
    Note: Rotating the keys to new ones is a best practice to ensure the security of your data.
terraform plan for this change will only show updates to the google_kms_crypto_key (e.g. destroy_scheduled_duration or rotation settings) and will not show any restoration of already scheduled-for-destruction key versions, because that action is not exposed via Terraform.