Skip to content

Commit 6c2ca3a

Browse files
Aegrahgithub-actions[bot]
authored andcommitted
[Rule Tuning] Q2 Linux DR Tuning - Part 4 (#4165)
(cherry picked from commit 42f6c8f)
1 parent 611e073 commit 6c2ca3a

10 files changed

+69
-67
lines changed

rules/linux/impact_potential_linux_ransomware_note_detected.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2023/03/20"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2024/07/18"
5+
updated_date = "2024/10/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -67,9 +67,8 @@ sequence by process.entity_id, host.id with maxspan=1s
6767
"systemsettings", "vmis-launcher", "bundle", "kudu-tserver", "suldownloader", "rustup-init"
6868
)
6969
] with runs=25
70-
[file where host.os.type == "linux" and event.action == "creation" and file.name : (
71-
"*crypt*", "*restore*", "*lock*", "*recovery*", "*data*", "*read*", "*instruction*", "*how_to*", "*ransom*"
72-
)
70+
[file where host.os.type == "linux" and event.action == "creation" and
71+
file.name : ("*restore*", "*lock*", "*recovery*", "*read*", "*instruction*", "*how_to*", "*ransom*")
7372
]
7473
'''
7574

rules/linux/persistence_apt_package_manager_file_creation.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/06/03"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2024/09/23"
5+
updated_date = "2024/10/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -83,6 +83,7 @@ file.path : "/etc/apt/apt.conf.d/*" and not (
8383
"/etc/kernel/*"
8484
) or
8585
process.executable == null or
86+
process.name in ("pveupdate", "perl") or
8687
(process.name == "sed" and file.name : "sed*") or
8788
(process.name == "perl" and file.name : "e2scrub_all.tmp*")
8889
)

rules/linux/persistence_chkconfig_service_add.toml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2022/07/22"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/10/17"
66

77
[transform]
88
[[transform.osquery]]
@@ -172,33 +172,27 @@ tags = [
172172
]
173173
timestamp_override = "event.ingested"
174174
type = "eql"
175-
176175
query = '''
177176
process where host.os.type == "linux" and event.action in ("exec", "exec_event") and
178177
(
179178
(process.executable : "/usr/sbin/chkconfig" and process.args : "--add") or
180179
(process.args : "*chkconfig" and process.args : "--add")
181-
) and
182-
not process.parent.name in ("rpm", "qualys-scan-util", "qualys-cloud-agent", "update-alternatives") and
183-
not process.parent.args : ("/var/tmp/rpm*", "/var/lib/waagent/*")
180+
) and not (
181+
process.parent.name in ("rpm", "qualys-scan-util", "qualys-cloud-agent", "update-alternatives") or
182+
process.parent.args : ("/var/tmp/rpm*", "/var/lib/waagent/*") or
183+
process.args in ("jexec", "sapinit", "httpd", "dbora")
184+
)
184185
'''
185186

186-
187187
[[rule.threat]]
188188
framework = "MITRE ATT&CK"
189+
189190
[[rule.threat.technique]]
190191
id = "T1037"
191192
name = "Boot or Logon Initialization Scripts"
192193
reference = "https://attack.mitre.org/techniques/T1037/"
193-
[[rule.threat.technique.subtechnique]]
194-
id = "T1037.004"
195-
name = "RC Scripts"
196-
reference = "https://attack.mitre.org/techniques/T1037/004/"
197-
198-
199194

200195
[rule.threat.tactic]
201196
id = "TA0003"
202197
name = "Persistence"
203198
reference = "https://attack.mitre.org/tactics/TA0003/"
204-

rules/linux/persistence_credential_access_modify_ssh_binaries.toml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/12/21"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2024/05/21"
5+
updated_date = "2024/10/17"
66

77
[transform]
88
[[transform.osquery]]
@@ -166,59 +166,62 @@ event.category:file and host.os.type:linux and event.type:change and
166166
/usr/bin/ssh or
167167
/usr/sbin/sshd) or
168168
file.name:libkeyutils.so) and
169-
not process.executable:/usr/share/elasticsearch/*
169+
not (
170+
process.executable:/usr/share/elasticsearch/* or
171+
process.name : (apk or ansible-admin or systemd or dnf or python*)
172+
)
170173
'''
171174

172-
173175
[[rule.threat]]
174176
framework = "MITRE ATT&CK"
177+
175178
[[rule.threat.technique]]
176179
id = "T1543"
177180
name = "Create or Modify System Process"
178181
reference = "https://attack.mitre.org/techniques/T1543/"
179182

180-
181183
[rule.threat.tactic]
182184
id = "TA0003"
183185
name = "Persistence"
184186
reference = "https://attack.mitre.org/tactics/TA0003/"
187+
185188
[[rule.threat]]
186189
framework = "MITRE ATT&CK"
190+
187191
[[rule.threat.technique]]
188192
id = "T1556"
189193
name = "Modify Authentication Process"
190194
reference = "https://attack.mitre.org/techniques/T1556/"
191195

