Cloud Security

Self-Hosted Runner Compromise: Isolation and Recovery

November 18, 2026 · 7 min read · By CloudAI Security
Self-Hosted Runner Compromise: Isolation and Recovery

For a suspected self-hosted runner compromise, stop assigning new jobs to the affected runner, restrict its network access without destroying potential evidence, and determine which jobs, credentials and internal systems it could reach. Rebuild the execution environment from a trusted source before returning it to service; removing a suspicious workflow alone does not establish that the runner host is clean. GitHub warns that self-hosted runners can be persistently compromised by untrusted workflow code. This response method separates immediate containment from the later decision to restore capacity.

This is a response procedure for teams operating GitHub Actions runners they manage themselves, not a general pipeline-hardening checklist. Its decision points were reviewed against the GitHub and OWASP guidance linked below on November 18, 2026. The example is hypothetical; no incident was investigated and no recovery outcome was measured.

Contain without erasing evidence

Pause job placement first. Identify the affected runner, its runner group, the repositories allowed to use it and any jobs already running. Arrange for those jobs to stop or finish under the incident owner’s decision; do not silently move an untrusted job onto another privileged host. If a deployment depends on this runner, explicitly record whether the deployment is paused or will use a separately assessed environment. Availability pressure should not turn an unexamined runner into a trusted one.

GitHub’s guidance draws a material distinction between hosted and self-hosted execution: self-hosted runners do not have a guarantee of a fresh, isolated virtual machine for each job. A later job may therefore encounter changes left by an earlier one. Treat the runner’s filesystem, local service configuration, cached material and reachable network as potentially affected until examined. OWASP also notes that self-hosted runners may hold sensitive data and reach internal networks. An isolated workflow file is not an adequate boundary if the job could alter the host underneath it.

Have the incident owner choose a containment method that preserves the evidence the team is authorized to collect. Restrict new job scheduling and unnecessary egress, but document what changed and when. Abruptly deleting the machine may remove the most useful local traces; leaving it fully connected may permit further access. If immediate disconnection is necessary to limit harm, record that decision and the evidence it made unavailable. The site’s incident evidence handoff guide offers a separate method for documenting collection and uncertainty; it does not authorize changes to a production runner.

Map the possible exposure

Build an exposure map from observed jobs and actual runner permissions, not from the workflow name. A useful first pass connects each job to the repository and triggering event, then to credentials supplied during execution, local files it could read and destinations the runner could contact. Mark an item unknown when logs or configuration cannot establish it. This prevents the common error of treating a missing log entry as proof that a credential was never accessible.

A compromised job can put a repository token or other available secrets at risk. GitHub recommends granting the workflow token only the permissions a job needs and warns that a compromised action may access configured secrets or use that token to write to a repository, depending on its permissions. Inspect the effective permissions for the affected jobs rather than assuming a repository-wide default applied unchanged. Determine whether credentials were short-lived, whether any static credentials were present and who can invalidate each one. The site’s EC2 metadata migration guide concerns a different credential-access path; consult it only if the runner’s underlying workload actually depends on EC2 instance metadata.

The following table is an editorial scoping aid, not a record of an incident:

QuestionEvidence to seekDecision it supports
Which jobs used the host?Runner assignments, workflow runs and the observation windowWhich jobs require investigation
What could each job read?Mounted paths, local caches, injected secrets and token permissionsWhich material may need invalidation
Where could it connect?Approved network paths and available connection recordsWhich downstream systems need examination
What changed on the host?Available configuration, process and file evidenceWhether the scope extends beyond one job
What remains unknown?Missing records and untested access pathsWhich assumptions must remain open

In a hypothetical deployment workflow, an untrusted change runs on a runner with access to a private deployment endpoint. The investigation would ask whether the job ran, which identity was available during its execution and whether the endpoint recorded activity. The possibility of access warrants investigation; it is not evidence that the endpoint was contacted. Preserve that distinction in the exposure map and in any downstream incident ticket.

Rebuild and narrow access

Once evidence has been preserved under the team’s procedure, replace the affected execution environment rather than trying to prove cleanliness by deleting a suspicious file. OWASP recommends ephemeral runners and destroying the runner environment after each job to prevent persistence. Where that design is feasible, verify that a new job receives a genuinely fresh execution environment. A container that can alter its underlying long-lived host does not, by itself, resolve concern about host persistence.

Before restoring scheduling, separate jobs that process untrusted contributions from jobs with deployment access. OWASP recommends runner groups and labels to segregate high-privilege and low-privilege work. Test the resulting access boundary from the repository side: identify which repositories can target the privileged group and whether an untrusted workflow can still select it. Restrict the runner’s network access to destinations its assigned work actually requires. These are configuration checks to perform in the team’s environment, not a claim that any particular estate has them enabled.

Review credential handling independently of the rebuild. Invalidate exposed static credentials where the exposure map supports that decision, assess whether repository tokens or downstream sessions need action, and record the owner and completion evidence for each step. Rotating a secret while the suspect host remains available to new jobs can expose its replacement. Conversely, rebuilding the host without addressing a credential that may have been copied leaves the downstream risk unresolved.

Use a return-to-service checklist

The incident owner can use this return-to-service checklist to make the restoration decision explicit. Each item needs an observation, an owner or a documented reason it cannot yet be established:

  1. Record the suspected trigger, affected runner and earliest defensible observation window.
  2. Stop new job placement and record how running jobs were handled.
  3. Preserve authorized host, workflow and downstream evidence before disposal where feasible.
  4. Map jobs to available credentials, local material and reachable systems; keep uncertainties visible.
  5. Invalidate credentials according to their assessed exposure, with confirmation from their owners.
  6. Replace the suspect host from a trusted source and verify the runner’s intended isolation model.
  7. Test repository-to-runner-group access and the network paths needed by assigned jobs.
  8. Approve restoration separately from containment, noting any residual unknowns.

A green workflow run after rebuilding demonstrates that a particular task completed; it does not establish that earlier credentials were safe or that every reachable system was unaffected. If the exposure map is incomplete, retain the uncertainty and assign follow-up work rather than presenting restoration as full incident closure. For the next routine maintenance cycle, test whether an untrusted job can reach a privileged runner group and whether the environment is actually replaced between jobs. Those checks address the persistence path this response was designed to contain.

Sources