# Gheist: stolen GitHub tokens and the AWS roles that said yes

> Wiz tracked a tool that used stolen GitHub tokens to plant secret-dumping workflows on more than 13,500 branches. In private repos the runs completed and AWS roles were assumed from attacker branches. How to scope OIDC trust so a push is not enough.

Published November 17, 2026 by Antivenom · https://antivenom.ai/blog/gheist-github-tokens-oidc

On October 25, Wiz Research [published its account of Gheist](https://wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles), a campaign it had tracked since September 15. A tool used stolen GitHub tokens to push a small workflow to every repository each token could reach. Wiz recovered more than 13,500 planted branches from more than 850 compromised accounts, from personal projects to enterprise private repositories.

Wiz's headline is that the campaign mostly stumbled. In public repositories, GitHub held the runs and the payloads never ran. The part worth your time is where it did not stumble: in private repositories, CloudTrail showed the victims' own workflows assuming AWS roles from attacker branches.

## What happened

Wiz describes [a simple, repeatable routine](https://wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles):

![Diagram: a stolen token pushes a ci-sync branch with a workflow. In public repositories GitHub holds the run. In private repositories the run completes, secrets are printed in base32, the log is downloaded and the run deleted, and the organization's own workflows on that branch assume AWS roles whose trust policy accepts any branch. A trust policy pinned to a reviewed environment breaks the path.](/blog/gheist-github-tokens-oidc.svg)

1. **A branch nobody asked for.** With a stolen token, the tool creates a branch named `ci-sync-` plus six random characters and adds `.github/workflows/sync-check.yml` with the commit message "ci: sync config". The commit is unsigned and authored as the token's owner.
2. **A push trigger.** The workflow runs on push. It prints the job's environment and every secret the job can see, encoded as base32. GitHub masks secrets in logs only when they appear verbatim, so the encoded copy passes through.
3. **Environment secrets too.** A later version adds a job matrix over the repository's deployment environments, which pulls in environment-scoped secrets. Wiz notes these are often production credentials.
4. **Clean up.** The tool downloads the run log through the GitHub API, then deletes the run seconds later. Because it only talks to GitHub's own API, there is no attacker domain to block.

Where did the tokens come from? Wiz says the traceable sources fit infostealer logs and tokens exposed in earlier supply-chain compromises, such as the Trivy compromise in March. It does not claim a single source.

Gheist is not the only campaign using this trick. On October 8, StepSecurity [documented the return of GhostAction](https://www.stepsecurity.io/blog/ghostaction-returns), which pushes workflows named like "Security Audit" from compromised maintainer accounts and sends secrets to a hard-coded server. Wiz says Gheist is a separate operation with different workflow files.

## Why it stumbled, and where it did not

Since July 28, [according to Wiz](https://wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles), GitHub holds potentially malicious workflow runs in public repositories until a collaborator approves them. Every public Gheist run Wiz checked sat in the `action_required` state. In Wiz's words, "The control worked, and the malicious payloads never ran."

That hold does not cover private repositories or GitHub Enterprise Server. There, audit logs showed `ci-sync-*` runs completing and then being deleted by the tool. **CloudTrail showed the organizations' own workflows running on those attacker branches and assuming AWS roles.** In enterprise organizations, Wiz saw the tool cycle through the tokens of several users and automation accounts within minutes, clone private repositories, and hours later use cloud credentials from the same organization to enumerate AWS Secrets Manager. Wiz does not say which credentials those were.

## Why the AWS role said yes

When a GitHub workflow wants AWS access without stored keys, it asks GitHub for an OIDC token and trades it with STS for role credentials. The token carries a `sub` claim that says where the job runs: a repository plus a branch, or a repository plus an environment. The role's trust policy decides which `sub` values it accepts.

IAM enforces a floor. [AWS's documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html) says IAM rejects a GitHub trust policy whose `sub` condition is missing, null or only a wildcard. But a condition like `repo:my-org/my-repo:*` passes that check, and the same page shows it as an example that allows any branch in the repository. In the IAM console, the branch field defaults to a wildcard if you leave it empty. [GitHub's guide](https://docs.github.com/en/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-aws) shows the same repository-wide pattern.

A role trusted that way does not care whether the branch is `main` or `ci-sync-x7k2p9`. **If your trust policy names a repository but not a branch or an environment, anyone who can push a branch to that repository can get the role.** A stolen token with push rights is exactly that.

The fix is to make the token describe something an attacker cannot create with a push:

- **Pin to an environment.** When a job references an environment, the `sub` becomes `repo:ORG/REPO:environment:NAME`. Add required reviewers and deployment branch rules to that environment, and a push to a random branch cannot reach it without a human approving. [AWS recommends](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_oidc.html) protection rules for any environment used in OIDC policies.
- **Or pin to a protected branch.** `repo:ORG/REPO:ref:refs/heads/main` with `StringEquals`, and branch protection on `main` so a stolen token cannot push to it directly.
- **Watch the format change.** GitHub says repositories created after July 15, 2026 use an [immutable subject format](https://docs.github.com/en/actions/reference/security/oidc) that includes owner and repository IDs. Make sure each trust policy matches the format its repository actually sends.

## What to do this week

**Hunt** (indicators from [Wiz](https://wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles)):

- Search your organizations for branches matching `ci-sync-` plus six characters, and commits with the message "ci: sync config" that add only `sync-check.yml`.
- In the GitHub audit log, look for the user agent `gheist` and for workflow runs on `ci-sync-*` branches deleted within a minute of completing.
- In CloudTrail, review `AssumeRoleWithWebIdentity` events from the GitHub provider and check the subject for any `ci-sync-` branch.

**Respond:**

- Rotate every secret an affected repository could expose, including environment secrets. Deleting the run or the branch does not undo the exposure.
- Revoke the tokens that pushed the commits and check their owners' machines for infostealers.
- Do not approve held `sync-check` runs, and do not run code from `ci-sync` branches.

**Harden:**

- List every IAM role that trusts `token.actions.githubusercontent.com`. Flag any `sub` condition that ends in `*` or covers a whole organization.
- Move deploy roles to environment-pinned trust with required reviewers. Keep read-only roles for pull request checks separate from roles that can change production.
- Replace personal access tokens in automation with GitHub Apps or short-lived fine-grained tokens, as Wiz recommends.
- Treat private repositories as the place this control matters most, because that is where GitHub's hold does not apply.

## The short version

Gheist was noisy, buggy and easy to spot once you knew the branch name. It still got AWS roles to answer from branches nobody reviewed, because the trust policy only asked "which repository?" and never "which branch, which environment, who approved?".

That gap is what Antivenom is built to find and close. Our AI red team runs only against your own systems, with your permission, and tests whether a push from an unreviewed branch can reach a role. The AI blue team narrows the trust policy, and the red team retests the same path to prove it is closed. For what GitHub's December 2 change does and does not fix, read [pull_request_target is blocked by default on December 2](https://antivenom.ai/blog/pull-request-target-december-2).
