Join our Newsletter — 33% off our NHI Course
Home› Guides› How to Audit GCP Service Account Impersonation Rights:…
Guide Cloud & Workload Identity

How to Audit GCP Service Account Impersonation Rights: Token Creator and Chains

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 13 November 2026 14 min read
On this page

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.

PermissionWhat it lets the holder doPredefined roles that contain itAudit priority
iam.serviceAccounts.getAccessTokenGet an OAuth 2.0 access token for the service account and call Google APIs as itService Account Token Creator, Workload Identity UserHigh
iam.serviceAccounts.signBlobSign any blob, including a JWT; can be used to obtain access or ID tokens through a JWT bearer flowService Account Token CreatorHigh
iam.serviceAccounts.signJwtSign a JWT; can also be used to obtain access or ID tokensService Account Token CreatorHigh
iam.serviceAccounts.implicitDelegationGet tokens through a delegation chainService Account Token CreatorHigh (creates chains)
iam.serviceAccounts.actAsAttach the service account to a resource such as a Compute Engine VM, so the workload runs as itService Account User, and any other role that includes actAsHigh where the principal can also create resources
iam.serviceAccounts.getOpenIdTokenGet an OIDC ID token for the service account, used to call services that accept Google-signed identity tokensService Account OpenID Connect Identity Token Creator, Service Account Token Creator, Workload Identity UserMedium (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 Workspace groups.read permission, 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

  1. 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 for roles/iam.serviceAccountUser, roles/iam.workloadIdentityUser and roles/iam.serviceAccountOpenIdTokenCreator. Note that results show direct grants on each resource, not inherited ones, so record the level at which each binding sits.
  2. Catch custom and broad roles by permission. Run gcloud asset search-all-iam-policies with --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.
  3. 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_EMAIL and list who holds which role on it. This is the policy that Google recommends as the place to grant impersonation.
  4. Ask who can reach your crown jewels. For each critical resource, run gcloud asset analyze-iam-policy with --full-resource-name, the sensitive --permissions and --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.
  5. 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 delegates list of the intermediate accounts, in order, and each account needs Token Creator on the next.
  6. 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.
  7. Check use in audit logs. In Logs Explorer, filter on protoPayload.serviceName="iamcredentials.googleapis.com" and protoPayload.methodName="GenerateAccessToken" (and the ID token and signing methods). protoPayload.authenticationInfo.principalEmail shows who created the credential and resource.labels.email_id the service account it was for. On calls made with an impersonated token, serviceAccountDelegationInfo carries the original principal in firstPartyPrincipal.principalEmail. Compare 90 days of use against the grants found above.
  8. 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.
  9. 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

FindingWhy it mattersTypical fix
Token Creator or Service Account User granted on a project or folderCovers every service account in scope, including high-privilege ones and accounts created laterRe-grant on the specific service account only; remove the project binding
A group with many human members holds Token Creator on a privileged service accountEvery member can act as the service account from their own workstationNarrow to a small break-glass group with time-bound access and approval
CI or automation service account holds Token Creator on a more privileged accountA compromised pipeline inherits the higher privilege; this is a common chain startGive 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 hopsEffective access is invisible in any single policyCollapse to one hop or remove; document any chain that must stay
Cross-project lateral movement insightA breach in a low-value project reaches a high-value oneMove the grant, or split the service accounts so the target project holds its own
Workload Identity User bound to a broad principal setAny workload matching the pool or namespace can mint tokensBind to a specific subject or Kubernetes service account, not a whole pool
Grant with no GenerateAccessToken or signing events in 90 daysStanding right with no business useRemove after owner confirmation
Default compute or App Engine service account as an impersonation targetGoogle notes default service accounts are automatically granted Editor on the projectUse 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.allowServiceAccountCredentialLifetimeExtension organisation 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 SetIamPolicy that 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

FrameworkReferenceHow this audit supports it
NIST CSF 2.0PR.AA-05Access permissions are defined, managed, enforced and reviewed with least privilege
NIST CSF 2.0DE.CM-03Monitoring of token generation and impersonation use
NIST SP 800-53 Rev. 5AC-2, AC-6, AC-6(7)Account management, least privilege and review of privileges
NIST SP 800-53 Rev. 5AU-12, AU-6Audit record generation (Data Access logs) and review
MITRE ATT&CKT1548.005 Temporary Elevated Cloud AccessAbuse of impersonation to gain temporary elevated access
MITRE ATT&CKT1098.003 Additional Cloud RolesAttacker adds Token Creator or similar roles for persistence
MITRE ATT&CKT1078.004 Cloud AccountsUse 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

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

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.