Hijacking GitHub Runners To Compromise The Organization
A GitHub App with write access to self-hosted runners allowed registering a runner with the ubuntu-latest tag, so workflows intended for GitHub-hosted runners ran on the attacker's runner. This let the attacker steal CI/CD secrets and push malicious code.
Published on synacktiv.com
Rédigé par Hugo Vincent - 22/05/2024 - dans Pentest - Téléchargement
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, GitHub does not prevent self-hosted runners from registering with labels reserved for GitHub-hosted runners, allowing job hijacking.
Impact
An attacker could steal CI/CD secrets and push malicious code to repositories, compromising the organization.
What the attacker needed
GitHub App with runner write permission; Ability to register a runner
How it was found
- Obtain a GitHub App private key with write access to organization_self_hosted_runners.
- Use the key to generate a registration token for the organization.
- Register a self-hosted runner with the ubuntu-latest label using the token.
- Wait for a workflow with ubuntu-latest to run and capture its secrets.
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.
GitHub Actions run jobs on machines called runners. Normally, GitHub provides these machines, but organisations can also use their own self-hosted runners. The report shows that if an attacker can register a self-hosted runner with the same label as GitHub's runners, they can trick GitHub into sending sensitive jobs to their machine, letting them steal secrets.