GCP_CAN_SET_SA_IAMPOLICY
Summary
FSProtect ACL Alias
GCP_CAN_SET_SA_IAMPOLICY
GCP Alias
IAM & Hierarchy Control
Affected Object Types
Service Accounts
Exploitation Certainty
Certain
Granting Roles
roles/owner, roles/iam.securityAdmin, roles/iam.serviceAccountAdmin
Description
GCP_CAN_SET_SA_IAMPOLICY indicates that an identity can call setIamPolicy on a specific GCP Service Account resource. Unlike setting IAM policy at the project or org level, this edge targets a single service account's allow policy — but the impact is equally severe when the target SA holds elevated privileges.
The primary exploitation path is granting roles/iam.serviceAccountTokenCreator on the target SA to a controlled identity. This allows the attacker to generate short-lived OAuth2 access tokens and ID tokens for the target SA from anywhere, without needing to be running on GCP infrastructure.
Key abuse scenarios:
Grant
roles/iam.serviceAccountTokenCreatoron a high-privilege SA → directly generate tokens (GCP_CAN_IMPERSONATE_SA).Grant
roles/iam.serviceAccountUser→ attach the SA to a VM you spin up (GCP_CAN_ACT_AS_SA).Add a backdoor identity as a Service Account Admin for persistence.
Identification
gcloud CLI
GCP Console
Open GCP Console → IAM & Admin → Service Accounts.
Click on the target service account.
Select the Principals with access tab to view who has access to this SA.
Exploitation
gcloud CLI
Compound path: GCP_CAN_SET_SA_IAMPOLICY → grant roles/iam.serviceAccountTokenCreator → GCP_CAN_IMPERSONATE_SA → call any GCP API as the target SA.
Mitigation
Restrict
roles/iam.serviceAccountAdmin— this role includessetIamPolicyon service accounts; assign only to privileged automation.Audit SA-level IAM policies for unexpected members:
Use Workload Identity Federation instead of SA keys to reduce the need for broad SA IAM grants.
Limit service account creation with
constraints/iam.disableServiceAccountCreationwhere applicable.
Detection
Admin Activity
SetIamPolicy
resource.type=service_account, methodName=google.iam.admin.v1.SetIamPolicy
Alert on:
SetIamPolicyon service accounts by non-automation identities.New
roles/iam.serviceAccountTokenCreatororroles/iam.serviceAccountUserbindings on privileged SAs.
References
https://cloud.google.com/iam/docs/service-accounts#service_account_permissions
https://cloud.google.com/iam/docs/impersonating-service-accounts
Last updated
Was this helpful?