How the attack works
Access in Google Cloud is granted through allow policies attached to the organization, folders and projects. Each binding pairs a role with one or more principals, and bindings are inherited by everything below the resource. A principal with setIamPolicy on a resource (Owner, Project IAM Admin, Folder Admin, Organization Administrator, Security Admin) can add bindings to it.
Attackers who reach such a principal grant a privileged role to an identity they control: their own user, a compromised or new service account, or a group. The basic roles (the legacy Owner and Editor and the newer Admin and Writer), and roles that change IAM policies, impersonate service accounts or manage their keys, turn one foothold into lasting control. Cloud Resource Manager records each change as a SetIamPolicy Admin Activity entry whose serviceData.policyDelta.bindingDeltas lists every binding that was added or removed. The entry also names the caller in authenticationInfo.principalEmail, and its logName starts with the project, folder or organization whose policy changed. Two rules on this page use that to single out grants made by a service account and service account roles granted above project level. A further rule matches an allow policy change on any service whose caller is the Compute Engine or App Engine default service account, because a workload that runs as a default account rarely has a reason to change who can access a resource.
What an attacker needs
resourcemanager.projects.setIamPolicy,resourcemanager.folders.setIamPolicyorresourcemanager.organizations.setIamPolicyon the target resource or an ancestor, held directly, through a group or custom role, or through an impersonated service account.
Impact
Privileged access to every resource below the binding. Owner at organization or folder level controls all projects beneath it; IAM administration and service account roles let the attacker keep granting themselves access or mint credentials for other identities.
Detection rules
Allow Policy Changed by a Default Service Account in Google Cloud
Detects a SetIamPolicy call on any service whose caller is the Compute Engine default service account or the App Engine default service account. SetIamPolicy is an Admin Activity method on the services checked for this rule, which are Cloud Run, IAM and Resource Manager, and those entries are always written. Workloads run as these accounts, and a workload has little reason to change who can access a resource. Google's Event Threat Detection has a finding for the narrow case of the Compute Engine default service account setting the allow policy of a Cloud Run service, and describes it as a potential post-exploit action when a token is compromised from a serverless service. This rule applies the same idea to every resource. The caller is read from authenticationInfo.principalEmail. Google documents the address formats project-number-compute@developer.gserviceaccount.com and project-id@appspot.gserviceaccount.com and notes that the format is subject to change. The rule does not read which role was granted or to whom. Read the policy delta or the request of the entry, and the resource in protoPayload.resourceName.
title: Allow Policy Changed by a Default Service Account in Google Cloud
id: b54887f2-b274-4001-8cbc-1b78ea88a9dc
status: experimental
description: >-
Detects a SetIamPolicy call on any service whose caller is the Compute
Engine default service account or the App Engine default service account.
SetIamPolicy is an Admin Activity method on the services checked for this
rule, which are Cloud Run, IAM and Resource Manager, and those entries are
always written. Workloads run as these accounts, and a workload has little
reason to change who can access a resource. Google's Event Threat
Detection has a finding for the narrow case of the Compute Engine default
service account setting the allow policy of a Cloud Run service, and
describes it as a potential post-exploit action when a token is
compromised from a serverless service. This rule applies the same idea to
every resource. The caller is read from authenticationInfo.principalEmail.
Google documents the address formats project-number-compute@developer.gserviceaccount.com
and project-id@appspot.gserviceaccount.com and notes that the format is
subject to change. The rule does not read which role was granted or to
whom. Read the policy delta or the request of the entry, and the resource
in protoPayload.resourceName.
references:
- https://docs.cloud.google.com/security-command-center/docs/findings/threats/cloud-run-services-set-iam-policy
- https://docs.cloud.google.com/iam/docs/service-account-types
- https://docs.cloud.google.com/run/docs/audit-logging
- https://docs.cloud.google.com/iam/docs/audit-logging/examples-service-accounts
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.methodName|endswith: SetIamPolicy
protoPayload.authenticationInfo.principalEmail|endswith:
- '-compute@developer.gserviceaccount.com'
- '@appspot.gserviceaccount.com'
condition: selection
falsepositives:
- Deployment tools that run on a VM or in a build with a default service account and manage allow policies from there. Move such tools to a dedicated service account, and until then exclude the project by protoPayload.resourceName in a filter_* selection.
- Calls that only remove bindings also match.
level: medium
False positives
- Deployment tools that run on a VM or in a build with a default service account and manage allow policies from there. Move such tools to a dedicated service account, and until then exclude the project by protoPayload.resourceName in a filter_* selection.
- Calls that only remove bindings also match.
Basic Role (Owner, Editor, Admin or Writer) Granted on a Google Cloud Project, Folder or Organization
Detects SetIamPolicy calls to Cloud Resource Manager whose policy delta adds a binding and names a privileged basic role, either the legacy Owner and Editor roles or the newer Admin (roles/admin) and Writer (roles/writer) roles (Admin Activity audit log). The action and the role are matched in the serialized bindingDeltas list, so a call that removes one of these roles while adding an unrelated binding also matches; check the delta before acting.
title: Basic Role (Owner, Editor, Admin or Writer) Granted on a Google Cloud Project, Folder or Organization
id: fba39040-6c6d-4bde-8323-37d428d03618
status: experimental
description: >-
Detects SetIamPolicy calls to Cloud Resource Manager whose policy delta adds a
binding and names a privileged basic role, either the legacy Owner and Editor
roles or the newer Admin (roles/admin) and Writer (roles/writer) roles (Admin
Activity audit log). The action and the role are matched in the serialized
bindingDeltas list, so a call that removes one of these roles while adding an
unrelated binding also matches; check the delta before acting.
references:
- https://docs.cloud.google.com/iam/docs/review-iam-policy-history
- https://docs.cloud.google.com/iam/docs/roles-overview
- https://docs.cloud.google.com/security-command-center/docs/how-to-remediate-security-health-analytics-findings
author: Forestall
date: 2026-11-10
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: cloudresourcemanager.googleapis.com
protoPayload.methodName|endswith: SetIamPolicy
protoPayload.serviceData.policyDelta.bindingDeltas|contains: '"ADD"'
selection_role:
protoPayload.serviceData.policyDelta.bindingDeltas|contains:
- roles/owner
- roles/editor
- 'roles/admin"'
- 'roles/writer"'
condition: selection and selection_role
falsepositives:
- Project creation, break-glass procedures and infrastructure-as-code pipelines that assign owners; exclude the automation identities by principalEmail in a filter_* selection.
level: high
False positives
- Project creation, break-glass procedures and infrastructure-as-code pipelines that assign owners; exclude the automation identities by principalEmail in a filter_* selection.
IAM Administration or Service Account Role Granted in Google Cloud
Detects SetIamPolicy calls to Cloud Resource Manager whose policy delta adds a binding for a role that can change IAM policies, define roles, manage organization policies, or use, impersonate or create keys for service accounts, at project, folder or organization level (Admin Activity audit log). Each of these roles is a step to further privilege.
title: IAM Administration or Service Account Role Granted in Google Cloud
id: 6f020839-bc69-4bc6-8f6a-f28b1cda9906
status: experimental
description: >-
Detects SetIamPolicy calls to Cloud Resource Manager whose policy delta adds a
binding for a role that can change IAM policies, define roles, manage
organization policies, or use, impersonate or create keys for service accounts,
at project, folder or organization level (Admin Activity audit log). Each of
these roles is a step to further privilege.
references:
- https://docs.cloud.google.com/iam/docs/review-iam-policy-history
- https://docs.cloud.google.com/iam/docs/roles-permissions/iam
- https://docs.cloud.google.com/iam/docs/roles-permissions/resourcemanager
author: Forestall
date: 2026-11-10
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: cloudresourcemanager.googleapis.com
protoPayload.methodName|endswith: SetIamPolicy
protoPayload.serviceData.policyDelta.bindingDeltas|contains: '"ADD"'
selection_role:
protoPayload.serviceData.policyDelta.bindingDeltas|contains:
- roles/resourcemanager.organizationAdmin
- roles/resourcemanager.folderAdmin
- roles/resourcemanager.folderIamAdmin
- roles/resourcemanager.projectIamAdmin
- roles/iam.securityAdmin
- roles/iam.admin
- roles/iam.roleAdmin
- roles/iam.organizationRoleAdmin
- roles/iam.serviceAccountAdmin
- roles/iam.serviceAccountKeyAdmin
- roles/iam.serviceAccountTokenCreator
- roles/iam.serviceAccountUser
- roles/iam.workloadIdentityPoolAdmin
- roles/orgpolicy.policyAdmin
condition: selection and selection_role
falsepositives:
- Delegated administration and deployment pipelines that need Service Account User or IAM admin roles; exclude known automation callers by principalEmail and review grants to humans.
level: medium
False positives
- Delegated administration and deployment pipelines that need Service Account User or IAM admin roles; exclude known automation callers by principalEmail and review grants to humans.
Privileged Role Granted by a Service Account in Google Cloud
Detects SetIamPolicy calls to Cloud Resource Manager whose caller is a service account and whose policy delta adds a binding for a basic role or an IAM administration role, at project, folder or organization level (Admin Activity audit log, always written). A workload or a stolen service account credential that grants privileged roles is how one compromised service account becomes lasting access for another identity. Google's Event Threat Detection has a sub-rule for the same pattern (service_account_granted_sensitive_role_to_member). The caller is read from authenticationInfo.principalEmail, where every service account address ends with gserviceaccount.com. The action and the role are matched in the serialized bindingDeltas list, so a call that removes one of these roles while adding an unrelated binding also matches. Read the delta before acting. Google's own service-agent-manager@system.gserviceaccount.com, which grants roles to service agents as normal behavior, is excluded.
title: Privileged Role Granted by a Service Account in Google Cloud
id: af051e6c-9795-4533-8f9e-fd4b63b284d7
status: experimental
description: >-
Detects SetIamPolicy calls to Cloud Resource Manager whose caller is a
service account and whose policy delta adds a binding for a basic role or an
IAM administration role, at project, folder or organization level (Admin
Activity audit log, always written). A workload or a stolen service account
credential that grants privileged roles is how one compromised service
account becomes lasting access for another identity. Google's Event Threat
Detection has a sub-rule for the same pattern
(service_account_granted_sensitive_role_to_member). The caller is read from
authenticationInfo.principalEmail, where every service account address ends
with gserviceaccount.com. The action and the role are matched in the
serialized bindingDeltas list, so a call that removes one of these roles
while adding an unrelated binding also matches. Read the delta before acting.
Google's own service-agent-manager@system.gserviceaccount.com, which grants
roles to service agents as normal behavior, is excluded.
references:
- https://docs.cloud.google.com/iam/docs/review-iam-policy-history
- https://docs.cloud.google.com/security-command-center/docs/concepts-event-threat-detection-overview
- https://docs.cloud.google.com/logging/docs/reference/audit/auditlog/rest/Shared.Types/AuditLog
- https://docs.cloud.google.com/iam/docs/roles-overview
- https://docs.cloud.google.com/iam/docs/audit-logging/examples-service-accounts
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: cloudresourcemanager.googleapis.com
protoPayload.methodName|endswith: SetIamPolicy
protoPayload.serviceData.policyDelta.bindingDeltas|contains: '"ADD"'
protoPayload.authenticationInfo.principalEmail|endswith: .gserviceaccount.com
selection_role:
protoPayload.serviceData.policyDelta.bindingDeltas|contains:
- roles/owner
- roles/editor
- 'roles/admin"'
- 'roles/writer"'
- roles/resourcemanager.organizationAdmin
- roles/resourcemanager.folderAdmin
- roles/resourcemanager.folderIamAdmin
- roles/resourcemanager.projectIamAdmin
- roles/iam.securityAdmin
- roles/iam.roleAdmin
- roles/iam.organizationRoleAdmin
- roles/iam.serviceAccountAdmin
- roles/iam.serviceAccountKeyAdmin
- roles/iam.serviceAccountTokenCreator
- roles/iam.serviceAccountUser
- roles/iam.workloadIdentityPoolAdmin
- roles/orgpolicy.policyAdmin
filter_service_agent_manager:
protoPayload.authenticationInfo.principalEmail: service-agent-manager@system.gserviceaccount.com
condition: selection and selection_role and not 1 of filter_*
falsepositives:
- Infrastructure-as-code and project-provisioning pipelines run as service accounts and grant roles as part of their work. Exclude each approved pipeline account by principalEmail in a filter_* selection, and review every other service account that changes an allow policy.
- Google-managed service agents that set up a product in a project. Their addresses also end with gserviceaccount.com, so check the caller's domain before treating a match as a compromised workload. Google documents grants by service-agent-manager@system.gserviceaccount.com to service agents as normal, and the rule excludes that caller.
level: medium
False positives
- Infrastructure-as-code and project-provisioning pipelines run as service accounts and grant roles as part of their work. Exclude each approved pipeline account by principalEmail in a filter_* selection, and review every other service account that changes an allow policy.
- Google-managed service agents that set up a product in a project. Their addresses also end with gserviceaccount.com, so check the caller's domain before treating a match as a compromised workload. Google documents grants by service-agent-manager@system.gserviceaccount.com to service agents as normal, and the rule excludes that caller.
Service Account Token Creator or Service Account User Granted at Folder or Organization Level
Detects SetIamPolicy calls whose policy delta adds a binding for Service Account Token Creator or Service Account User on a folder or on the organization (Admin Activity audit log, always written). Granted on one service account, these roles let a principal create tokens for it or attach it to resources. Granted on a folder or the organization they apply to every service account in every project below. Google's guidance is to manage this access on each service account and not at project or folder level. Google's Event Threat Detection has separate rules for Token Creator at organization and at folder level. The level is read from logName, which starts with the resource type and ID of the node whose allow policy changed. The broader rule on this page for IAM administration roles also matches these events, at any level. The action and the role are matched in the serialized bindingDeltas list, so check the delta before acting.
title: Service Account Token Creator or Service Account User Granted at Folder or Organization Level
id: 07f51f11-1ba4-42c0-b54d-49b834d0b84c
status: experimental
description: >-
Detects SetIamPolicy calls whose policy delta adds a binding for Service
Account Token Creator or Service Account User on a folder or on the
organization (Admin Activity audit log, always written). Granted on one
service account, these roles let a principal create tokens for it or attach
it to resources. Granted on a folder or the organization they apply to
every service account in every project below. Google's guidance is to
manage this access on each service account and not at project or folder
level. Google's Event Threat Detection has
separate rules for Token Creator at organization and at folder level. The
level is read from logName, which starts with the resource type and ID of
the node whose allow policy changed. The broader rule on this page for IAM
administration roles also matches these events, at any level. The action
and the role are matched in the serialized bindingDeltas list, so check the
delta before acting.
references:
- https://docs.cloud.google.com/iam/docs/review-iam-policy-history
- https://docs.cloud.google.com/iam/docs/best-practices-service-accounts
- https://docs.cloud.google.com/security-command-center/docs/concepts-event-threat-detection-overview
- https://docs.cloud.google.com/resource-manager/docs/audit-logging
author: Forestall
date: 2026-11-18
tags:
- attack.persistence
- attack.privilege-escalation
- attack.t1098.003
logsource:
product: gcp
service: gcp.audit
detection:
selection:
protoPayload.serviceName: cloudresourcemanager.googleapis.com
protoPayload.methodName|endswith: SetIamPolicy
protoPayload.serviceData.policyDelta.bindingDeltas|contains: '"ADD"'
logName|startswith:
- organizations/
- folders/
selection_role:
protoPayload.serviceData.policyDelta.bindingDeltas|contains:
- roles/iam.serviceAccountTokenCreator
- roles/iam.serviceAccountUser
condition: selection and selection_role
falsepositives:
- Organization-wide deployment or break-glass identities that are meant to act as any service account. These grants are rare and should be known by name. Exclude the approved members only after confirming the grant is still needed at that level.
level: high
False positives
- Organization-wide deployment or break-glass identities that are meant to act as any service account. These grants are rare and should be known by name. Exclude the approved members only after confirming the grant is still needed at that level.
Detection logic
Patterns that need more than one event, a baseline or knowledge of your own environment. Each is a hypothesis to build and tune in your SIEM, not a ready rule.
Member added to a group that holds a privileged role
An allow policy that grants a privileged role to a group names only the group. Whoever can change the group's membership hands out the role without any SetIamPolicy event, so the rules on this page stay silent. Watching the membership of exactly those groups closes the gap.
- Keep a list of the groups that hold a privileged role. Seed it from the current allow policies and update it from
SetIamPolicyentries ofcloudresourcemanager.googleapis.comwhoseserviceData.policyDelta.bindingDeltasadd or remove such a role for a member that starts withgroup:. - With Workspace data sharing on, read members added in the Admin console:
google.admin.AdminService.addGroupMemberfromadmin.googleapis.com, with the group in the event parameterGROUP_EMAILand the new member inUSER_EMAIL, both inprotoPayload.metadata. - Read membership changes made anywhere else from Enterprise Groups Audit:
google.apps.cloudidentity.groups.v1.MembershipsService.UpdateMembershipfromcloudidentity.googleapis.com. The Reports API event behind an addition isadd_member, with the parametersgroup_idandmember_id. - Alert when the group of a membership event is on the list, and review the new member like a direct grant of the role.
EventsSetIamPolicygoogle.admin.AdminService.addGroupMembergoogle.apps.cloudidentity.groups.v1.MembershipsService.UpdateMembership
LimitsBindings older than the log retention never appear as events, which is why the list has to be seeded from the policies themselves. UpdateMembership is the one method for every kind of membership change, so the event name in protoPayload.metadata has to be read to tell an addition from a removal. Both Workspace logs reach Cloud Audit Logs only while Workspace data sharing with Google Cloud is on.
Newly created service account granted a privileged role
A service account that is created and given Owner, Editor or an IAM administration role within the same hour is rarely a workload identity taking shape, because workloads get narrow roles. It is the pattern of an attacker who builds an identity to keep. Each event alone is ordinary, and the short time between them is the signal.
- A service account is created:
google.iam.admin.v1.CreateServiceAccountfromiam.googleapis.com. The new address is inresponse.emailand the creator inauthenticationInfo.principalEmail. - Within 60 minutes a
SetIamPolicyentry ofcloudresourcemanager.googleapis.comadds a privileged role inserviceData.policyDelta.bindingDeltasfor the memberserviceAccount:followed by that address. - Compare the two callers. The same caller for both events, outside your provisioning pipelines, is the strongest form of the pattern.
Eventsgoogle.iam.admin.v1.CreateServiceAccountSetIamPolicy
LimitsProject bootstrap and infrastructure-as-code runs create service accounts and bind roles in one pass, so their callers have to be excluded by name. The 60 minutes are a starting point. An attacker who waits longer, or who grants the role to an existing account, is not matched and is left to the single-event rules.
Privileged role granted to a service account that has not been used for months
Granting a privileged role to a forgotten service account is quieter than creating a new one. The account looks established, it already exists in the project and no owner watches what it does. Google's Event Threat Detection reports sensitive roles granted to a user-managed service account inactive for more than 180 days.
- A
SetIamPolicyentry ofcloudresourcemanager.googleapis.comwhoseserviceData.policyDelta.bindingDeltasadd a privileged role, as the role rules on this page read them, for a member that starts withserviceAccount:. - Search the audit logs of the past 180 days for any entry whose
authenticationInfo.principalEmailis that service account, the member without itsserviceAccount:prefix. Leave out Google-managed service agents, which Google lists on its service agents page. - Raise the grant when there is none. Then watch for the first entries of the account after the grant and for keys created for it (
google.iam.admin.v1.CreateServiceAccountKey).
EventsSetIamPolicygoogle.iam.admin.v1.CreateServiceAccountKey
LimitsAn account that only reads data writes Data Access entries, which exist only where those logs are on, so it can look unused when it is not. Accounts kept for rare jobs or disaster recovery look dormant too, and logs kept for less than 180 days shorten the look-back. The 180 days follow Google's definition and are a starting point.
Triage
- Read bindingDeltas for the added role and member (user:, serviceAccount:, group:, principal://) and protoPayload.resourceName for the level (organizations/, folders/ or projects/).
- Confirm the caller (principalEmail, and authenticationInfo.serviceAccountDelegationInfo when the call came through an impersonated service account) and look for a matching change request or infrastructure-as-code run.
- Review what the new member did afterwards and remove the binding if it is not explained.
Response
Once the attack is confirmed:
- Remove the added binding from the allow policy of the organization, folder or project named in the event. Bindings are inherited, so check the levels above and below for the same member as well.
- Suspend the user or disable the service account that received the role. If the role went to a group, review who was added to that group recently.
- Contain the caller. Remove its
setIamPolicyrights and reset its credentials. If the call came through an impersonated service account, also remove the impersonation rights of the original caller on that account. - Look for what the new member created while it held the role, such as service account keys, further bindings, impersonation rights on service accounts, custom role changes and federation providers, and remove it. Removing the first binding does not undo any of these.
- Compare the allow policy of the affected resource with its state before the incident, using the allow policy history or your infrastructure-as-code definition, to confirm that no other binding was added.
Mitigation
- Keep the basic roles (Owner, Editor, Admin, Writer) and IAM administration roles off day-to-day accounts; grant them just in time and prefer predefined or custom roles scoped to the task.
- Restrict
setIamPolicyat organization and folder level to a few break-glass and automation identities. - Enforce domain restricted sharing (
iam.managed.allowedPolicyMembersor the legacyiam.allowedPolicyMemberDomains) so grants can only target the organization's own identities. - Remove Owner, Editor and admin roles from service accounts.
Frequently asked questions
Do the rules see a privileged role granted on a single resource, such as a service account?
Only the rule for default service accounts does, and it matches by caller, not by role. The other rules on this page match `SetIamPolicy` calls to Cloud Resource Manager, which records grants on organizations, folders and projects. A role granted on the allow policy of an individual resource is recorded by that resource's own service and is not matched here. A binding on the allow policy of a service account, for example, is an IAM API event and needs its own rule.
Why did the basic role rule fire on a change that removed Owner?
The action and the role are matched separately in the serialized `bindingDeltas` list. A call that removes Owner or Editor from one member while adding an unrelated binding for another therefore matches. Read the delta in the event to see which role was added, and for whom, before acting.
Is a privileged role for a group or a service account less urgent than one for a user?
No. Attackers grant the role to whatever identity they control, which can be their own user, a new or compromised service account, or a group. With a group the allow policy names only the group, so who holds the role depends on the group's membership. Read the member in `bindingDeltas` and investigate each type the same way.
How does this differ from permissions added to a custom role?
Here an allow policy changes. A binding for a privileged role is added, and Cloud Resource Manager records it as `SetIamPolicy` with the binding in `bindingDeltas`. When permissions are added to a custom role that is already bound, no allow policy changes and these rules stay silent. That case is recorded as `google.iam.admin.v1.UpdateRole` and needs its own detection.
References
- MITRE ATT&CK T1098.003: Additional Cloud Roles
- Review IAM allow policy history
- Resource Manager audit logging
- Roles and permissions overview
- Best practices for using service accounts
- Event Threat Detection overview (IAM Anomalous Grant, Token Creator role rules)
- Example logs for service accounts
- Audit logs for Google Workspace (Admin Audit, Enterprise Groups Audit)
- Admin audit events: group settings (ADD_GROUP_MEMBER)
- Enterprise Groups audit events (add_member)
- Service agents