Skip to content
Misconfiguration Write-up Intermediate

Exploiting misconfigured Google Cloud Service Accounts from GitHub Actions

A misconfigured Google Cloud Workload Identity Federation provider without conditions allowed any GitHub Action to assume a service account. An attacker could use public repository details to authenticate and enumerate permissions.

Revblock Follow

Published on revblock.dev

Most repositories have switched to OIDC for their GitHub Actions that are connected to GCP. This might seem like a win because Service Account Keys are gone.

Revblock (@revbl0ck), on revblock.dev

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the Workload Identity Federation provider was created without an attribute condition, so any GitHub repository could obtain tokens for the service account.

Impact

An attacker could gain the service account's permissions, which are often broad for deployments, and potentially access the Google Cloud project.

What the attacker needed

Public repository with OIDC config; no conditions on WIF provider; attacker has GitHub account

The fix

Add a condition to the Workload Identity Federation provider that restricts access based on a claim such as repository_owner.

How it was found

  1. Find public GitHub repositories that use the google-github-actions/auth action with OIDC and have the workload_identity_provider and service_account values in plain text.
  2. Look for Infrastructure as Code (Terraform) that defines the Workload Identity Federation pool provider and check if it lacks conditions.
  3. Create your own GitHub repository with an Actions workflow that includes the id-token: write permission.
  4. Copy the authentication steps from the target repository into your workflow, using the discovered workload_identity_provider and service_account values.
  5. Add a step to set up gcloud and run a command like gcloud projects list to test access.
  6. If the command succeeds or returns a permissions error (rather than failing to get a token), the service account is vulnerable.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When a GitHub Action needs to talk to Google Cloud, it can use a short-lived token instead of a long-term key. But if the Google Cloud setup does not check which GitHub repository is asking, then anyone can create their own GitHub Action and get that same token. This lets them act as the service account and see what it can do.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.