KMS key is openly accessible Affecting Cloud KMS service in Google


0.0
high
    Severity Framework Snyk CCSS
    Rule category IAM / Public Access

Is your enviroment affected by this misconfiguration?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
    Frameworks
    CIS-Controls CIS-Google CSA-CCM ISO-27001 PCI-DSS SOC-2
  • Snyk ID SNYK-CC-00351
  • credit Snyk Research Team

Description

IAM policy on Cloud KMS (Key Management Service) cryptokeys should restrict anonymous and/or public access. Granting permissions to allUsers or allAuthenticatedUsers allows anyone to access the dataset, which is not desirable if sensitive data is stored at the location.

How to fix?

Remove allUsers and allAuthenticatedUsers from members attribute.

Example Configuration

resource "google_kms_crypto_key" "key" {
  name            = "crypto-key-example"
  key_ring        = google_kms_key_ring.keyring.id
  rotation_period = "100000s"
  lifecycle {
    prevent_destroy = true
  }
}

resource "google_kms_crypto_key_iam_binding" "allowed" {
  crypto_key_id = google_kms_crypto_key.key.id
  role          = "roles/cloudkms.cryptoKeyEncrypter"

  members = [
    "user:jane@example.com",
  ]
}