In Google Cloud, anyone who can mint a token for a service account effectively holds every permission that service account holds, and those impersonation rights are rarely reviewed after they are granted. A single Service Account Token Creator binding at project level, or a chain of service accounts that can each impersonate the next, can turn a low-privilege developer or CI identity into a project owner without a key ever being created. This guide is the periodic audit: finding every principal with impersonation permissions, mapping delegation chains and cross-project paths, checking which rights are actually used in audit logs, and removing the rest. It is for Google Cloud platform teams, cloud security engineers and NHI programme owners. For the wider model of roles and service accounts, start with the Google Cloud IAM and Service Accounts Guide; this page assumes you already know it.
This is an independent guide from NHI Mgmt Group, based on Google Cloud's public documentation as of November 2026. It is not sponsored or reviewed by Google. Product features change, so confirm settings against Google Cloud's current documentation.
Key takeaways
- Six permissions grant impersonation power, not one: getAccessToken, getOpenIdToken, implicitDelegation, signBlob and signJwt let a principal act as the service account, and actAs lets it attach the account to a resource that then runs as it.
- Project-level grants are the main finding. A Token Creator or Service Account User binding on a project or folder applies to every service account beneath it, including ones created later. Google's guidance is to manage access on each service account individually.
- Chains hide the real path. If SA_1 holds Token Creator on SA_2 and SA_2 holds it on SA_3, SA_1 can reach SA_3 through the delegates field. Audit the graph, not single bindings.
- Use the tools Google provides: Cloud Asset Inventory search for bindings, Policy Analyzer with service account impersonation analysis for who can reach a resource, and lateral movement insights for cross-project paths.
- Logs prove use, but only if enabled. GenerateAccessToken events are Data Access audit logs, so turn on Data Access logging for IAM before you rely on usage evidence to remove a grant.
Which permissions count as impersonation
Impersonation always involves two identities: the authenticated principal and the service account it acts as. Google documents impersonation through the gcloud --impersonate-service-account flag, the Service Account Credentials API (iamcredentials.googleapis.com) and credential configuration files used with Workload Identity Federation. The audit has to cover every permission that enables any of these, plus the attach right that achieves the same outcome by a different route.
| Permission | What it lets the holder do | Predefined roles that contain it | Audit priority |
|---|---|---|---|
iam.serviceAccounts.getAccessToken | Get an OAuth 2.0 access token for the service account and call Google APIs as it | Service Account Token Creator, Workload Identity User | High |
iam.serviceAccounts.signBlob | Sign any blob, including a JWT; can be used to obtain access or ID tokens through a JWT bearer flow | Service Account Token Creator | High |
iam.serviceAccounts.signJwt | Sign a JWT; can also be used to obtain access or ID tokens | Service Account Token Creator | High |
iam.serviceAccounts.implicitDelegation | Get tokens through a delegation chain | Service Account Token Creator | High (creates chains) |
iam.serviceAccounts.actAs | Attach the service account to a resource such as a Compute Engine VM, so the workload runs as it | Service Account User, and any other role that includes actAs | High where the principal can also create resources |
iam.serviceAccounts.getOpenIdToken | Get an OIDC ID token for the service account, used to call services that accept Google-signed identity tokens | Service Account OpenID Connect Identity Token Creator, Service Account Token Creator, Workload Identity User | Medium (depends on what accepts the token) |
Two details shape the audit. First, Service Account User does not let a principal create short-lived credentials or use --impersonate-service-account; that needs Token Creator. But actAs combined with permission to create a VM, Cloud Run service or function gives the principal code running as the service account, so treat it as impersonation by another route. Second, Workload Identity User is the role GKE and Workload Identity Federation use to let external or Kubernetes identities impersonate a service account, so its bindings point to principals outside your Google Cloud identity directory. See the How to move GKE workloads from keys to Workload Identity Federation guide for that side.
Custom roles count too. Any custom role that includes one of the six permissions is an impersonation role, whatever its name. Policy Analyzer searches by permission, which is why the audit below queries permissions rather than role names.
Before you start
- Access for the auditor: Cloud Asset Viewer (
roles/cloudasset.viewer) at the organisation, Role Viewer (roles/iam.roleViewer) to resolve custom roles, and Service Usage Consumer for gcloud. To expand Google Groups into members you need the Workspacegroups.readpermission, which the Groups Reader admin role includes. - Logging: confirm IAM Data Access audit logs are enabled in the projects that hold sensitive service accounts. Without them, token generation is not recorded and you cannot prove a grant is unused. See the Google Cloud Audit Logs and Log Sinks Guide.
- Tier and quota: Policy Analyzer allows 20 policy analysis queries per organisation per day without an organisation-level activation of Security Command Center Premium or Enterprise; lateral movement insights need a Premium or Enterprise activation and the Recommender API. Plan queries accordingly.
- Owner data: an inventory of service accounts with named owners, so each finding has someone to decide on it. See the Service Account Inventory Template.
Step-by-step audit
- Find impersonation grants on projects, folders and the organisation. Use Cloud Asset Inventory at organisation scope, for example
gcloud asset search-all-iam-policies --scope=organizations/ORG_ID --query="roles:roles/iam.serviceAccountTokenCreator", then repeat forroles/iam.serviceAccountUser,roles/iam.workloadIdentityUserandroles/iam.serviceAccountOpenIdTokenCreator. Note that results show direct grants on each resource, not inherited ones, so record the level at which each binding sits. - Catch custom and broad roles by permission. Run
gcloud asset search-all-iam-policieswith--query="policy.role.permissions:iam.serviceAccounts.getAccessToken"(and the other five permissions). This finds Owner, Editor and custom roles that include the permission, which a role-name search misses. - Read each sensitive service account's own policy. For every service account with high privilege (Owner, Editor, IAM admin, organisation-level roles, production data access), run
gcloud iam service-accounts get-iam-policy SA_EMAILand list who holds which role on it. This is the policy that Google recommends as the place to grant impersonation. - Ask who can reach your crown jewels. For each critical resource, run
gcloud asset analyze-iam-policywith--full-resource-name, the sensitive--permissionsand--analyze-service-account-impersonation. Policy Analyzer then runs extra queries to find who can impersonate the service accounts that hold that access, checking actAs, getAccessToken, getOpenIdToken, implicitDelegation, signBlob and signJwt. Google warns this is expensive, so use the long-running export to BigQuery or Cloud Storage and keep the result as audit evidence. - Map delegation chains. Load the bindings from steps 1 to 3 into a simple graph: an edge from principal P to service account S wherever P holds Token Creator (or implicitDelegation) on S, directly or through the parent project. Walk the graph from every human, group and external principal. A path of two or more service account hops is a delegation chain: the Service Account Credentials API accepts a
delegateslist of the intermediate accounts, in order, and each account needs Token Creator on the next. - List cross-project paths. With Security Command Center Premium or Enterprise, run
gcloud recommender insights list --insight-type=google.iam.policy.LateralMovementInsight --organization=ORG_ID --location=global. These insights identify roles that let a service account in one project impersonate a service account in another. If an impersonator can reach more than 1,500 service accounts the target list is empty, though the count is still reported: treat that as a critical finding in itself. - Check use in audit logs. In Logs Explorer, filter on
protoPayload.serviceName="iamcredentials.googleapis.com"andprotoPayload.methodName="GenerateAccessToken"(and the ID token and signing methods).protoPayload.authenticationInfo.principalEmailshows who created the credential andresource.labels.email_idthe service account it was for. On calls made with an impersonated token,serviceAccountDelegationInfocarries the original principal infirstPartyPrincipal.principalEmail. Compare 90 days of use against the grants found above. - Decide per finding. For each grant: remove (unused), narrow (move from project to the single service account it is needed on), replace (a human who needs occasional access moves to a time-bound, approved grant) or accept (documented owner and reason). Record the decision against the service account owner.
- Remediate in rings. Remove grants first in non-production, wait one full release and batch cycle, then production. Keep the removed binding in the change record so it can be re-added exactly if something breaks.
Reading the findings
| Finding | Why it matters | Typical fix |
|---|---|---|
| Token Creator or Service Account User granted on a project or folder | Covers every service account in scope, including high-privilege ones and accounts created later | Re-grant on the specific service account only; remove the project binding |
| A group with many human members holds Token Creator on a privileged service account | Every member can act as the service account from their own workstation | Narrow to a small break-glass group with time-bound access and approval |
| CI or automation service account holds Token Creator on a more privileged account | A compromised pipeline inherits the higher privilege; this is a common chain start | Give the pipeline its own least-privilege account, or federate the CI identity straight to the target with a scoped attribute condition |
| Delegation chain of two or more hops | Effective access is invisible in any single policy | Collapse to one hop or remove; document any chain that must stay |
| Cross-project lateral movement insight | A breach in a low-value project reaches a high-value one | Move the grant, or split the service accounts so the target project holds its own |
| Workload Identity User bound to a broad principal set | Any workload matching the pool or namespace can mint tokens | Bind to a specific subject or Kubernetes service account, not a whole pool |
| Grant with no GenerateAccessToken or signing events in 90 days | Standing right with no business use | Remove after owner confirmation |
| Default compute or App Engine service account as an impersonation target | Google notes default service accounts are automatically granted Editor on the project | Use dedicated per-application service accounts; remove impersonation of defaults |
Decision guidance: who should keep impersonation rights
- Humans: impersonation is better than handing out service account keys, because the audit log keeps both identities. Keep it, but scope it to named service accounts and to the smallest group, with time-bound grants for production.
- Pipelines and automation: prefer Workload Identity Federation directly to the service account the job needs over a chain from a generic CI account. One hop is easier to review than three.
- Platform tooling: some tools legitimately need Token Creator across many accounts (deployment orchestrators, backup tooling). Treat these as privileged NHIs with owner, review and alerting, like a PAM vault.
- Small organisations: a handful of projects often means a few project-level grants. Fix those first, then move to per-account grants for anything with Owner or Editor.
- Large organisations: run the audit from organisation scope on a schedule, export Policy Analyzer and insights results to BigQuery, and assign findings to project owners through your ticketing system.
Where identity governance fits
Impersonation rights are entitlements to non-human identities, and they belong in the same review cycle as any other privileged entitlement. Each service account needs a named human owner who confirms, at each review, who may impersonate it and why. Joiners and movers who gain Token Creator through a group should lose it through the same group when they move. See the How to Run an Access Review for Service Accounts guide and the NHI Ownership Guide.
Removing keys does not remove the risk; it moves it to impersonation. If your organisation is replacing keys under an organisation policy, run this audit straight after, because teams often swap a key for a broad Token Creator grant. See the Google Cloud Service Account Keys Security Guide.
Verify, roll back and common errors
- Verify: re-run the Cloud Asset Inventory searches and the Policy Analyzer query for each critical resource; the removed principals should no longer appear. Re-list lateral movement insights after their next refresh.
- Roll back: re-add the exact binding from the change record on the service account, not the project, so a rollback does not restore the original broad grant.
- PERMISSION_DENIED after removal: a caller still relies on the removed grant. Check the audit log for its last GenerateAccessToken call and decide whether the use is legitimate. See the Google Cloud PERMISSION_DENIED Troubleshooting Guide.
- Long-lived tokens: the default maximum access token lifetime is 1 hour; it can be extended to 12 hours only for service accounts listed in the
constraints/iam.allowServiceAccountCredentialLifetimeExtensionorganisation policy. Review that list as part of the audit, because a removed grant does not cancel tokens already issued.
Common failure patterns
- Auditing role names only: custom roles and basic roles carry the same permissions. Search by permission as well as role.
- Trusting logs that were never on: without Data Access audit logs for IAM, the absence of GenerateAccessToken events proves nothing. Google also notes that some services, including App Engine and GKE, do not log the identity that created short-lived credentials.
- Reviewing single bindings, not chains: every hop looks reasonable on its own; the end-to-end path does not.
- Ignoring actAs: teams remove Token Creator but leave Service Account User at project level for people who can also create VMs or functions, which reaches the same outcome.
- One-off clean-up: project-level grants come back with each new project template. Add the search queries to a scheduled job and to project factory checks. See the Google Cloud Organization Policy Guide for preventive guardrails.
Detection and measurement
- Alert on new grants: log-based alerts on
SetIamPolicythat add any of the four impersonation roles, at project, folder or service account level. - Alert on unusual use: GenerateAccessToken or signing calls on a privileged service account from a principal not on its approved list, or from a chain with a non-empty delegates list.
- Metric: project-level impersonation grants, target zero outside documented exceptions.
- Metric: privileged service accounts with an owner-approved impersonator list, target 100%.
- Metric: open lateral movement insights, trending down quarter on quarter.
- Metric: impersonation grants unused for 90 days, removed within one review cycle.
For hunting across identity logs more broadly, see the Identity Threat Hunting Guide.
Framework mapping
| Framework | Reference | How this audit supports it |
|---|---|---|
| NIST CSF 2.0 | PR.AA-05 | Access permissions are defined, managed, enforced and reviewed with least privilege |
| NIST CSF 2.0 | DE.CM-03 | Monitoring of token generation and impersonation use |
| NIST SP 800-53 Rev. 5 | AC-2, AC-6, AC-6(7) | Account management, least privilege and review of privileges |
| NIST SP 800-53 Rev. 5 | AU-12, AU-6 | Audit record generation (Data Access logs) and review |
| MITRE ATT&CK | T1548.005 Temporary Elevated Cloud Access | Abuse of impersonation to gain temporary elevated access |
| MITRE ATT&CK | T1098.003 Additional Cloud Roles | Attacker adds Token Creator or similar roles for persistence |
| MITRE ATT&CK | T1078.004 Cloud Accounts | Use of service accounts as valid cloud accounts |
Practitioner checklist
- Enable IAM Data Access audit logs in projects with privileged service accounts before the audit starts.
- Search the organisation for all four impersonation roles and for the six impersonation permissions.
- Read the IAM policy of every high-privilege service account and record each impersonator.
- Run Policy Analyzer with service account impersonation analysis for each critical resource and export the result.
- Map delegation chains and cross-project paths; collapse or remove chains of two or more hops.
- Remove project and folder level Token Creator and Service Account User grants, re-granting per service account where needed.
- Remove grants with no recorded use in 90 days after owner confirmation.
- Review the credential lifetime extension organisation policy list.
- Alert on new impersonation grants and on use by unapproved principals.
- Repeat quarterly and after any project template change.
Standards and references
- Google Cloud: Roles for service account authentication
- Google Cloud: Service account impersonation
- Google Cloud: Create short-lived credentials for a service account
- Google Cloud: Best practices for using service accounts securely
- Google Cloud: Analyze IAM policies with Policy Analyzer
- Google Cloud: Lateral movement insights
- Google Cloud: Examples of service account audit logs
- NIST: SP 800-53 Rev. 5
Related NHI Mgmt Group resources: Google Cloud IAM and Service Accounts Guide · Google Cloud Service Account Keys Security Guide · Google Cloud Project Compromise Playbook · How to Run an Access Review for Service Accounts