Skip to content
rebuildstack.co

Insights / Pipelines and supply chain

GitHub Actions secrets: your CI is a cloud identity

Konstantins Feofantovs, Founder, rebuildstack ·

wfx-loot showed that rotating GitHub Actions secrets is not enough once a CI role trusts someone else. How to scope the role and check for persistence.

Key points

  • Hunt before you rotate: a rewritten AWS trust policy or an added Azure federated credential survives rotation, because neither is a secret.
  • Replace stored cloud keys with OIDC, grant id-token: write only to the deploy job, and put that job behind an environment with required reviewers.
  • Trust one environment subject, not a wildcard, and take the right to change trust policies, create keys or add credentials away from the deploy role.

Why are GitHub Actions secrets a cloud problem?

On 10 November 2026, starting around 12:45 UTC, an attacker began using hijacked GitHub accounts to push a CI secret stealer into repositories those accounts could write to. Aikido, which named the campaign wfx-loot, counted 4,837 compromised accounts opening probe pull requests in 61,764 repositories [1]. SafeDep counted 8,093 public repositories that received a malicious commit on their default branch between 10 November and 04:36 UTC on 12 November, and says the real number is higher because GitHub search sees only public default branches [3]. Endor Labs reports that at least 1,806 repositories had already had credentials stolen [4], and Aikido later counted at least 1,835 repositories that ran the payload [1]. The counts measure different things, so read each one with its source.

How the accounts were taken in the first place has not been confirmed by any of the researchers. GitHub had published no statement on its blog or changelog that we could find, and Endor Labs noted that no takedown had been announced [4].

The part worth your time is not the GitHub side. It is what the stealer did once it was running inside a workflow. According to the researchers, it read every secret the job could see, the workflow token, and the job's OIDC token, then used them to open sessions in AWS, Google Cloud and Azure [2][4]. In AWS it rewrote the trust policy of a role it had reached so that any AWS account could assume it, and tried to create long-lived access keys [1][2]. In Azure it added federated identity credentials named wfx-ci-… to app registrations, trusting workflows in the compromised repository [1][2][3]. In Google Cloud it impersonated service accounts; none of the reports describe a GCP backdoor of the same kind [1][3][4].

That is the whole lesson in one paragraph. Your CI runner is not a build tool that happens to hold some passwords. It is a cloud identity with the permissions of every role it can assume, and an attacker who runs code inside it inherits all of them.

Why does rotating secrets not fix it?

Every report ends with the same advice: rotate everything the affected workflows could reach. Every report also says that rotation alone is not enough [2][4][5].

Rotation replaces the keys you know about. The persistence described in this campaign does not depend on those keys:

  • A rewritten AWS trust policy lives on the role itself. After you rotate the access key that was stolen, the role still says who may assume it, and if that now reads "AWS": "*", any AWS account can still assume it [1][2].
  • New IAM access keys created by the attacker are not in your secrets store. You will not rotate what you do not know exists [2][4].
  • An Azure federated identity credential is a trust relationship, not a secret. SafeDep notes that once it is added, any workflow on the repository's main branch can authenticate as that app even after its client secrets are rotated [3].

So the order matters. Look for planted trust in the cloud first, remove it, then rotate. If you rotate first and stop, you have closed the door the attacker no longer needs.

Why do the defaults not save you?

Three defaults work against you here, and none of them is a bug.

Repository and organization secrets reach any workflow that runs from a push. A secret stored at repository level is available to every job in every workflow on every branch that a push triggers. The stealer did not need to know which secret was valuable; StepSecurity describes it collecting all of them at once [2]. If an account with write access is compromised, the attacker writes the workflow.

Long-lived keys outlive the incident. An access key or a service account key stored as a secret is valid until someone deletes it. It works from a laptop as well as from a runner, so once it leaves the job it is no longer tied to your pipeline at all.

OIDC trust is often wider than the pipeline. OIDC is the right replacement for stored keys, and it is still an identity. Both Aikido and Endor Labs report the stealer minting OIDC tokens inside the job and exchanging them for cloud sessions [1][4]. Whether that exchange succeeds depends entirely on the trust condition on the cloud side. GitHub's own AWS example includes a wildcard form, repo:octo-org/octo-repo:*, which accepts any branch, pull request merge branch or environment in the repository [7]. A role trusted that way can be assumed by a workflow an attacker just pushed to a throwaway branch.

