> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/gcp-kms-crypto-key-is-anonymously-accessible.md). Agents can also search and read this documentation through its [MCP server](https://cortex-docs.paloaltonetworks.com/~gitbook/mcp).

# GCP KMS crypto key is anonymously accessible

### Synopsis

| Field               | Value                                        |
| ------------------- | -------------------------------------------- |
| Rule Type           | Detection                                    |
| Finding Type        | GCP KMS crypto key is anonymously accessible |
| Finding ID          | 60000629                                     |
| Generates a Finding | This detection rule also generates a finding |
| Severity            | High                                         |
| Category            | CONFIGURATION                                |
| Cloud Providers     | GCP                                          |
| Platform Module     | CSPM                                         |
| Asset Types         | GOOGLE\_CLOUD\_KMS\_CRYPTO\_KEYS             |
| ATT\&CK Tactic      | TA0001 (TA0001)                              |
| ATT\&CK Technique   | T1078 (T1078)                                |

### Description

Publicly or anonymously accessible KMS crypto keys present a significant security risk. This misconfiguration allows unauthorized access to sensitive encryption keys, potentially leading to data breaches and unauthorized decryption.

The KMS service allows granular control over access to encryption keys through IAM roles and bindings. However, granting permissions such as 'allUsers' or 'allAuthenticatedUsers' to a KMS key effectively makes it publicly accessible. An attacker could exploit this misconfiguration to access and decrypt sensitive data without requiring any authentication.

The impact of this misconfiguration is significant, enabling attackers to steal, modify, or delete encrypted data. This could result in data loss, regulatory fines, and reputational damage. Restricting access to only authorized users and services ensures confidentiality and integrity of encrypted data.

To mitigate this, explicitly define IAM roles and members with least privilege access for each KMS key. Regularly review and audit IAM policies, revoking unnecessary permissions. Never grant 'allUsers' or 'allAuthenticatedUsers' access to any KMS key. Utilize strong access controls and implement a robust monitoring system to detect unauthorized access attempts.

### Remediation

**Manual steps:**

Google Cloud KMS Crypto Keys - Manual remediation steps:

Granting/revoking access for the KMS key is only supported by CLI. To remediate run the below CLI command.

1. List all the cryptokeys which has overly permissive IAM bindings,

   ```
   gcloud asset search-all-iam-policies --asset-types=cloudkms.googleapis.com/CryptoKey --query="policy:(allUsers OR allAuthenticatedUsers)"
   ```
2. Revoke access for allUsers and allAuthenticatedUsers by deleting the KMS key IAM policy binding with the command below.

   ```
   gcloud kms keys remove-iam-policy-binding [key_name] --keyring='[key_ring_name]' --location='[location]' --member='[allUsers/allAuthenticatedUsers]' --role='[role]'
   ```

Refer to the following URL for more information on "remove-iam-policy-binding" command.

<https://cloud.google.com/sdk/gcloud/reference/projects/remove-iam-policy-binding>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/posture-rules/cloud-saas-active-directory-posture-rules/cortex-posture-query-based-rules/detection-rules-by-name/gcp-kms-crypto-key-is-anonymously-accessible.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
