Skip to content
Write-up Advanced

Stealing GitHub staff's access token via GitHub Actions

A workflow in the actions/runner repository used a self-hosted runner that was not isolated between jobs, and a malicious pull request could execute arbitrary code on it during a 10-second window. This allowed stealing a GitHub Personal Access Token belonging to a GitHub staff member, which had write access to public repositories of the @actions and @github organisations, potentially enabling supply chain attacks.

ryotak Follow

Published on blog.ryotak.net

2023-04-22 1227 字 GitHub Vulnerability GitHub Actions Supply Chain

RyotaK, on blog.ryotak.net

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the workflow used a self-hosted runner without isolating the environment between jobs, and the asynchronous job-dispatch script introduced a delay during which a malicious pull request could run on the runner before it was removed.

What the attacker needed

Public repository with self-hosted runner; attacker can open a pull request; timing within a 10-second window

The fix

The workflow was fixed by removing the use of the self-hosted runner or by isolating it, as indicated by the timeline showing a permanent fix.

How it was found

  1. The workflow registers a self-hosted runner and an asynchronous script polls for it every 10 seconds.
  2. During that delay, the attacker submits a malicious pull request that triggers the workflow.
  3. The malicious pull request runs arbitrary code on the self-hosted runner.
  4. The subsequent step that removes the runner executes on the compromised runner and exposes the Personal Access Token.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A self-hosted runner is a machine you control that runs jobs for GitHub Actions. Because it is not reset between jobs, if an attacker can run their own job on it, they can leave behind code that later steals secrets. Here, a workflow used such a runner and a timing gap let an attacker run code and steal a powerful token.

More by ryotak

View all

6 more disclosed reports, best first.

More from GitHub

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.