Add branch protection to the list with a caveat: the researchers report the stealer posting forged success status checks under the names of required checks to clear merge gates [1][4]. Required checks are not a substitute for required human review.

How to fix it

The goal is narrow: a workflow that an attacker writes should get nothing it can use outside the job, and a role your pipeline uses should not be able to change who trusts it.

1. Replace stored cloud keys with OIDC

Remove AWS access keys, GCP service account keys and Azure client secrets from GitHub secrets, and have the deploy job request a short-lived session through OIDC instead. This does not stop code inside the job from using the session while the job runs. It does mean nothing long-lived leaves with the loot. Keys handed to outside companies are the same problem one step further out, and retiring the cloud keys you gave vendors follows the same logic.

2. Scope permissions per job

Set the default GITHUB_TOKEN to read-only, as Endor Labs recommends [4], ideally at organization level, and grant id-token: write only to the job that deploys. GitHub requires that permission before a job can request an OIDC token at all [6], so leaving it off every other job removes the cloud path from them.

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    steps: [...]
  deploy:
    runs-on: ubuntu-latest
    environment: production
    permissions:
      contents: read
      id-token: write
    steps: [...]

3. Put cloud access behind an environment with required reviewers

When a job references an environment, its OIDC subject becomes repo:ORG/REPO:environment:NAME, and pull request and branch subjects no longer apply to it [6]. Repositories created, renamed or transferred after 15 July 2026, or opted in, issue repo:OWNER@ID/REPO@ID:environment:NAME instead, with immutable IDs (not on GitHub Enterprise Server) [10].

GitHub recommends protection rules on such an environment and gives deployment branch rules as the example [7]. We would add required reviewers and turn on "Prevent self-review", so whoever started the deployment cannot approve it [9]. Check your plan: on GitHub Free, Pro and Team, required reviewers work only on public repositories, so private and internal repositories need GitHub Enterprise for them, and deployment branch rules on private repositories need Pro or Team [9]. Without these rules the environment subject only narrows the trust: any workflow that names production passes, so the deployment branch needs branch protection for it to mean anything.

Move any secret that must remain from repository level to that environment. With reviewers in place, a pushed workflow can reference production, but it waits for a person before it receives a secret or a cloud session.

4. Decide who may assume the CI role, exactly

This is where AWS, Google Cloud and Azure differ.

AWS. In the trust policy of the deploy role, match token.actions.githubusercontent.com:aud to sts.amazonaws.com and token.actions.githubusercontent.com:sub with StringEquals to the environment subject, not a wildcard [7]. Repositories created, renamed or transferred after 15 July 2026, or opted in, issue subjects with owner and repository IDs, so match the format your repository actually issues [7][10]. A rename or transfer switches the subject to the new format [10] without touching your cloud side, so an exact StringEquals trust, a GCP attribute mapping or an Azure federated credential written for the old one silently stops matching.

Google Cloud. Google requires an attribute condition on the workload identity provider that restricts tokens to your GitHub organization, because GitHub uses one issuer for every organization [8]. Map the numeric repository_id and repository_owner_id claims rather than names, which Google warns can be reused [8]. A principalSet keyed on the repository alone still accepts a workflow on any branch, so also map the claim that identifies the deploy job, such as environment [6] or ref, and require it in the attribute condition or the principalSet: for example assertion.environment=='production' together with the owner ID. Google's own example restricts assertion.ref to main [8]. Never grant to every identity in the pool. Google recommends granting the principal direct access to resources over impersonating a service account [8]. Direct access leaves no GenerateAccessToken call behind, which matters when you hunt.

Azure. A classic federated identity credential names one exact subject. Create one per environment you deploy from, on an app registration or managed identity used only by that pipeline, and remember that a repository rename changes the subject [10]. Entra also offers flexible federated identity credentials, in preview, whose claimsMatchingExpression accepts wildcards in the subject [11]. Check for them and do not use them for deploy identities.

5. Take identity administration away from the deploy role

The persistence in this campaign needed permissions a deploy rarely needs: changing a role's trust policy, creating access keys, adding credentials to an app registration [1][2][3]. A deploy role that can change who trusts it can make itself permanent. In AWS, deny the IAM write actions that lead there, not just two of them: iam:PutRolePolicy, iam:AttachRolePolicy, iam:CreateRole together with iam:PassRole, iam:UpdateAssumeRolePolicy, iam:CreateAccessKey, iam:CreateLoginProfile and iam:UpdateLoginProfile. Deny sts:AssumeRole into roles the deploy does not need as well, since Aikido reports the trust rewrite landed on a role the stealer chained into [1]. A permissions boundary or a service control policy can enforce both. In Google Cloud, the deploy service account should not be able to set IAM policy on other service accounts or create keys. In Azure, the pipeline identity should not hold Graph permissions to modify applications, nor Entra directory roles such as Application Administrator or Cloud Application Administrator, which can add credentials to applications [12], nor ownership of the app registration.

