PIVTR-D
RGoogle Cloud playbook · Pipelines and supply chain

CI/CD pipeline or workload identity federation abused

The attacker takes over a pipeline or the trust that lets an external system act in your project, then deploys code or gets service account access without a stolen key. Common routes are a workload identity pool provider with no attribute condition, a poisoned build step or trigger, and a Cloud Build service account with broad roles. Stop token exchange and attacker builds first.

Look here

LogSearch for
Audit log, Security Token ServiceToken exchanges from unexpected subjects or addresses. Exchanges log as method ExchangeToken on sts.googleapis.com, and the subject is in the authentication info of the entry: gcloud logging read 'protoPayload.serviceName="sts.googleapis.com"' --project=<project> --freshness=30d
Audit log, IAM Service Account CredentialsA federated identity acting as a service account: GenerateAccessToken, SignBlob, SignJwt and GenerateIdToken on iamcredentials.googleapis.com right after an exchange. Data Access logs for this service are off by default and must be enabled before the incident
Admin Activity audit log, workload identity poolsPools and providers created or changed shortly before the suspect activity. These are long-running operations and log twice, at start and at end: CreateWorkloadIdentityPool, CreateWorkloadIdentityPoolProvider and UpdateWorkloadIdentityPoolProvider on iam.googleapis.com
Provider configurationEvery provider in the pool: gcloud iam workload-identity-pools providers list --workload-identity-pool=<pool> --location=global
Provider configurationAn empty attributeCondition, or one that matches a whole organization or many repositories, which trusts every workflow it covers. Read it with attributeMapping for each provider: gcloud iam workload-identity-pools providers describe <provider> --workload-identity-pool=<pool> --location=global
IAM bindings for federated principalsBindings to a whole pool or to a broad attribute, which give every matching external workload the role. A principal:// binding names one subject: gcloud asset search-all-iam-policies --scope=organizations/<org-id> --query='policy:principalSet://iam.googleapis.com'
Admin Activity audit log, Cloud BuildTriggers created or changed, and builds started by unexpected principals: gcloud logging read 'protoPayload.serviceName="cloudbuild.googleapis.com" AND (protoPayload.methodName:"BuildTrigger" OR protoPayload.methodName:"CreateBuild")' --project=<project> --freshness=30d
Cloud Build triggersEach trigger's service account, substitutions and build file. List triggers with gcloud builds triggers list, then read each one: gcloud builds triggers describe <trigger>
Cloud Build historyThe steps of recent builds and the service account that ran each. Read one with gcloud builds describe <build-id>. List them: gcloud builds list --filter='status=SUCCESS' --limit=50
Source repositoryNew or edited workflow files, new branches that the attribute condition allows, and secrets that were read or changed, in the repository on the external side (GitHub Actions, GitLab CI)

Contain

#Item
1Save the provider and pool configuration, the IAM policies that reference the pool, and the Cloud Build trigger definitions as evidence
2Disable the provider so token exchange stops. For other provider types use the matching update-aws, update-saml or update-x509 command: gcloud iam workload-identity-pools providers update-oidc <provider> --workload-identity-pool=<pool> --location=global --disabled
3Remove the bindings that let federated principals impersonate or act as service accounts: gcloud iam service-accounts remove-iam-policy-binding <sa-email> --member='principalSet://iam.googleapis.com/projects/<project-number>/locations/global/workloadIdentityPools/<pool>/attribute.<name>/<value>' --role=roles/iam.workloadIdentityUser --all
4Disable the service accounts the pipeline used. Follow leaked service account keys for any keys they have: gcloud iam service-accounts disable <sa-email>
5Cancel running attacker builds: gcloud builds cancel <build-id>
6Delete attacker triggers after saving each definition destructive. gcloud has no command that disables a Cloud Build trigger: gcloud builds triggers delete <trigger>
7Revoke the secrets on the external side: repository and organization secrets, deploy keys, personal access tokens, and runner registration tokens
8Lock the repository branches that trigger deploys
9Freeze deploys from the pipeline until the workflow files and build steps are reviewed
10Check what the pipeline pushed to Artifact Registry and deployed to production

Eradicate and recover

#Item
1Add an attribute condition to every provider that lacks one, and narrow broad ones. For GitHub, restrict the repository and the ref: gcloud iam workload-identity-pools providers update-oidc <provider> --workload-identity-pool=<pool> --location=global --attribute-condition="assertion.repository=='<org>/<repo>' && assertion.ref=='refs/heads/main'"
2Bind service accounts to a single subject or a narrow attribute, and give each pipeline its own service account with only the roles it needs
3Move Cloud Build to a user-specified service account with minimal roles. The build logs must then go to a Cloud Storage or Cloud Logging bucket you own
4Restore workflow files, build steps and dependencies changed in the window from a known-good commit
5Require review on changes to pipeline files
6Rotate every secret the pipeline could read, and every credential it could obtain through its service accounts, using the scope in Scope
7Re-enable the provider only after the condition and mapping are corrected. The gcloud reference for update-oidc documents only --disabled, so re-enable it in the Google Cloud console under IAM & Admin > Workload Identity Federation
8Enable Data Access audit logs for sts.googleapis.com and iamcredentials.googleapis.com
9Alert on new providers and on provider changes
Watch out
  • Attribute mappings and conditions decide who is trusted. A GitHub provider whose condition does not name a repository accepts tokens from any repository on GitHub that presents the right issuer, which is the confused deputy problem the documentation warns about.
  • Disabling a provider stops new exchanges. Federated access tokens already issued, and access tokens minted from them for service accounts, stay valid until they expire.
  • A build's service account often has deploy and registry write roles. The build steps run with it, so any change to a build file or trigger is a change to those roles.
  • The attack starts outside Google Cloud. Audit logs show the exchange and its results, and the workflow history on the external side shows how the attacker got in.

Google Cloud documentation: Workload Identity Federation concepts, attribute mappings and conditions; IAM audit logging for workload identity pools; gcloud reference for iam workload-identity-pools providers update-oidc and builds triggers; Cloud Build user-specified service accounts. Checked September 2026. Re-checked October 2026: gcloud reference for iam workload-identity-pools providers update-oidc (documents --disabled, --attribute-condition); Manage workload identity pools and providers.

Adapts material from Dynamic Incident Response: A Framework for Security Teams by Joshua Wright, © 2026 The Escal Institute of Advanced Technologies, Inc. d/b/a SANS Institute, licensed under CC BY 4.0. Figures reproduced under that license. Changes were made. Not published by, endorsed by, or affiliated with the SANS Institute.