192-
193196
[rule.threat.tactic]
194197
id = "TA0006"
195198
name = "Credential Access"
196199
reference = "https://attack.mitre.org/tactics/TA0006/"
200+
197201
[[rule.threat]]
198202
framework = "MITRE ATT&CK"
203+
199204
[[rule.threat.technique]]
200205
id = "T1021"
201206
name = "Remote Services"
202207
reference = "https://attack.mitre.org/techniques/T1021/"
208+
203209
[[rule.threat.technique.subtechnique]]
204210
id = "T1021.004"
205211
name = "SSH"
206212
reference = "https://attack.mitre.org/techniques/T1021/004/"
207213

208-
209214
[[rule.threat.technique]]
210215
id = "T1563"
211216
name = "Remote Service Session Hijacking"
212217
reference = "https://attack.mitre.org/techniques/T1563/"
218+
213219
[[rule.threat.technique.subtechnique]]
214220
id = "T1563.001"
215221
name = "SSH Hijacking"
216222
reference = "https://attack.mitre.org/techniques/T1563/001/"
217223

218-
219-
220224
[rule.threat.tactic]
221225
id = "TA0008"
222226
name = "Lateral Movement"
223227
reference = "https://attack.mitre.org/tactics/TA0008/"
224-

rules/linux/persistence_cron_job_creation.toml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2023/06/09"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2024/09/23"
5+
updated_date = "2024/10/17"
66

77
[transform]
88
[[transform.osquery]]
@@ -195,69 +195,72 @@ event.action in ("rename", "creation") and file.path : (
195195
"/opt/puppetlabs/puppet/bin/ruby", "/usr/libexec/platform-python", "/opt/imunify360/venv/bin/python3",
196196
"/opt/eset/efs/lib/utild", "/usr/sbin/anacron", "/usr/bin/podman", "/kaniko/kaniko-executor"
197197
) or
198-
file.path : "/var/spool/cron/crontabs/tmp.*" or
198+
file.path like ("/var/spool/cron/crontabs/tmp.*", "/etc/cron.d/jumpcloud-updater") or
199199
file.extension in ("swp", "swpx", "swx", "dpkg-remove") or
200200
file.Ext.original.extension == "dpkg-new" or
201201
process.executable : (
202202
"/nix/store/*", "/var/lib/dpkg/*", "/tmp/vmis.*", "/snap/*", "/dev/fd/*", "/usr/libexec/platform-python*"
203203
) or
204204
process.executable == null or
205-
process.name in ("crontab", "crond", "executor", "puppet", "droplet-agent.postinst", "cf-agent") or
205+
process.name in (
206+
"crond", "executor", "puppet", "droplet-agent.postinst", "cf-agent", "schedd", "imunify-notifier", "perl",
207+
"jumpcloud-agent", "crio", "dnf_install", "utild"
208+
) or
206209
(process.name == "sed" and file.name : "sed*") or
207210
(process.name == "perl" and file.name : "e2scrub_all.tmp*")
208211
)
209212
'''
210213

211-
212214
[[rule.threat]]
213215
framework = "MITRE ATT&CK"
216+
214217
[[rule.threat.technique]]
215218
id = "T1053"
216219
name = "Scheduled Task/Job"
217220
reference = "https://attack.mitre.org/techniques/T1053/"
221+
218222
[[rule.threat.technique.subtechnique]]
219223
id = "T1053.003"
220224
name = "Cron"
221225
reference = "https://attack.mitre.org/techniques/T1053/003/"
222226

223-
224-
225227
[rule.threat.tactic]
226228
id = "TA0003"
227229
name = "Persistence"
228230
reference = "https://attack.mitre.org/tactics/TA0003/"
231+
229232
[[rule.threat]]
230233
framework = "MITRE ATT&CK"
234+
231235
[[rule.threat.technique]]
232236
id = "T1053"
233237
name = "Scheduled Task/Job"
234238
reference = "https://attack.mitre.org/techniques/T1053/"
239+
235240
[[rule.threat.technique.subtechnique]]
236241
id = "T1053.003"
237242
name = "Cron"
238243
reference = "https://attack.mitre.org/techniques/T1053/003/"
239244

240-
241-
242245
[rule.threat.tactic]
243246
id = "TA0004"
244247
name = "Privilege Escalation"
245248
reference = "https://attack.mitre.org/tactics/TA0004/"
249+
246250
[[rule.threat]]
247251
framework = "MITRE ATT&CK"
252+
248253
[[rule.threat.technique]]
249254
id = "T1053"
250255
name = "Scheduled Task/Job"
251256
reference = "https://attack.mitre.org/techniques/T1053/"
257+
252258
[[rule.threat.technique.subtechnique]]
253259
id = "T1053.003"
254260
name = "Cron"
255261
reference = "https://attack.mitre.org/techniques/T1053/003/"
256262

257-
258-
259263
[rule.threat.tactic]
260264
id = "TA0002"
261265
name = "Execution"
262266
reference = "https://attack.mitre.org/tactics/TA0002/"
263-

rules/linux/persistence_dpkg_unusual_execution.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/07/09"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2024/07/09"
5+
updated_date = "2024/10/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -60,7 +60,8 @@ process.executable : "/var/lib/dpkg/info/*" and process.session_leader.name != n
6060
process.group_leader.name != null and not (
6161
process.parent.name in ("dpkg", "dpkg-reconfigure") or
6262
process.session_leader.name == "dpkg" or
63-
process.group_leader.name == "dpkg"
63+
process.group_leader.name == "dpkg" or
64+
process.parent.executable in ("/usr/share/debconf/frontend", "/usr/bin/unattended-upgrade")
6465
)
6566
'''
6667

