1. Resources
  2. Detection rules
  3. External or Public Principal Granted Access in Google Cloud

External or Public Principal Granted Access in Google Cloud detection rules

An attacker grants a role to an identity outside the organization, such as a personal Gmail account, or to allUsers or allAuthenticatedUsers, keeping access that no account the organization manages can revoke.

Platform
Google Cloud
Severity
High
Log source
Google Cloud Audit Logs
Last updated
Rule formats
Sigmaand queries for: SplunkMicrosoft SentinelIBM QRadar
What an attacker needs
The setIamPolicy permission on an organization, folder, project or resource where domain restricted sharing is not enforced.
Impact
Access from an identity the organization cannot disable, suspend or force to re-authenticate, and with a public principal a resource exposed to anyone.
Response
Remove the binding for the external or public principal from the allow policy, and search the organization's other allow policies for the same member.
Mitigation
Enforce domain restricted sharing at the organization node, with exceptions only for resources that are meant to be public.
API methods
*SetIamPolicy*InsertProjectOwnershipInvite

How the attack works

Google Cloud allow policies accept principals from outside the organization unless an organization policy forbids it: personal Google accounts (user:name@gmail.com), external groups and service accounts, and the special principals allUsers (anyone on the internet) and allAuthenticatedUsers (anyone signed in with a Google account).

Attackers who can change an allow policy add such a principal to keep access that does not depend on the organization's directory, or to expose a resource publicly. The change is an ordinary SetIamPolicy call, and the policy delta in the Admin Activity entry names the new member. The Owner role on a project is the exception: a user outside the organization cannot receive it through SetIamPolicy and has to be invited from the Google Cloud console and accept the invitation. The invitation is recorded under the method name InsertProjectOwnershipInvite, which a separate rule on this page reads.

What an attacker needs

  • setIamPolicy on the organization, a folder, a project or an individual resource.
  • Domain restricted sharing not enforced on that resource.

Impact

Access from an identity the organization cannot disable, suspend or force to re-authenticate. A public principal exposes the resource to anyone, depending on the role granted.

Detection rules

Role Granted to a Personal Google Account in Google Cloud

Detects SetIamPolicy calls whose policy delta adds a binding for a consumer Google account (gmail.com or googlemail.com) (Admin Activity audit log). Consumer accounts are outside the organization's control and are a common persistence choice. Covers services that record the change in serviceData.policyDelta, such as Cloud Resource Manager.

LevelMediumStatusExperimentalLog sourceGoogle Cloud Audit Logs
title: Role Granted to a Personal Google Account in Google Cloud
id: e4cf3079-21c7-47ea-abd5-afdd22a76727
status: experimental
description: >-
  Detects SetIamPolicy calls whose policy delta adds a binding for a consumer
  Google account (gmail.com or googlemail.com) (Admin Activity audit log).
  Consumer accounts are outside the organization's control and are a common
  persistence choice. Covers services that record the change in
  serviceData.policyDelta, such as Cloud Resource Manager.
references:
  - https://docs.cloud.google.com/iam/docs/review-iam-policy-history
  - https://docs.cloud.google.com/security-command-center/docs/findings/threats/iam-anomalous-grant
author: Forestall
date: 2026-11-10
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.003
logsource:
  product: gcp
  service: gcp.audit
detection:
  selection:
    protoPayload.methodName|endswith: SetIamPolicy
    protoPayload.serviceData.policyDelta.bindingDeltas|contains: '"ADD"'
  selection_member:
    protoPayload.serviceData.policyDelta.bindingDeltas|contains:
      - '@gmail.com'
      - '@googlemail.com'
  condition: selection and selection_member
falsepositives:
  - Contractors or test projects that still use personal accounts; move them to managed identities. Add other consumer or partner domains you do not own to selection_member.
level: medium

False positives

  • Contractors or test projects that still use personal accounts; move them to managed identities. Add other consumer or partner domains you do not own to selection_member.

Role Granted to allUsers or allAuthenticatedUsers in Google Cloud

Detects SetIamPolicy calls whose policy delta adds a binding for allUsers or allAuthenticatedUsers (Admin Activity audit log). The rule relies on the service recording the change in serviceData.policyDelta, as Cloud Resource Manager does for projects, folders and organizations. Cloud Storage bucket policy changes (storage.setIamPermissions) are not covered by this rule.

LevelHighStatusExperimentalLog sourceGoogle Cloud Audit Logs
title: Role Granted to allUsers or allAuthenticatedUsers in Google Cloud
id: 43c79617-a505-4d06-b04f-4112f95ce17b
status: experimental
description: >-
  Detects SetIamPolicy calls whose policy delta adds a binding for allUsers or
  allAuthenticatedUsers (Admin Activity audit log). The rule relies on the
  service recording the change in serviceData.policyDelta, as Cloud Resource
  Manager does for projects, folders and organizations. Cloud Storage bucket
  policy changes (storage.setIamPermissions) are not covered by this rule.
references:
  - https://docs.cloud.google.com/iam/docs/principal-identifiers
  - https://docs.cloud.google.com/logging/docs/audit/understanding-audit-logs
author: Forestall
date: 2026-11-10
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.003
logsource:
  product: gcp
  service: gcp.audit
detection:
  selection:
    protoPayload.methodName|endswith: SetIamPolicy
    protoPayload.serviceData.policyDelta.bindingDeltas|contains: '"ADD"'
  selection_member:
    protoPayload.serviceData.policyDelta.bindingDeltas|contains:
      - allUsers
      - allAuthenticatedUsers
  condition: selection and selection_member
