Your self-hosted runner's role is bigger than the repo it serves

On October 19 the Gheist campaign added a job aimed at self-hosted GitHub runners, built to take instance-role and Kubernetes credentials from the host. Why runner identity is the real blast radius on AWS, and how to shrink it.

Antivenom5 min read

On October 19, the tool behind the Gheist campaign started pushing a second job alongside its secret dump. Wiz Research reports that the new sync-host job runs on runs-on: self-hosted, apparently only where a self-hosted runner is registered. Its target is not the repository's secrets. It is the machine the job lands on, and the cloud identity that machine carries.

Wiz calls the job buggy. It looked for the wrong runner key file, had a broken pattern for credentials in URLs, and did not actually collect GCP or Azure tokens. But the list of things it reached for is a useful map of what sits on a typical runner, and of why a runner's identity is often more powerful than any repository it serves.

What the job went after

According to Wiz, the sync-host job works through these stages and logs each one under a marker header:

Diagram: a planted job lands on a self-hosted runner and reaches five things the repository never owned: process environments, the host filesystem through the Docker socket, the EC2 instance role through the metadata service, runner credential files and the Kubernetes service account token. Below, the controls that shrink each one.

  • Host details and crontab.
  • A recursive search for 31 token formats, including AI provider keys, private keys, .env files, Terraform state and shell history.
  • The environment of every running process, read from /proc.
  • A container started through the Docker socket with the host's root filesystem mounted.
  • AWS instance-role credentials, plus a look at GCP and Azure metadata.
  • GitHub Actions and GitLab runner credential files.
  • The Kubernetes service account token.

The tokens that pushed these jobs were stolen, so the attacker never needed a pull request or a fork. In public repositories, GitHub's hold on suspicious runs stopped the job, including the self-hosted variant, Wiz says. In private repositories and on GitHub Enterprise Server there is no such hold.

Why the runner is the prize

A GitHub-hosted runner is a fresh virtual machine that disappears after the job. GitHub's own hardening guide is blunt about the difference: self-hosted runners "can be persistently compromised by untrusted code in a workflow". It warns that anyone who can fork a private repository and open a pull request, generally anyone with read access, can compromise the runner environment, including its secrets and GITHUB_TOKEN.

Three things make the runner bigger than the repository:

  1. Shared hosts. When a runner is defined at the organization or enterprise level, GitHub can schedule workflows from many repositories onto it. A planted job in a low-value repository runs next to, or after, a deploy job from a high-value one.
  2. Leftovers. Persistent runners keep caches, credential files, Terraform state and shell history between jobs. GitHub notes that secrets passed as command-line arguments can be seen by another job on the same runner.
  3. The machine's own identity. The instance profile on a runner host is available to every job that runs there, whatever repository it came from. If that role was sized for "whatever CI needs", it is sized for the worst repository on the runner.

What it means on AWS

Teams usually reach for IMDSv2 here, and it helps less than people expect.

IMDSv2 requires a session token from a PUT request, and by default the response to that request has a hop limit of 1. That stops a container on a bridged network from reaching the metadata service, because the extra network hop drops the response. AWS notes that some container setups raise the hop limit for compatibility, which turns that protection off.

But a job that runs directly on the host is not behind any extra hop. It can get a session token like any other local process. And a job that can talk to the Docker socket can start a container that mounts the host's root filesystem, which is what the Gheist job did. IMDSv2 with a hop limit of 1 protects against containerized jobs and forwarded requests. It does not protect against code that is, in effect, root on the host.

So the control that matters is what the role can do, not how hard it is to fetch:

  • Give the runner host an almost empty role. Enough to register, pull images and write logs. Nothing that touches production.
  • Let each job get its own role through OIDC, with a trust policy pinned to the repository and a reviewed environment. The deploy role then belongs to the deploy job, not to the machine.
  • On Kubernetes, give runner pods a service account with no cloud permissions, and grant cloud access per workload, not per node.

What to do this week

If a Gheist job may have run on your runners (indicators from Wiz):

  • Search runner hosts for files named .gdmp_pat, .gdmp_patg and .gdmp_sweep, and for the string gdmp-pivot in job logs.
  • Treat any self-hosted host that ran a ci-sync branch, and its instance role, as compromised. Rotate what the role could reach and rebuild the host.
  • Check GuardDuty for InstanceCredentialExfiltration findings, which flag instance credentials used from outside the instance's account or outside AWS.

For every self-hosted runner fleet:

  • List each runner's instance profile and attached policies. Anything with write access to production, iam:* or broad secretsmanager:GetSecretValue goes to the top of the list.
  • Move to ephemeral runners. GitHub's just-in-time runners run at most one job before they are removed. GitHub warns that reusing hardware can still leak data, so start each one from a clean image.
  • Remove the Docker socket from runner hosts, or run builds with a rootless or isolated builder. Wiz's own advice is to run self-hosted runners as ephemeral hosts without the Docker socket or unrestricted metadata access.
  • Put runners into groups and restrict which repositories can use each group. A repository that never deploys should not share a runner with one that does.
  • Keep self-hosted runners off public repositories. GitHub's guide says they should almost never be used there.
  • Require IMDSv2 and keep the hop limit at 1 unless a containerized job truly needs metadata access. It is not enough on its own, but it removes the easy path.

The short version

The Gheist host job stumbled on its own bugs. The next one may not. The question to ask about every runner is simple: if a job you did not write ran here, which AWS role would it get, and what could that role do?

Answering that question with proof is what Antivenom is for. Our AI red team runs only against your own systems, with your permission, and walks from a CI job to the roles it can reach. The AI blue team narrows the role or the trust, and the red team walks the same path again to confirm it is closed. For the OIDC side of the same campaign, read Gheist: stolen GitHub tokens and the AWS roles that said yes.

← All posts
  • self-hosted runners
  • GitHub Actions
  • Gheist
  • IMDSv2
  • AWS security
  • CI/CD security
  • supply chain attack
  • cloud security

The arms race has started

Evolve as fast as the attacker.

Antivenom is opening to a small group of security and platform teams first. Join the waitlist to get early access.