Security researchers have uncovered a vulnerability in thousands of public GitHub repositories that could be exploited for malicious code injection via self-hosted GitHub Actions runners. This vulnerability poses a substantial risk of supply chain attacks, allowing attackers to execute arbitrary code on self-hosted runners. The flaw arises when a repository has self-hosted runners attached, and any workflow running in the repository’s context, including those from fork pull requests, could run potentially malicious code. Furthermore, the self-hosted runners set up following default steps are persistent, enabling a process to run in the background after job completion, providing an avenue for deploying persistence mechanisms.
The attacker can manipulate the vulnerability by changing a workflow file within their fork, creating a pull request, and, if approved, running arbitrary code on a self-hosted runner. Security researcher Adnan Khan demonstrated this attack flow by gaining persistent access to GitHub’s own actions/runner-images repository, where workflows for building Windows and MacOS runner images were compromised. Although GitHub took mitigative actions and rewarded Khan with a $20,000 bug bounty, the researchers found thousands of other vulnerable repositories on GitHub and reported over 20 bug bounty reports, exposing various organizations to potential supply chain compromises.
To address this class of vulnerability, organizations are advised to adjust repository settings to require approval for all outside contributions, providing a crucial layer of defense against potential malicious code injection. The researchers expanded their investigation beyond GitHub to other continuous integration and continuous delivery (CI/CD) platforms, discovering similar attack vectors in Buildkite, Jenkins, and CircleCI. These findings underscore the need for organizations, particularly those in advanced tech sectors, to enhance security measures and awareness to prevent potential exploitation and supply chain compromises.