falsepositives:
  - Resources that are published on purpose, such as public images or datasets; exclude them by protoPayload.resourceName in a filter_* selection.
level: high

False positives

  • Resources that are published on purpose, such as public images or datasets; exclude them by protoPayload.resourceName in a filter_* selection.

User Invited as Project Owner in Google Cloud

Detects an invitation to own a Google Cloud project (method name InsertProjectOwnershipInvite). Google documents that a user outside the organization cannot be granted the Owner role through setIamPolicy: the user has to be invited from the Google Cloud console and has to accept the invitation. Event Threat Detection reports the same method as the sub-rule external_member_invited_to_policy of its IAM Anomalous Grant finding, with high severity. The rule matches every ownership invitation and does not read the invited address, so confirm who was invited. Google's audit logging pages do not list this method under a service name, which is why the rule matches the method name alone.

LevelHighStatusExperimentalLog sourceGoogle Cloud Audit Logs
title: User Invited as Project Owner in Google Cloud
id: 3f259619-13b7-4471-8d85-9fb2d164e421
status: experimental
description: >-
  Detects an invitation to own a Google Cloud project (method name
  InsertProjectOwnershipInvite). Google documents that a user outside the
  organization cannot be granted the Owner role through setIamPolicy: the
  user has to be invited from the Google Cloud console and has to accept the
  invitation. Event Threat Detection reports the same method as the sub-rule
  external_member_invited_to_policy of its IAM Anomalous Grant finding, with
  high severity. The rule matches every ownership invitation and does not
  read the invited address, so confirm who was invited. Google's audit
  logging pages do not list this method under a service name, which is why
  the rule matches the method name alone.
references:
  - https://docs.cloud.google.com/resource-manager/reference/rest/v3/projects/setIamPolicy
  - https://docs.cloud.google.com/security-command-center/docs/concepts-event-threat-detection-overview
  - https://docs.cloud.google.com/security-command-center/docs/findings/threats/iam-anomalous-grant
  - https://docs.cloud.google.com/security-command-center/docs/findings/threats/account-has-leaked-credentials
author: Forestall
date: 2026-11-16
tags:
  - attack.persistence
  - attack.privilege-escalation
  - attack.t1098.003
logsource:
  product: gcp
  service: gcp.audit
detection:
  selection:
    protoPayload.methodName|endswith: InsertProjectOwnershipInvite
  condition: selection
falsepositives:
  - Projects that are not part of an organization, where Google requires the console for every Owner grant. Move such projects into the organization, or exclude them by protoPayload.resourceName in a filter_* selection.
  - A planned handover of a project to a partner or customer. Ownership invitations are rare, so confirm each one with the caller.
level: high

False positives

  • Projects that are not part of an organization, where Google requires the console for every Owner grant. Move such projects into the organization, or exclude them by protoPayload.resourceName in a filter_* selection.
  • A planned handover of a project to a partner or customer. Ownership invitations are rare, so confirm each one with the caller.

Triage

  • Identify the member and role in bindingDeltas and the resource in protoPayload.resourceName.
  • Check whether the external account belongs to a known partner or contractor; consumer accounts on production resources are rarely approved.
  • Remove unexplained bindings and review the external principal's activity, which appears under its principalEmail in later audit entries.

Response

Once the attack is confirmed:

  1. Remove the binding for the external or public principal from the allow policy where it was added. The allow policy is the only lever, because the organization cannot disable, suspend or force a new sign-in for an account it does not manage.
  2. Search the allow policies of the whole organization for the same member, and for other external or public principals added by the same caller. An attacker who could set one policy may have set several.
  3. Contain the identity that made the grant. Remove its setIamPolicy rights and treat its credentials as compromised until the grant is explained.
  4. For allUsers or allAuthenticatedUsers, treat the resource as exposed for the whole time the binding existed. Work out from the granted role what could be read or changed, and rotate credentials that were stored there.
  5. Look for persistence created through the granted role, such as service account keys, further bindings and impersonation rights on service accounts, and remove it. Removing the first binding does not undo any of that.

Mitigation

  • Enforce domain restricted sharing (iam.managed.allowedPolicyMembers or the legacy iam.allowedPolicyMemberDomains) at the organization node, with exceptions only for resources that are meant to be public.
  • Enforce constraints/storage.publicAccessPrevention for Cloud Storage.
  • Search existing allow policies for external and public principals (for example with Cloud Asset Inventory) and remove the ones nobody owns.

Frequently asked questions

Do these rules cover a Cloud Storage bucket that was made public?

No. The two rules for policy bindings rely on the service recording the change in `serviceData.policyDelta`, as Cloud Resource Manager does for projects, folders and organizations. Cloud Storage bucket policy changes (`storage.setIamPermissions`) are not covered. For buckets, the organization policy `constraints/storage.publicAccessPrevention` prevents public access in the first place.

What is the difference between allUsers and allAuthenticatedUsers?

`allUsers` is anyone on the internet. `allAuthenticatedUsers` is anyone who is signed in with a Google account, which includes personal accounts that have nothing to do with your organization. Neither limits access to your own users, so a binding for either one makes the resource public to the extent of the granted role.

Why does the personal account rule look only for gmail.com and googlemail.com?

Those are the consumer Google account domains, which no organization controls and which are a common choice for persistence. The rule cannot know which other domains you do not own. Add consumer or partner domains outside your organization to the member selection, otherwise a grant to such an account is not matched.

References

We respect your privacy

We use cookies to keep this site secure and working properly. With your permission, we also use optional cookies to understand usage and improve the experience. Cookie Policy

You can change your choice at any time.