How the attack works
Custom roles bundle individual permissions and are defined at project or organization level. A principal with iam.roles.create or iam.roles.update (Role Administrator, Organization Role Administrator, Owner) decides what a custom role grants, and every principal bound to the role receives a change immediately, wherever the role is bound.
Attackers add permissions such as resourcemanager.projects.setIamPolicy, iam.serviceAccounts.getAccessToken or iam.serviceAccountKeys.create to a custom role they already hold. No allow policy changes, so detections that only watch SetIamPolicy miss it. IAM writes google.iam.admin.v1.CreateRole and google.iam.admin.v1.UpdateRole Admin Activity entries, with the added and removed permissions in serviceData.permissionDelta.
What an attacker needs
iam.roles.createoriam.roles.updatein the project or organization that defines the role (Role Administrator, Organization Role Administrator or Owner).
Impact
The added permissions for every principal bound to the role at every scope where it is bound. With setIamPolicy, token or key permissions this becomes control of the project or organization.
Detection rules
Custom IAM Role Created, Updated or Undeleted in Google Cloud
Detects creation, update and undeletion of custom IAM roles at project or organization level (Admin Activity audit log). Use it as a baseline signal; the companion rule raises sensitive permission additions.
title: Custom IAM Role Created, Updated or Undeleted in Google Cloud
id: f49bbe5e-605a-4d2d-9df6-091bc45f978a
status: experimental
description: >-
Detects creation, update and undeletion of custom IAM roles at project or
organization level (Admin Activity audit log). Use it as a baseline signal;
the companion rule raises sensitive permission additions.
references:
- https://docs.cloud.google.com/iam/docs/audit-logging
- 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: iam.googleapis.com
protoPayload.methodName:
- google.iam.admin.v1.CreateRole
- google.iam.admin.v1.UpdateRole
- google.iam.admin.v1.UndeleteRole
condition: selection
falsepositives:
- Role maintenance by the IAM team or infrastructure-as-code; exclude the pipeline identity by principalEmail.
level: low
False positives
- Role maintenance by the IAM team or infrastructure-as-code; exclude the pipeline identity by principalEmail.
Sensitive Permission Added to a Custom IAM Role in Google Cloud
Detects CreateRole and UpdateRole calls whose permission delta (serviceData.permissionDelta.addedPermissions) adds a permission that leads to further privilege: any setIamPolicy permission, service account token, signing, delegation, actAs and key creation permissions, custom role updates, organization policy changes and Compute Engine metadata writes (Admin Activity audit log).
title: Sensitive Permission Added to a Custom IAM Role in Google Cloud
id: 19744189-4452-46fd-9cdd-dbfb9874580f
status: experimental
description: >-
Detects CreateRole and UpdateRole calls whose permission delta
(serviceData.permissionDelta.addedPermissions) adds a permission that leads to
further privilege: any setIamPolicy permission, service account token,
signing, delegation, actAs and key creation permissions, custom role updates,
organization policy changes and Compute Engine metadata writes (Admin Activity
audit log).
references:
- https://docs.cloud.google.com/logging/docs/audit/api/ref/rest/Shared.Types/AuditData
- https://docs.cloud.google.com/iam/docs/audit-logging
- https://docs.cloud.google.com/iam/docs/roles-permissions/iam
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: iam.googleapis.com
protoPayload.methodName:
- google.iam.admin.v1.CreateRole
- google.iam.admin.v1.UpdateRole
protoPayload.serviceData.permissionDelta.addedPermissions|contains:
- setIamPolicy
- iam.serviceAccounts.getAccessToken
- iam.serviceAccounts.getOpenIdToken
- iam.serviceAccounts.signBlob
- iam.serviceAccounts.signJwt
- iam.serviceAccounts.implicitDelegation
- iam.serviceAccounts.actAs
- iam.serviceAccountKeys.create
- iam.roles.update
- orgpolicy.policy.set
- compute.projects.setCommonInstanceMetadata
- compute.instances.setMetadata
condition: selection
falsepositives:
- Purpose-built admin or deployment roles maintained by the IAM team; review each addition and exclude the pipeline identity by principalEmail.
- Splunk and QRadar match the permissions anywhere in the event, so an update to a role that already held one of them can match; check permissionDelta.addedPermissions in the event.
level: high
False positives
- Purpose-built admin or deployment roles maintained by the IAM team; review each addition and exclude the pipeline identity by principalEmail.
- Splunk and QRadar match the permissions anywhere in the event, so an update to a role that already held one of them can match; check permissionDelta.addedPermissions in the event.
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.
Permissions added to a custom role that the caller itself holds
The attacker on this page edits a role they already hold, so the privilege change needs no new binding. A role administrator who adds permissions to a role bound to themselves gains those permissions at once, which is self-escalation and not role maintenance. The join between the change and the role's members shows it.
- A
google.iam.admin.v1.UpdateRoleentry fromiam.googleapis.comwhoseserviceData.permissionDelta.addedPermissionsis not empty. Note the role, whose full name has the formprojects/PROJECT_ID/roles/ROLE_IDororganizations/ORGANIZATION_ID/roles/ROLE_ID, and the caller inauthenticationInfo.principalEmail. - Find the members of that role in the current allow policies, for example with a Cloud Asset Inventory search, and in
SetIamPolicyentries whoseserviceData.policyDelta.bindingDeltasadd that role name. - Raise the change when the caller, a group the caller belongs to or a service account the caller can impersonate is among the members, and read the added permissions.
Eventsgoogle.iam.admin.v1.UpdateRole
LimitsA team that owns a custom role and maintains it from the same account looks the same, and so does an infrastructure-as-code identity that both defines and holds roles. Membership through groups needs the group's members as well. Bindings made before your logs start are only visible in the current allow policies.
Triage
- Read serviceData.permissionDelta.addedPermissions and the role that changed.
- Find who is bound to the role (for example with a Cloud Asset Inventory search of allow policies); those principals received the permissions.
- Confirm the change with the role's owner and revert permissions that are not explained.
Response
Once the attack is confirmed:
- Remove the added permissions from the custom role, or set the role back to its last reviewed definition. Every principal bound to the role loses them immediately, wherever the role is bound.
- Take the role administration rights (
iam.roles.create,iam.roles.update) away from the identity that made the change, and contain that identity if it was compromised. - Review the Admin Activity logs of every principal that held the role while the permissions were in place. Look for the follow-on actions those permissions allow, such as allow policy changes, new service account keys and organization policy changes.
- Undo what was done with the added permissions, for example bindings granted through
setIamPolicyand keys created withiam.serviceAccountKeys.create. Setting the role back does not remove them. - If custom roles are managed as code, check that the definition in the repository was not changed as well, so that the next pipeline run does not put the permissions back.
Mitigation
- Limit Role Administrator and Organization Role Administrator to a few identities, and keep defining roles and granting them in separate hands.
- Manage custom roles as code and review every permission addition.
- Treat custom roles that contain
setIamPolicy,getAccessToken,actAsorserviceAccountKeys.createas admin roles.
Frequently asked questions
Why did no IAM policy alert fire when the privileges changed?
No allow policy changed. The attacker edited the definition of a custom role that was already bound, so the only record is a `google.iam.admin.v1.CreateRole` or `UpdateRole` Admin Activity entry. Detections that watch only `SetIamPolicy` miss it, which is why changes to custom roles need a rule of their own.
Who gains access when a permission is added to a custom role?
Every principal that is bound to the role, at every scope where it is bound, and the change applies immediately. The audit entry names the role and the added permissions in `serviceData.permissionDelta`, but not the principals. Finding them takes a search of allow policies, for example with Cloud Asset Inventory.
Why did the sensitive permission rule fire on an update that added nothing sensitive?
In Splunk and QRadar the permission names are matched anywhere in the event, not only in the list of added permissions. An update to a role that already held one of the listed permissions can therefore match. Check `permissionDelta.addedPermissions` in the event to see what the call added.
Which permissions turn a custom role into an admin role?
Any `setIamPolicy` permission, the service account token, signing, delegation and `actAs` permissions, `iam.serviceAccountKeys.create`, `iam.roles.update`, `orgpolicy.policy.set` and the Compute Engine metadata write permissions. Each of them leads to further privilege, so a custom role that contains one should be handled like an admin role, whatever its name says.