ghtier

These write-ups are not threat intelligence and are not kept up to date as an incident develops. They are here to show how each attack worked, so you can find and fix the same techniques in your own setup. For the latest on an incident, read its sources.

← All incidents

Self-hosted runner takeovers (PyTorch and others)

2023–2024 · Ongoing

By fixing a typo to become a contributor, researchers got their pull requests to run without approval on non-ephemeral self-hosted runners of GitHub's runner-images, PyTorch and TensorFlow, stayed on the machines, and took the write tokens, PATs and cloud keys of the release jobs that ran there next.

Access held
T2Contents: WritePATs and AWS release keys
Full summary

A self-hosted runner attached to a public repository runs any workflow that asks for it, including one from a fork's pull request. By default a fork's pull request only needs approval if its author has never contributed, so fixing a typo is enough to skip it. A runner set up with the default steps is non-ephemeral: it keeps its files and lets a process started by one job keep running into the next. Adnan Khan used this against GitHub's own actions/runner-images, which had such a runner from February to July 2023, and could reach internal GitHub infrastructure and secrets used to build the hosted runner images; GitHub paid him 20,000 dollars. With John Stawinski he then did the same to PyTorch: a typo fix made them contributors, a pull request put a persistent foothold on a self-hosted runner, and later workflows on it gave up GITHUB_TOKENs with write access, personal access tokens and the pytorchbot AWS keys for the S3 buckets that hold PyTorch releases. Praetorian found the same setup in TensorFlow, which Google accepted as a critical supply chain issue. All were found and reported by researchers.

How it unfolded

Pick a step to zoom into it. A dashed line is a step the sources do not state. Blue dots are the checklist items that break the step.

Whole path

Untrusted input reaches aprivileged workflowway inPersist on a non-ephemeralself-hosted runnerescalationTake the workflow tokenfrom a runnerescalationContents: WriteLater jobs' workflow tokensPATs and AWS release keyspytorchbot's secrets

The whole attack, one row per step. Pick a step on the left, or click a box in its row.

Frameworks

Ongoing. First seen January 2023. Mapping by ghtier, not yet reviewed. Threat landscape

Sources

Reported by: Adnan Khan / John Stawinski