6. Make workflow changes need a human

Require code owner review for .github/workflows and block direct pushes to default branches [4]. Reconsider branch protection bypass rights for bot accounts; StepSecurity reports a bot account in this campaign pushing past protection [2].

How to check it worked

Start with the cloud, because that is where the persistence lives.

AWS. List every role whose trust policy references the GitHub OIDC provider or any wildcard principal, and read each condition. Then search CloudTrail since 10 November for UpdateAssumeRolePolicy and CreateAccessKey, and for AssumeRole or AssumeRoleWithWebIdentity with session names starting wfx-, which SafeDep and StepSecurity give as the campaign's session name [2][3]. Event history keeps 90 days of management events without any setup, but each search covers one account and one Region, takes one attribute filter, and does not aggregate across an organization [13]. IAM events land in us-east-1, and STS events in the Region of the STS endpoint that was called, with the global endpoint in us-east-1 [14]. So search us-east-1 for the IAM events and every Region you use for STS, in every account the role reaches, filter by event name and read roleSessionName. CloudTrail Lake or an organization trail does this in one query [13].

Google Cloud. There is no single planted object to look for, so check the paths. Review the attribute condition on each GitHub workload identity provider, the IAM policy on each service account the pool can reach, and any service account keys created since 10 November. StepSecurity and SafeDep suggest looking for GenerateAccessToken and SignJwt calls from your GitHub workload identity pool [2][3]. Those calls are recorded in Data Access audit logs, which are off by default for most services, so check that they are on for the IAM Service Account Credentials API before you trust an empty result. If the pool has direct resource access, there is no such call to find, so also review resource level IAM grants to pool principals.

Reading who grants access and who acts as another identity, against an agreed baseline, is what Access watch is built around.

Azure. List federated identity credentials on every app registration and managed identity your pipelines touch. Delete any named wfx-ci-… [1][3], any whose subject you cannot match to a workflow you run, and any flexible credential with a wildcard expression [11].

GitHub. Search your organization for pull requests titled docs: dependency audit notes, branches named wfx-docs, and the commit messages the researchers list, such as ci: refresh build cache and ci: restore [1][2]. StepSecurity points out that the attacker deleted workflow runs, so look for a gap in a workflow's run numbers right after a suspect commit, and for run deletions in the organization audit log, which records them as workflows.delete_workflow_run [15]; StepSecurity's own Deleted runs view lists the same across an organization [2]. SafeDep and OX say a probe pull request alone means the account that opened it is compromised [3][5].

Then test the fix the way it would be attacked: push a branch with a workflow that requests an OIDC token and tries to assume the deploy role. It should fail at the cloud, not at a missing secret.

What goes wrong

Rotating before hunting. The keys are new, the trust policy still says *, and the incident looks closed. Remove planted trust first.

A wildcard subject left in place "for now". repo:org/repo:* is what most setups start with because it works on the first try. It also accepts the attacker's branch [7].

OIDC treated as the whole fix. OIDC removes the stored key. It does not limit what the role can do, and the stealer used OIDC tokens directly inside the job [1][4]. Scope and permissions still matter.

Environment secrets that are also repository secrets. Moving a secret to an environment does nothing if the old copy is still at repository or organization level.

An empty log taken as proof. Aikido notes that the absence of the stealer's artifacts does not prove nothing was taken [1], and in Google Cloud the most useful signals may never have been recorded. A quiet log that was never switched on tells you nothing.

Forgetting developer machines. SafeDep counted 771 repositories that received a commit adding an npm postinstall hook [3]. The hook runs on any npm install, in existing CI jobs and on developer laptops, without changing a workflow file. Anyone who installed dependencies from an affected commit should rotate the credentials on their own machine too.

Where this sits in our work

In our Fix work, Pipelines and supply chain means short lived deploy credentials through OIDC instead of static keys, and deploy roles cut to what they deploy.

02 Fix

Konstantins Feofantovs

Founder of rebuildstack. We audit cloud access and fix what we find, in your infrastructure and in your code.

Solving something similar?