# GitHub Actions: repo redirect hijack enables supply-chain takeover

GitHub Actions uses: references lack integrity checks and repo redirects can be hijacked by registering a renamed owner's old username, letting attackers run malicious Actions and steal GITHUB_TOKEN.

- Payout: Research
- Severity: high
- Program: GitHub
- Write-up by: RyotaK
- Disclosed: 2021-02-25
- Write-up quality: 8/10
- Original: https://blog.ryotak.net/post/github-actions-supplychain/
- Library page: https://bugbountylibrary.com/r/blog%3Ablog-ryotak-net-post-github-actions-supplychain
- Tags: area:cloud domain:infra impact:integrity impact:privesc kind:research platform:research sev:high tech:ci-cd tech:github-actions technique:recon technique:source-review vuln:misconfiguration

**Target:** GitHub Actions uses: references and repository redirects
**Root cause:** uses: references to third-party Actions are not integrity-pinned by default, and repository redirects after an owner rename can be hijacked by anyone registering the freed username, silently repointing workflows to attacker-controlled repos.
**Steps:**
1. Code-search API query `path:.github/workflows language:yaml uses` matched 919,249 files; paginate with size param to get 810,177
2. Fetch file contents via batched GraphQL `repository(owner,name){object(expression:"ref:filepath"){... on Blob{text}}}` ~200 per request to bypass REST rate limits
3. Parse workflows, extract unique `uses:` owners excluding `actions/`
4. Check owner existence via GraphQL `repositoryOwner(login:"owner_id"){id}`; null means username is registerable
5. Register the freed username and create a repo at the same path to break the redirect and serve a malicious Action
6. Malicious Action reads secrets and exfiltrates the write-scoped GITHUB_TOKEN on non-pull_request triggers
**How found:** Read a DDoS-via-Actions post and the Repo Jacking article, hypothesized that Actions `uses:` behaves like unverified dependency references; confirmed no integrity check, then mass-enumerated workflows via code search and GraphQL to find registerable owner names.
**Exploitation:** Attacker identifies a workflow referencing `owner/repo@ref` where the owner renamed their account, registers the vacated username, recreates the repo path to terminate the redirect, and pushes a malicious Action that exfiltrates GITHUB_TOKEN/secrets when the victim workflow next runs.
**Escalation:** Write-scoped GITHUB_TOKEN enables pushing to the victim repository, achieving full repo compromise; scales across all workflows referencing the hijacked owner.
**Insight:** Enumerate `uses:` owners across workflows and check `repositoryOwner(login:)` for null — renamed accounts leave dangling references that redirects silently mask until someone reclaims the username.
