Skip to content

Commit 9f57937

Browse files
authored
[New Rule] GitHub Authentication Token Access via Node.js (#5130)
1 parent 1636a8f commit 9f57937

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[metadata]
2+
creation_date = "2025/09/18"
3+
integration = ["endpoint"]
4+
maturity = "production"
5+
updated_date = "2025/09/18"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
This rule detects when the Node.js runtime spawns a shell to execute the GitHub CLI (gh) command to retrieve
11+
a GitHub authentication token. The GitHub CLI is a command-line tool that allows users to interact with
12+
GitHub from the terminal. The "gh auth token" command is used to retrieve an authentication token for
13+
GitHub, which can be used to authenticate API requests and perform actions on behalf of the user. Adversaries
14+
may use this technique to access GitHub repositories and potentially exfiltrate sensitive information or
15+
perform malicious actions. This activity was observed in the wild as part of the Shai-Hulud worm.
16+
"""
17+
from = "now-9m"
18+
index = ["logs-endpoint.events.process*"]
19+
language = "eql"
20+
license = "Elastic License v2"
21+
name = "GitHub Authentication Token Access via Node.js"
22+
references = ["https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise"]
23+
risk_score = 47
24+
rule_id = "e5d69377-f8cf-4e8f-8328-690822cd012a"
25+
setup = """## Setup
26+
27+
This rule requires data coming in from Elastic Defend.
28+
29+
### Elastic Defend Integration Setup
30+
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.
31+
32+
#### Prerequisite Requirements:
33+
- Fleet is required for Elastic Defend.
34+
- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
35+
36+
#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
37+
- Go to the Kibana home page and click "Add integrations".
38+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
39+
- Click "Add Elastic Defend".
40+
- Configure the integration name and optionally add a description.
41+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
42+
- 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).
43+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
44+
- 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.
45+
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).
46+
- Click "Save and Continue".
47+
- 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.
48+
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
49+
"""
50+
severity = "medium"
51+
tags = [
52+
"Domain: Endpoint",
53+
"OS: Linux",
54+
"Use Case: Threat Detection",
55+
"Tactic: Credential Access",
56+
"Tactic: Discovery",
57+
"Data Source: Elastic Defend",
58+
"Resources: Investigation Guide",
59+
]
60+
timestamp_override = "event.ingested"
61+
type = "eql"
62+
query = '''
63+
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.parent.name == "node" and
64+
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and process.args == "gh auth token"
65+
'''
66+
67+
[[rule.threat]]
68+
framework = "MITRE ATT&CK"
69+
70+
[[rule.threat.technique]]
71+
id = "T1552"
72+
name = "Unsecured Credentials"
73+
reference = "https://attack.mitre.org/techniques/T1552/"
74+
75+
[[rule.threat.technique]]
76+
id = "T1528"
77+
name = "Steal Application Access Token"
78+
reference = "https://attack.mitre.org/techniques/T1528/"
79+
80+
[rule.threat.tactic]
81+
id = "TA0006"
82+
name = "Credential Access"
83+
reference = "https://attack.mitre.org/tactics/TA0006/"
84+
85+
[[rule.threat]]
86+
framework = "MITRE ATT&CK"
87+
88+
[[rule.threat.technique]]
89+
id = "T1613"
90+
name = "Container and Resource Discovery"
91+
reference = "https://attack.mitre.org/techniques/T1613/"
92+
93+
[rule.threat.tactic]
94+
id = "TA0007"
95+
name = "Discovery"
96+
reference = "https://attack.mitre.org/tactics/TA0007/"

0 commit comments

Comments
 (0)