{"slug": "stolen-github-tokens-pushed-13500-secret-dumping-branches-ai-keys-were-on-the", "title": "Stolen GitHub Tokens Pushed 13,500 Secret-Dumping Branches. AI Keys Were on the List", "summary": "Wiz Research reported that an automated campaign it calls Gheist used stolen GitHub tokens to plant more than 13,500 branches across over 850 compromised accounts, pushing a workflow file that prints the full secrets context to its run log in base32 and then deletes the run. A later variant targets self-hosted runners, scanning for 31 token formats including keys for Anthropic, Hugging Face, Groq and NVIDIA, plus cloud metadata and Kubernetes credentials. Wiz traced the tokens to infostealer logs and earlier supply-chain compromises such as the March Trivy incident.", "body_md": "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.\n\nOn 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.\n\nThe 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.\n\nFor 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.\n\nThe 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.\n\nThe 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.\n\n*One push, one workflow, one log: the secrets leave through the run output, then the run is deleted.*\n\nWhere 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.\n\nCoding 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.\n\nThe 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.\n\nIf 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.\n\nSince 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.\"\n\nThe 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.\n\nDo 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.\n\nWiz 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:\n\n```\nORG=your-org\nfor r in $(gh repo list \"$ORG\" --limit 1000 \\\n    --json nameWithOwner --jq '.[].nameWithOwner'); do\n  gh api --paginate \"repos/$r/branches\" --jq '.[].name' \\\n    | grep -E '^ci-sync-[0-9a-z]{6}$' \\\n    | sed \"s|^|$r: |\"\ndone\n```\n\nA 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.\n\nSo 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`.\n\n*Branch names can be deleted. Audit logs and cloud role-assumption logs are where the trace stays.*\n\nIf 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.\n\nRotation 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.\n\nThe durable fix is to give a stolen token less to find. A few changes, each backed by its vendor's docs:\n\n`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.\"\nWiz 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.\n\nIf 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.\n\nGheist 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.", "url": "https://wpnews.pro/news/stolen-github-tokens-pushed-13500-secret-dumping-branches-ai-keys-were-on-the", "canonical_source": "https://dev.to/gabrielanhaia/stolen-github-tokens-pushed-13500-secret-dumping-branches-ai-keys-were-on-the-list-3kbk", "published_at": "2026-12-05 17:34:38+00:00", "updated_at": "2026-12-05 17:43:39.534440+00:00", "lang": "en", "topics": ["ai-safety", "ai-tools", "ai-agents", "developer-tools"], "entities": ["Wiz Research", "GitHub", "Anthropic", "Hugging Face", "Groq", "NVIDIA", "Trivy", "Claude Code"], "also_reported_by": [], "takeaway": "A workflow that dumps the entire secrets context leaks API keys even with permissions: {} set, because GitHub only masks exact secret values and base32-encoded copies print in full.", "recommendation": {"advice": "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.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/stolen-github-tokens-pushed-13500-secret-dumping-branches-ai-keys-were-on-the", "markdown": "https://wpnews.pro/news/stolen-github-tokens-pushed-13500-secret-dumping-branches-ai-keys-were-on-the.md", "text": "https://wpnews.pro/news/stolen-github-tokens-pushed-13500-secret-dumping-branches-ai-keys-were-on-the.txt", "jsonld": "https://wpnews.pro/news/stolen-github-tokens-pushed-13500-secret-dumping-branches-ai-keys-were-on-the.jsonld"}}