Stolen GitHub Tokens Enable Gheist Campaign to Exfiltrate Secrets from Private Repos
What Happened — Wiz Research uncovered a large‑scale abuse campaign it named Gheist. The attackers obtain valid GitHub personal access tokens (PATs) – often belonging to developers or automation accounts – and use the GitHub API to enumerate every repository the token can access. For each repository, the tool creates a new branch (named ci‑sync‑xxxxxx) and commits a tiny GitHub Actions workflow file (sync‑check.yml). When the branch is pushed, the workflow runs automatically.
The workflow’s sole job is to read every secret stored in the repository (environment‑scoped credentials, production API keys, etc.), encode each secret in base‑32 (which defeats GitHub’s log‑masking), and print the raw values to the workflow run log. The attacker then downloads the log via the API and deletes the run seconds later, leaving no external server traffic to block.
GitHub’s public‑repo safeguard – which holds potentially malicious workflow runs until a collaborator approves them – does not apply to private repositories or GitHub Enterprise Server. Consequently, the malicious runs complete silently, and the audit logs only show a short‑lived branch and a run by the “gheist” user agent.
In enterprise environments, the tool can pivot across multiple stolen tokens within minutes, cloning private repositories, planting the workflow, and later using the harvested cloud credentials (e.g., AWS IAM roles) to enumerate services such as AWS Secrets Manager. The campaign also evolved on October 19 to target self‑hosted runners, searching the runner host for additional tokens and keys via Docker containers.
Wiz observed more than 13,500 malicious branches across 850+ compromised accounts, and noted that other threat actors reuse the same stolen tokens for unrelated activities (e.g., renaming repositories to lure users to cracked‑software downloads).
The breach was discovered through a combination of GitHub audit‑log analysis (identifying the ci‑sync‑* branches and the “gheist” user agent) and cloud‑provider logs that showed role assumptions originating from the malicious workflow runs.
Why It Matters for Trust & Control Assurance — The incident highlights a gap in credential‑management and workflow‑approval controls; continuous evidence collection for secret‑handling can close that gap.
Who Is Affected — Software development teams, DevOps organizations, and any enterprise that stores production secrets in private GitHub repositories or uses GitHub Actions for CI/CD.
Recommended Actions
- Revoke all compromised PATs and enforce short‑lived, scoped tokens for automation.
- Rotate every secret (environment variables, cloud credentials, API keys) exposed in affected repositories.
- Enable branch‑protection rules that require manual approval for any workflow run on newly created branches.
- Audit GitHub logs for the
gheistuser agent and for branches matchingci‑sync‑*. - Search cloud audit logs (e.g., AWS CloudTrail) for role assumptions whose subject includes a
ci‑sync‑branch. - Adopt OIDC‑based workload identity and limit the scope of cloud permissions granted to GitHub Actions.
Technical Notes
- Attack vector: Stolen GitHub personal access tokens → automated creation of malicious workflow branches → secret exfiltration via workflow logs.
- Key technique: Base‑32 encoding of secrets bypasses GitHub’s log‑masking.
- Scope: 13,500+ malicious branches across 850+ compromised accounts; private repositories only.
- Detection: GitHub audit logs (branch creation, workflow run, deletion) and cloud provider logs (role assumptions).
- Variants: Post‑Oct 19 variant targets self‑hosted runners, using Docker to harvest additional credentials.
Source: Help Net Security