# Stolen GitHub Tokens Pushed 13,500 Secret-Dumping Branches. AI Keys Were on the List

> Source: <https://dev.to/gabrielanhaia/stolen-github-tokens-pushed-13500-secret-dumping-branches-ai-keys-were-on-the-list-3kbk>
> Published: 2026-12-05 17:34:38+00:00

**Recommendation:** Scope CI secrets to the jobs that need them, avoid printing the secrets context, and audit for ci-sync-* branches and sync-check.yml workflows after any token exposure.
More in the playbook "Securing agents and AI tools": <https://wpnews.pro/playbooks/agent-security>

If your repo has an `ANTHROPIC_API_KEY` secret so a coding agent can run in CI, a stolen GitHub token with push access could be enough to read it. It takes no exploit and no malicious package, only a push to a private repo.

On October 25, Wiz Research published its report on [Gheist](https://www.wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles), an automated campaign it has tracked since September 15. Wiz says it recovered more than 13,500 planted branches from more than 850 compromised accounts, with figures current as of October 24. [RuntimeWire](https://runtimewire.com/article/wiz-gheist-stolen-github-tokens-actions-secrets) reported the same numbers the same day.

The campaign takes its name from the `gheist` user agent its tooling sends to GitHub's API, [per Wiz](https://www.wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles). It has no command-and-control server. The secrets leave through GitHub's own API, so there is no attacker domain for you to block.

For every repository a stolen token can reach, the tool creates a branch named `ci-sync-` plus six random characters and commits one file, `.github/workflows/sync-check.yml`, with the message "ci: sync config", [according to Wiz](https://www.wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles). The commit is authored as the token's owner and unsigned.

The push triggers the workflow. The workflow prints the environment and the whole `secrets` context to its own run log, encoded as base32. Wiz explains why that matters: GitHub masks a secret in logs only when the exact value appears, so an encoded copy prints in full. The tool then downloads the log and deletes the run seconds later.

The workflow also sets `permissions: {}`, [per the report](https://www.wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles), which restricts the `GITHUB_TOKEN` but does nothing to stop a job from reading secrets. And if the repository has deployment environments, one variant runs a job matrix over them, so environment-scoped secrets, often your production credentials, get printed too.

*One push, one workflow, one log: the secrets leave through the run output, then the run is deleted.*

Where did the tokens come from? Wiz says the sources it could trace fit two patterns: infostealer logs, and tokens exposed in earlier supply-chain compromises, such as the Trivy compromise in March.

Coding agents in CI usually authenticate with a repository secret. Anthropic's own [Claude Code GitHub Actions docs](https://code.claude.com/docs/en/github-actions) say setup saves the credential as a repository secret named `ANTHROPIC_API_KEY` for an API key or `CLAUDE_CODE_OAUTH_TOKEN` for a subscription token. Nothing is wrong with that setup. But a workflow that dumps the entire `secrets` context takes whatever is in it, and an AI provider key is spendable money.

The later variant goes further. Wiz says it added a `sync-host` job aimed at self-hosted runners, which searches the home directory, workspace and system paths for 31 token formats, "including keys for AI providers such as Anthropic, Hugging Face, Groq and NVIDIA." The same job collects cloud metadata and runner and Kubernetes service account credentials, and tries the Docker socket to reach the host's root filesystem. Wiz also calls it buggy: it looks for the wrong runner key file and doesn't collect GCP or Azure tokens.

If this sounds familiar, it rhymes with a story from earlier this month: [an infostealer that grabs `.claude.json` and Codex's `config.toml`](https://dev.to/gabrielanhaia/an-infostealer-now-grabs-claudejson-and-codexs-configtoml-check-what-yours-hold-196n). Stealers feed token dumps, and token dumps feed campaigns like this one.

Since July 28, [GitHub Actions holds potentially malicious workflow runs](https://github.blog/changelog/2026-07-28-github-actions-holds-potentially-malicious-workflows-for-approval/) until a collaborator with write access approves them. Wiz says every public Gheist run it checked sat at `action_required`. In its words: "The control worked, and the malicious payloads never ran."

The catch is scope. GitHub's changelog says the protection "currently applies to public repositories on github.com only," and GitHub Enterprise Server does not have it. In private repositories, [Wiz reports](https://www.wiz.io/blog/gheist-attempted-scaled-abuse-of-stolen-github-tokens-stumbles) that runs completed and were deleted, and cloud logs showed organizations' own workflows assuming AWS roles on attacker branches. In enterprise organizations, the tool cycled through several users' and automation accounts within minutes and cloned private repositories. Hours later, Wiz says, cloud credentials from the same organization were used to enumerate AWS Secrets Manager.

Do not approve a held `sync-check` run, and do not run code from a `ci-sync` branch. Both are on Wiz's list of response steps.

Wiz publishes the branch pattern `^ci-sync-[0-9a-z]{6}$`. This loop uses the [GitHub CLI](https://cli.github.com) to list matching branches across an organization's repositories:

```
ORG=your-org
for r in $(gh repo list "$ORG" --limit 1000 \
    --json nameWithOwner --jq '.[].nameWithOwner'); do
  gh api --paginate "repos/$r/branches" --jq '.[].name' \
    | grep -E '^ci-sync-[0-9a-z]{6}$' \
    | sed "s|^|$r: |"
done
```

A match whose only change is `.github/workflows/sync-check.yml` is the signature Wiz describes. An empty result is not a clean bill of health, though. Wiz says about two-thirds of the implicated accounts were no longer available on GitHub as of October 24, and a cleaned-up branch leaves no trace in this list.

So also look where deletion doesn't reach. Wiz's hunt steps: in your GitHub audit log, search for runs on `ci-sync-*` branches deleted within a minute of completing, and for activity with the `gheist` user agent. If your workflows use OIDC, check cloud audit logs for role assumptions whose subject includes a `ci-sync-` branch. On self-hosted runners, search for the files `.gdmp_pat`, `.gdmp_patg` and `.gdmp_sweep`, and for the string `gdmp-pivot`.

*Branch names can be deleted. Audit logs and cloud role-assumption logs are where the trace stays.*

If you find a hit, Wiz is blunt: rotate every secret available to the affected repositories, including organization and environment secrets. Deleting the run or the branch does not remove the exposure. Revoke the token that pushed the commit, check its owner's machine for an infostealer, and treat any self-hosted runner that ran a `ci-sync` branch, and its instance role, as compromised.

Rotation means the provider side too. Anthropic's docs note that if you delete a repository secret, ["the credential it held stays valid"](https://code.claude.com/docs/en/github-actions). Revoke the key in the provider's console, then store the new one.

The durable fix is to give a stolen token less to find. A few changes, each backed by its vendor's docs:

`id-token: write` permission.`token.actions.githubusercontent.com:sub`. A subject like `repo:your-org/app:environment:production` will not match a `ci-sync-` branch.`gh` token.`gh auth login --expiring`. GitHub says a leaked access token then "becomes unusable within hours instead of lasting indefinitely."
Wiz adds two more: prefer GitHub Apps or short-lived fine-grained tokens over personal access tokens, and run self-hosted runners as ephemeral hosts without Docker socket or unrestricted metadata access.

If your agent's CI key is still a plain repository secret, the OIDC exchange in the first bullet is the change that takes it out of the `secrets` context entirely.

Gheist rides on something event-driven systems take for granted: a push is an event, and whatever consumes it trusts the producer. Thinking about who gets to emit an event and what a consumer can reach is part of the ground the [Event-Driven Architecture Pocket Guide](https://www.amazon.com/dp/B0GX3B8371) covers. It's one of 8 short books in the [Pocket Guides for Developers series](https://www.amazon.com/dp/B0GYLH38X4), on agents, RAG, prompts, observability, events, databases and system design. I also build [Hermes IDE](https://hermes-ide.com), an IDE for running Claude Code, Codex and other coding agents side by side, each on its own branch.
