Execution via GitHub Actions Runner
Adversaries compromising GitHub Actions workflows can execute arbitrary commands on runner hosts, leading to code execution, reconnaissance, credential harvesting, or network exfiltration.
This threat focuses on the exploitation of GitHub Actions runners by malicious actors. By gaining the ability to modify or trigger workflows in a linked GitHub repository, attackers can execute arbitrary commands on the runner host. The attack leverages the Runner.Worker process or shell interpreters launched via runner entrypoint scripts. Successful exploitation can lead to malicious workflow activity, including code execution, reconnaissance, credential harvesting, and network exfiltration. This presents a significant risk, particularly for organizations relying on self-hosted runners, as it allows attackers to potentially compromise the underlying infrastructure and sensitive data. The Elastic detection rule aims to identify such malicious activity.
Attack Chain
- An attacker gains unauthorized access to a GitHub repository linked to a self-hosted runner.
- The attacker modifies an existing workflow or creates a new one to inject malicious commands.
- The compromised workflow is triggered, initiating the
Runner.Workerprocess on the runner host. - The
Runner.Workerprocess executes a shell interpreter (e.g., bash, sh, zsh) via an entrypoint script. - The shell interpreter executes malicious commands specified in the compromised workflow, such as downloading a payload using
curlorwget. - The downloaded payload is executed, establishing a reverse shell connection to an attacker-controlled server using
ncorsocat. - The attacker performs reconnaissance, credential harvesting, or lateral movement within the runner host and connected network.
- Sensitive data is exfiltrated from the compromised runner host to the attacker’s infrastructure.
Impact
A successful attack can lead to the complete compromise of the self-hosted runner environment. This could result in the theft of sensitive source code, credentials, and other proprietary information. The attack can also be used as a stepping stone for further attacks on the organization’s internal network and infrastructure. Affected sectors include software development, DevOps, and any organization using GitHub Actions with self-hosted runners.
Recommendation
- Deploy the Sigma rule
Execution via GitHub Actions Runnerto your SIEM to detect suspicious commands executed by the GitHub Actions Runner. - Monitor process creation events for commands like
curl,wget,nc,socat,powershell.exe,cmd.exe,bash, andsshspawned byRunner.Workeror shell interpreters withentrypoint.shin their command line (see Sigma rule). - Implement strict access control policies for GitHub repositories and workflows to prevent unauthorized modifications.
- Regularly review and audit GitHub Actions workflows for suspicious or unexpected commands.
- Isolate self-hosted runners in a segmented network to limit the impact of a potential compromise.
- Enable Sysmon process-creation logging to provide detailed process execution information for effective detection.
Detection coverage 3
Suspicious Network Tools Executed by GitHub Actions Runner
highDetects the execution of network-related tools such as curl, wget, nc, or socat, spawned by the GitHub Actions Runner process, indicating potential malicious activity within the runner environment.
Suspicious Shell Activity from GitHub Actions Runner Entrypoint
mediumDetects shell commands launched from the GitHub Actions Runner entrypoint script, potentially indicating malicious workflow execution.
Persistence via GitHub Actions Runner
mediumDetects the execution of persistence-related tools such as nohup and setsid, spawned by the GitHub Actions Runner process, indicating potential malicious activity within the runner environment.
Detection queries are kept inside the platform. Get full rules →