Skip to main content

More Info:

Ensure that there is a KMS Key in the Web-tier in order to protect the data that transits the web stack.

Risk Level

Medium

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)
  • 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 “KMS Key Should Have Unique Key In Web Tier” for GCP using GCP console, follow the steps below:
  1. Log in to the GCP console using your credentials.
  2. Navigate to the Cloud Key Management Service (KMS) page.
  3. Select the key that is being used in the web tier.
  4. Click on the “Edit” button.
  5. In the “Edit Key” panel, scroll down to the “Key Usage” section.
  6. Under “Key Usage”, select “Asymmetric Sign/Verify” as the key usage.
  7. Click on the “Save” button to save the changes.
This will remediate the misconfiguration by ensuring that the KMS key being used in the web tier has a unique key usage of “Asymmetric Sign/Verify”. This will help to ensure that the key is being used for its intended purpose and is not being used for other purposes that could compromise its security.

To remediate the misconfiguration “KMS Key Should Have Unique Key In Web Tier” for GCP, you can follow the below steps using GCP CLI:
  1. Open the Cloud Shell in the GCP Console.
  2. Run the following command to list all the KMS keys:
  3. Identify the KMS key that is being used in the web tier.
  4. Run the following command to generate a new unique key for the KMS key:
    Replace the following values in the above command:
    • [KEY_NAME] with the name of the KMS key that is being used in the web tier.
    • [LOCATION] with the location of the KMS key.
    • [KEYRING_NAME] with the name of the keyring that contains the KMS key.
    • [SERVICE_ACCOUNT_EMAIL] with the email address of the service account that needs access to the KMS key.
  5. Run the following command to remove the existing key from the web tier:
    Replace [INSTANCE_NAME] with the name of the instance running the web tier, and [KEY_NAME] with the name of the KMS key being used in the web tier.
  6. Run the following command to add the new key to the web tier:
    Replace [INSTANCE_NAME] with the name of the instance running the web tier, [KEY_NAME] with the name of the KMS key being used in the web tier, and [NEW_KEY_NAME] with the name of the new key generated in step 4.
  7. Verify that the new key is being used in the web tier by checking the application logs or testing the application.
By following these steps, you can remediate the misconfiguration “KMS Key Should Have Unique Key In Web Tier” for GCP using GCP CLI.
To remediate the KMS Key Should Have Unique Key misconfiguration in GCP using Python, you can follow the below steps:
  1. First, you need to install the Google Cloud KMS Python library. You can install it using the following command:
  2. Next, you need to create a new KMS key ring and a new KMS key in your GCP project. You can use the following code to create a new key ring and key:
    Note: Replace your-project-id, your-key-ring-name, and your-key-name with your own values.
  3. Once you have created the new KMS key, you need to update your web tier to use this key instead of any existing keys. You can use the following code to update your web tier:
    Note: Replace your-project-id, your-zone, your-instance-name, your-network-interface-name, location, your-key-ring-name, and your-key-name with your own values.
  4. Finally, you need to verify that the KMS key is being used correctly by your web tier. You can do this by testing your web tier with some sample data and verifying that the data is encrypted and decrypted correctly using the new KMS key.
By following these steps, you can remediate the KMS Key Should Have Unique Key misconfiguration in GCP using Python.
This creates a distinct KMS key for the web tier; it does not replace any existing keys, it only adds new resources.terraform plan should show:
  • + creation of google_kms_key_ring.web_tier (if not already managed), and
  • + creation of google_kms_crypto_key.web_tier_unique with the required tier label.