rules/linux/persistence_git_hook_file_creation.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/06/26"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2024/09/23"
5+
updated_date = "2024/10/17"
66

77
[rule]
88
author = ["Elastic"]
@@ -75,15 +75,15 @@ file.extension == null and process.executable != null and not (
7575
"/usr/local/bin/dockerd", "/sbin/dockerd"
7676
) or
7777
process.executable : ("/nix/store/*", "/var/lib/dpkg/*", "/snap/*", "/dev/fd/*") or
78-
process.name in ("git", "dirname") or
78+
process.name in ("git", "dirname", "tar", "gitea", "git-lfs") or
7979
(process.name == "sed" and file.name : "sed*") or
8080
(process.name == "perl" and file.name : "e2scrub_all.tmp*")
8181
)
8282
'''
8383

84-
8584
[[rule.threat]]
8685
framework = "MITRE ATT&CK"
86+
8787
[[rule.threat.technique]]
8888
id = "T1543"
8989
name = "Create or Modify System Process"
@@ -94,33 +94,33 @@ id = "T1574"
9494
name = "Hijack Execution Flow"
9595
reference = "https://attack.mitre.org/techniques/T1574/"
9696

97-
9897
[rule.threat.tactic]
9998
id = "TA0003"
10099
name = "Persistence"
101100
reference = "https://attack.mitre.org/tactics/TA0003/"
101+
102102
[[rule.threat]]
103103
framework = "MITRE ATT&CK"
104+
104105
[[rule.threat.technique]]
105106
id = "T1059"
106107
name = "Command and Scripting Interpreter"
107108
reference = "https://attack.mitre.org/techniques/T1059/"
109+
108110
[[rule.threat.technique.subtechnique]]
109111
id = "T1059.004"
110112
name = "Unix Shell"
111113
reference = "https://attack.mitre.org/techniques/T1059/004/"
112114

113-
114-
115115
[rule.threat.tactic]
116116
id = "TA0002"
117117
name = "Execution"
118118
reference = "https://attack.mitre.org/tactics/TA0002/"
119+
119120
[[rule.threat]]
120121
framework = "MITRE ATT&CK"
121122

122123
[rule.threat.tactic]
123124
id = "TA0005"
124125
name = "Defense Evasion"
125126
reference = "https://attack.mitre.org/tactics/TA0005/"
126-

rules/linux/persistence_init_d_file_creation.toml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2023/03/21"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2024/09/23"
5+
updated_date = "2024/10/17"
66

77
[transform]
88
[[transform.osquery]]
@@ -166,26 +166,25 @@ and file.path : "/etc/init.d/*" and not (
166166
"/bin/pamac-daemon", "/usr/lib/snapd/snapd", "/usr/local/bin/dockerd"
167167
) or
168168
file.extension in ("swp", "swpx", "swx", "dpkg-remove") or
169-
process.executable : (
170-
"/nix/store/*", "/var/lib/dpkg/*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*"
171-
) or
169+
file.path like ("/etc/init.d/*beat*", "/etc/init.d/elastic-agent*") or
170+
process.executable like ("/nix/store/*", "/var/lib/dpkg/*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*") or
171+
process.name in ("docker-init", "jumpcloud-agent", "crio") or
172172
process.executable == null or
173+
(process.name == "ln" and file.path : "/etc/init.d/rc*.d/*") or
173174
(process.name == "sed" and file.name : "sed*") or
174175
(process.name == "perl" and file.name : "e2scrub_all.tmp*")
175176
)
176177
'''
177178

178-
179179
[[rule.threat]]
180180
framework = "MITRE ATT&CK"
181+
181182
[[rule.threat.technique]]
182183
id = "T1037"
183184
name = "Boot or Logon Initialization Scripts"
184185
reference = "https://attack.mitre.org/techniques/T1037/"
185186

186-
187187
[rule.threat.tactic]
188188
id = "TA0003"
189189
name = "Persistence"
190190
reference = "https://attack.mitre.org/tactics/TA0003/"
191-

0 commit comments

Comments
 (0)