Skip to content

Commit 62076dd

Browse files
authored
[Tuning] Execution via GitHub Actions Runner (#5892)
1 parent ec791fa commit 62076dd

1 file changed

Lines changed: 94 additions & 15 deletions

File tree

rules/cross-platform/execution_via_github_actions_runner.toml

Lines changed: 94 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
creation_date = "2025/11/26"
33
integration = ["endpoint", "windows", "system", "m365_defender", "sentinel_one_cloud_funnel", "crowdstrike", "auditd_manager"]
44
maturity = "production"
5-
updated_date = "2026/04/07"
5+
updated_date = "2026/04/22"
6+
67

78
[rule]
89
author = ["Elastic"]
910
description = """
10-
This rule detects potentially dangerous commands spawned by the GitHub Actions Runner.Worker process on self-hosted runner
11-
machines. Adversaries who gain the ability to modify or trigger workflows in a linked GitHub repository can execute
12-
arbitrary commands on the runner host. This behavior may indicate malicious or unexpected workflow activity, including
13-
code execution, file manipulation, or network exfiltration initiated through a compromised repository or unauthorized
14-
workflow.
11+
This rule detects potentially dangerous commands spawned by the GitHub Actions Runner.Worker process or by shell
12+
interpreters launched via a runner entrypoint script on self-hosted runner machines. Adversaries who gain the ability
13+
to modify or trigger workflows in a linked GitHub repository can execute arbitrary commands on the runner host. This
14+
behavior may indicate malicious or unexpected workflow activity, including code execution, reconnaissance, credential
15+
harvesting, or network exfiltration initiated through a compromised repository or unauthorized workflow.
1516
"""
1617
false_positives = [
1718
"Authorized GitHub actions runner with no malicious workflow actions.",
@@ -37,18 +38,48 @@ note = """## Triage and analysis
3738
3839
### Investigating Execution via GitHub Actions Runner
3940
40-
Adversaries who gain the ability to modify or trigger workflows in a linked GitHub repository can execute arbitrary commands on the runner host.
41+
Adversaries who gain the ability to modify or trigger workflows in a linked GitHub repository can execute arbitrary
42+
commands on the runner host. This rule covers two parent process paths:
43+
- **Direct execution**: process spawned directly by `Runner.Worker` / `Runner.Worker.exe`.
44+
- **Entrypoint script execution**: process spawned by a shell (`sh`, `bash`, `zsh`) whose command line references
45+
a runner `entrypoint.sh` script, a common pattern when the runner bootstraps workflow steps via a shell script.
4146
4247
### Possible investigation steps
4348
44-
- Review the execution details like process.command_line and if it's expected or not.
45-
- Examine associated network and file activities and if there is any ingress tool transfer activity.
46-
- Verify if there is adjascent any sensitive file access or collection.
47-
- Correlate with other alerts and investiguate if this activity is related to a supply chain attack.
49+
- Review `process.command_line` and `process.parent.command_line` to determine whether the activity matches a known,
50+
authorized workflow step.
51+
- For `grep`, `find`, `pgrep`, `printenv`, and `env` hits, assess whether the command targets sensitive paths, environment
52+
variables (e.g. secrets, tokens), or process listings inconsistent with the declared workflow.
53+
- For `openssl` and `base64` hits, inspect arguments for encoding/decoding operations that may indicate credential
54+
harvesting, data staging, or a C2 channel.
55+
- For `tr` and `cat` hits, assess whether they are chained with other suspicious commands (e.g. `cat /etc/passwd | base64`,
56+
`cat ~/.ssh/id_rsa`) to read and encode sensitive files for exfiltration.
57+
- For `nc`, `ncat`, `netcat`, and `socat` hits, check arguments for reverse shell patterns or port-forwarding to
58+
attacker-controlled infrastructure.
59+
- For `wg` and `wg-quick` hits, inspect arguments for tunnel configuration that may establish a covert egress channel.
60+
- For `ssh` hits, review arguments for reverse tunnel flags (`-R`) or connections to unexpected remote hosts.
61+
- For `kubectl` and `helm` hits, assess whether commands target sensitive namespaces, extract secrets, or deploy
62+
workloads inconsistent with the declared workflow.
63+
- For `vault` hits, inspect arguments for secret reads (`vault kv get`) or token operations that may indicate
64+
credential harvesting from a HashiCorp Vault instance.
65+
- For `gh` hits, review arguments for repository cloning, secret access (`gh secret`), or actions that escalate
66+
access via the runner's GitHub token.
67+
- For `nmap` hits, assess whether the command performs host or port discovery against internal network ranges,
68+
indicating lateral movement preparation.
69+
- Examine associated network activity for unexpected outbound connections, especially following `curl`, `wget`, or
70+
`openssl s_client` invocations.
71+
- Verify whether the triggering workflow run was initiated by an authorized actor and matches the repository's
72+
expected workflow definitions.
73+
- Correlate with file-write and file-access events to identify any sensitive file staging or collection activity.
74+
- Correlate with other alerts to determine if this activity is part of a broader supply chain or CI/CD compromise.
4875
4976
### False positive analysis
5077
51-
- Authorized github workflow actions.
78+
- Authorized GitHub workflow actions that legitimately use discovery utilities (`find`, `grep`, `env`, `nmap`), data
79+
manipulation tools (`cat`, `tr`), encoding tools (`openssl`, `base64`), remote access tools (`ssh`), or
80+
infrastructure CLIs (`kubectl`, `helm`, `vault`, `gh`) as part of their build, test, or deploy steps may trigger
81+
this rule. Validate against known workflow definitions and consider adding workflow-specific exclusions if the
82+
volume is high.
5283
5384
### Response and remediation
5485
@@ -88,10 +119,58 @@ type = "eql"
88119

89120
query = '''
90121
process where event.type == "start" and event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
91-
process.parent.name in ("Runner.Worker", "Runner.Worker.exe") and
92122
(
93-
process.name like ("curl", "curl.exe", "wget", "wget.exe", "powershell.exe", "cmd.exe", "pwsh.exe", "certutil.exe", "rundll32.exe", "bash", "sh", "zsh", "tar", "rm",
94-
"sed", "osascript", "chmod", "nohup", "setsid", "dash", "ash", "tcsh", "csh", "ksh", "fish", "python*", "perl*", "ruby*", "lua*", "php*", "node", "node.exe") or
123+
/* Direct child of the GitHub Actions Runner.Worker process */
124+
process.parent.name in ("Runner.Worker", "Runner.Worker.exe") or
125+
126+
/* Child of a shell interpreter launched via a runner entrypoint script
127+
(e.g. /home/runner/runners/<ver>/run/entrypoint.sh or similar paths) */
128+
(
129+
process.parent.name in ("sh", "bash", "zsh") and
130+
process.parent.command_line like "*runner*entrypoint.sh"
131+
)
132+
) and
133+
(
134+
process.name : (
135+
/* Network / download utilities */
136+
"curl", "curl.exe", "wget", "wget.exe",
137+
/* Windows scripting & LOLBins */
138+
"powershell.exe", "cmd.exe", "pwsh.exe", "certutil.exe", "rundll32.exe",
139+
/* Unix shells */
140+
"bash", "sh", "zsh", "dash", "ash", "tcsh", "csh", "ksh", "fish", "mksh", "busybox", "pwsh",
141+
/* File / archive manipulation */
142+
"tar", "gzip", "rm", "sed", "chmod",
143+
/* macOS-specific */
144+
"osascript",
145+
/* Process persistence helpers */
146+
"nohup", "setsid",
147+
/* Scripting runtimes */
148+
"python*", "perl*", "ruby*", "lua*", "php*", "node", "nodejs", "node.exe",
149+
/* Discovery & reconnaissance */
150+
"pgrep", "grep", "find", "printenv", "env", "nmap",
151+
/* Crypto / encoding (potential exfiltration or C2 channel) */
152+
"openssl", "base64", "basez", "base64plain", "base64url", "base64mime", "base64pem", "basenc", "base32", "base16", "xxd",
153+
/* Data manipulation / inspection */
154+
"tr", "cat",
155+
/* Network relay / tunneling */
156+
"nc", "ncat", "netcat", "nc.traditional", "nc.openbsd", "socat", "wg", "wg-quick",
157+
/* Remote access */
158+
"ssh", "ssh.exe", "ftp", "tftp", "scp", "sftp",
159+
/* Kubernetes / infrastructure */
160+
"kubectl", "helm", "docker", "ctr", "crictl",
161+
/* Secret management */
162+
"vault",
163+
/* GitHub CLI */
164+
"gh",
165+
/* AWS CLI */
166+
"aws",
167+
/*Azure CLI */
168+
"az",
169+
/*GCP CLI */
170+
"gcloud",
171+
/* Google Workspace CLI */
172+
"gws"
173+
) or
95174
process.executable : ("/tmp/*", "/private/tmp/*", "/var/tmp/*", "/dev/shm/*", "/run/*", "/var/run/*", "?:\\Users\\*")
96175
)
97176
'''

0 commit comments

Comments
 (0)