Skip to content

Commit 3d83e47

Browse files
committed
[New Rule] Execution via GitHub Runner with Audit Disabled via Environment Variables
1 parent c3d0916 commit 3d83e47

File tree

1 file changed

+134
-0
lines changed

1 file changed

+134
-0
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
[metadata]
2+
creation_date = "2025/11/27"
3+
integration = ["endpoint"]
4+
maturity = "production"
5+
updated_date = "2025/11/27"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
This rule detects the execution of processes via GitHub Actions runners with audit logging disabled through environment variables.
11+
Such activity may indicate an attempt to evade detection while executing potentially malicious code in a CI/CD environment. This
12+
activity was observed in the Shai-Hulud worm, which abused GitHub Actions runners to propagate itself while disabling audit
13+
logging by setting the RUNNER_TRACKING_ID environment variable to 0.
14+
"""
15+
from = "now-9m"
16+
index = ["logs-endpoint.events.process*"]
17+
language = "eql"
18+
license = "Elastic License v2"
19+
name = "Execution via GitHub Runner with Audit Disabled via Environment Variables"
20+
references = [
21+
"https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
22+
"https://socket.dev/blog/shai-hulud-strikes-again-v2",
23+
"https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack",
24+
]
25+
risk_score = 73
26+
rule_id = "df0553c8-2296-45ef-b4dc-3b88c4c130a7"
27+
setup = """## Setup
28+
29+
This rule requires data coming in from Elastic Defend.
30+
31+
### Elastic Defend Integration Setup
32+
Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
33+
34+
#### Prerequisite Requirements:
35+
- Fleet is required for Elastic Defend.
36+
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
37+
38+
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
39+
- Go to the Kibana home page and click "Add integrations".
40+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
41+
- Click "Add Elastic Defend".
42+
- Configure the integration name and optionally add a description.
43+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
44+
- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
45+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
46+
- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
47+
For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
48+
- Click "Save and Continue".
49+
- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
50+
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
51+
52+
Elastic Defend integration does not collect environment variable logging by default.
53+
In order to capture this behavior, this rule requires a specific configuration option set within the advanced settings of the Elastic Defend integration.
54+
#### To set up environment variable capture for an Elastic Agent policy:
55+
- Go to “Security → Manage → Policies”.
56+
- Select an “Elastic Agent policy”.
57+
- Click “Show advanced settings”.
58+
- Scroll down or search for “linux.advanced.capture_env_vars”.
59+
- Enter the names of environment variables you want to capture, separated by commas.
60+
- For Linux, this rule requires the linux.advanced.capture_env_vars variable to be set to "RUNNER_TRACKING_ID".
61+
- For macOS, this rule requires the macos.advanced.capture_env_vars variable to be set to "RUNNER_TRACKING_ID".
62+
- Click “Save”.
63+
After saving the integration change, the Elastic Agents running this policy will be updated and the rule will function properly.
64+
For more information on capturing environment variables refer to the [helper guide](https://www.elastic.co/guide/en/security/current/environment-variable-capture.html).
65+
"""
66+
severity = "high"
67+
tags = [
68+
"Domain: Endpoint",
69+
"OS: Linux",
70+
"OS: MacOS",
71+
"Use Case: Threat Detection",
72+
"Tactic: Execution",
73+
"Tactic: Initial Access",
74+
"Tactic: Defense Evasion",
75+
"Use Case: Vulnerability",
76+
"Data Source: Elastic Defend",
77+
"Resources: Investigation Guide",
78+
]
79+
type = "eql"
80+
query = '''
81+
process where host.os.type in ("linux", "macos") and event.type == "start" and event.action == "exec" and
82+
process.parent.name in ("Runner.Worker", "Runner.Listener") and process.env_vars like~ "RUNNER_TRACKING_ID*" and
83+
not process.env_vars like~ "RUNNER_TRACKING_ID=github_*"
84+
'''
85+
86+
[[rule.threat]]
87+
framework = "MITRE ATT&CK"
88+
89+
[rule.threat.tactic]
90+
name = "Execution"
91+
id = "TA0002"
92+
reference = "https://attack.mitre.org/tactics/TA0002/"
93+
94+
[[rule.threat.technique]]
95+
id = "T1059"
96+
name = "Command and Scripting Interpreter"
97+
reference = "https://attack.mitre.org/techniques/T1059/"
98+
99+
[[rule.threat]]
100+
framework = "MITRE ATT&CK"
101+
102+
[rule.threat.tactic]
103+
name = "Initial Access"
104+
id = "TA0001"
105+
reference = "https://attack.mitre.org/tactics/TA0001/"
106+
107+
[[rule.threat.technique]]
108+
name = "Supply Chain Compromise"
109+
id = "T1195"
110+
reference = "https://attack.mitre.org/techniques/T1195/"
111+
112+
[[rule.threat.technique.subtechnique]]
113+
name = "Compromise Software Dependencies and Development Tools"
114+
id = "T1195.001"
115+
reference = "https://attack.mitre.org/techniques/T1195/001/"
116+
117+
118+
[[rule.threat]]
119+
framework = "MITRE ATT&CK"
120+
121+
[rule.threat.tactic]
122+
name = "Defense Evasion"
123+
id = "TA0005"
124+
reference = "https://attack.mitre.org/tactics/TA0005/"
125+
126+
[[rule.threat.technique]]
127+
name = "Impair Defenses"
128+
id = "T1562"
129+
reference = "https://attack.mitre.org/techniques/T1562/"
130+
131+
[[rule.threat.technique.subtechnique]]
132+
name = "Disable or Modify Tools"
133+
id = "T1562.001"
134+
reference = "https://attack.mitre.org/techniques/T1562/001/"

0 commit comments

Comments
 (0)