GCP_CAN_IMPERSONATE_SA
Summary
FSProtect ACL Alias
GCP_CAN_IMPERSONATE_SA
GCP Alias
Persistence & Impersonation
Affected Object Types
Service Accounts
Exploitation Certainty
Certain
Granting Roles
roles/iam.serviceAccountTokenCreator
Description
GCP_CAN_IMPERSONATE_SA indicates that an identity holds iam.serviceAccounts.getAccessToken on a GCP Service Account, typically via roles/iam.serviceAccountTokenCreator. This is the most direct path to full SA impersonation: the attacker can call the IAM generateAccessToken API from anywhere on the internet and receive a short-lived OAuth2 access token valid for 1 hour.
Unlike GCP_CAN_ACT_AS_SA (which requires a compute vehicle), GCP_CAN_IMPERSONATE_SA enables direct API-based token generation with no infrastructure dependency. An attacker needs only network access to the IAM API to fully impersonate the target SA.
Key abuse scenarios:
Generate access tokens for a high-privilege SA and call any GCP API as that SA.
Chain impersonation: generate a token for SA-A, then use SA-A's token to impersonate SA-B (if SA-A has token creator on SA-B).
Generate ID tokens for service-to-service authentication to GCP-hosted services.
Identification
gcloud CLI
GCP Console
Open GCP Console → IAM & Admin → IAM.
Check for principals with
Service Account Token Creatorrole.Go to IAM & Admin → Service Accounts.
Select a service account → Permissions tab.
Check for principals with
Service Account Token Creatorrole.
Exploitation
gcloud CLI
With the resulting token, all GCP API calls are made as the target SA.
Mitigation
Restrict
roles/iam.serviceAccountTokenCreator— this role should only be granted to specific, audited automation identities that explicitly require delegation.Avoid project-level token creator grants — scope to specific SA resources rather than all SAs in a project.
Monitor for chained impersonation paths using Policy Analyzer.
Use Workload Identity Federation for external workloads instead of granting token creator to service accounts.
Detection
Data Access
GenerateAccessToken
resource.type=service_account, methodName=GenerateAccessToken
Alert on:
GenerateAccessTokencalls on privileged SAs by non-automation identities.Impersonation chains — token generation where the caller is itself a service account.
References
https://https://docs.cloud.google.com/iam/docs/service-account-impersonation
Last updated
Was this helpful?