Skip to content

Commit 633654c

Browse files
authored
Merge branch 'main' into trade_genai_critical_high_rules
2 parents 6da7b38 + 57f18a1 commit 633654c

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
[metadata]
2+
creation_date = "2025/12/09"
3+
integration = ["github"]
4+
maturity = "production"
5+
updated_date = "2025/12/09"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
Detects when the github-actions[bot] pushes code to a repository where it has not performed this behavior before in a certain time window. This may
11+
indicate a supply chain attack where malicious code running in a CI workflow attempts to modify repository contents,
12+
such as injecting backdoor workflow files.
13+
"""
14+
false_positives = [
15+
"""
16+
Legitimate CI/CD automation that commits and pushes changes (e.g., auto-formatting, changelog updates, version
17+
bumps, Dependabot auto-merge) will trigger this alert on first use in a repository. Review the repository's
18+
workflow configurations to determine if bot pushes are expected.
19+
""",
20+
]
21+
from = "now-9m"
22+
index = ["logs-github.audit-*"]
23+
language = "kuery"
24+
license = "Elastic License v2"
25+
name = "GitHub Actions Unusual Bot Push to Repository"
26+
note = """## Triage and analysis
27+
28+
### Investigating GitHub Actions Unusual Bot Push to Repository
29+
30+
This rule detects when the GitHub Actions bot pushes to a repository where it hasn't pushed to in a certain time interval. While this can be
31+
legitimate automation, it may also indicate a supply chain attack where malicious code executes during CI and attempts
32+
to modify repository contents.
33+
34+
### Possible investigation steps
35+
36+
- Review the `github.repo` field to identify the affected repository.
37+
- Check recent workflow runs in the repository to identify which workflow triggered the push.
38+
- Examine the repository's commit history to see what files were modified by the bot push.
39+
- Look for newly added or modified files in `.github/workflows/` directory.
40+
- Review the repository's dependencies for recently added or updated packages with preinstall/postinstall hooks.
41+
- Check if the repository has legitimate automation that would explain bot pushes (Dependabot, Renovate, release automation).
42+
- Correlate with `protected_branch.rejected_ref_update` events to see if workflow injection was blocked.
43+
- Search for other repositories in the organization with similar suspicious activity.
44+
45+
### False positive analysis
46+
47+
- Repositories with auto-commit workflows (formatting, changelog generation, version bumps) will trigger on first run.
48+
- Dependabot or Renovate auto-merge configurations cause legitimate bot pushes.
49+
- GitHub Pages deployment workflows may push to gh-pages branches.
50+
- Release automation that updates version files or generates artifacts.
51+
52+
### Response and remediation
53+
54+
- If the push is unexpected, immediately review the commit contents for malicious files.
55+
- Check for suspicious workflow files (e.g., `discussion_*.yaml`, `formatter_*.yml`).
56+
- Audit all dependencies in the affected repository for malicious packages.
57+
- Rotate any secrets that may have been exposed during the workflow run.
58+
- Enable branch protection rules to require PR reviews for all changes.
59+
- Consider restricting GITHUB_TOKEN permissions in workflow files using `permissions:` key.
60+
"""
61+
references = [
62+
"https://www.wiz.io/blog/shai-hulud-2-0-ongoing-supply-chain-attack",
63+
"https://www.elastic.co/blog/shai-hulud-worm-npm-supply-chain-compromise",
64+
]
65+
risk_score = 21
66+
rule_id = "03245b25-3849-4052-ab48-72de65a82c35"
67+
severity = "low"
68+
tags = [
69+
"Domain: Cloud",
70+
"Use Case: Threat Detection",
71+
"Tactic: Initial Access",
72+
"Tactic: Persistence",
73+
"Data Source: Github",
74+
"Resources: Investigation Guide",
75+
]
76+
timestamp_override = "event.ingested"
77+
type = "new_terms"
78+
79+
query = '''
80+
event.dataset: "github.audit" and
81+
event.action: "git.push" and
82+
user.name: "github-actions[bot]"
83+
'''
84+
85+
[[rule.threat]]
86+
framework = "MITRE ATT&CK"
87+
[[rule.threat.technique]]
88+
id = "T1195"
89+
name = "Supply Chain Compromise"
90+
reference = "https://attack.mitre.org/techniques/T1195/"
91+
[[rule.threat.technique.subtechnique]]
92+
id = "T1195.002"
93+
name = "Compromise Software Supply Chain"
94+
reference = "https://attack.mitre.org/techniques/T1195/002/"
95+
96+
[rule.threat.tactic]
97+
id = "TA0001"
98+
name = "Initial Access"
99+
reference = "https://attack.mitre.org/tactics/TA0001/"
100+
101+
[[rule.threat]]
102+
framework = "MITRE ATT&CK"
103+
[[rule.threat.technique]]
104+
id = "T1059"
105+
name = "Command and Scripting Interpreter"
106+
reference = "https://attack.mitre.org/techniques/T1059/"
107+
108+
[rule.threat.tactic]
109+
id = "TA0002"
110+
name = "Execution"
111+
reference = "https://attack.mitre.org/tactics/TA0002/"
112+
113+
[rule.new_terms]
114+
field = "new_terms_fields"
115+
value = ["github.org_id", "github.repo"]
116+
117+
[[rule.new_terms.history_window_start]]
118+
field = "history_window_start"
119+
value = "now-7d"

0 commit comments

Comments
 (0)