KMS key is openly accessible Affecting Cloud KMS service in Google


Severity

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

Is your environment 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-ControlsCIS-GoogleCSA-CCMISO-27001PCI-DSSSOC-2
  • Snyk IDSNYK-CC-00351
  • creditSnyk 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",
  ]
}