Skip to content

Commit 4fa4c3b

Browse files
Aegrahgithub-actions[bot]
authored andcommitted
[Rule Tuning] Q2 Linux DR Tuning - Part 2 (#4163)
(cherry picked from commit 3982228)
1 parent e03b77a commit 4fa4c3b

10 files changed

+67
-76
lines changed

rules/linux/defense_evasion_kernel_module_removal.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -61,46 +61,45 @@ tags = [
6161
]
6262
timestamp_override = "event.ingested"
6363
type = "eql"
64-
6564
query = '''
66-
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and
67-
process.name == "rmmod" or (process.name == "modprobe" and process.args in ("--remove", "-r")) and
68-
process.parent.name in ("sudo", "bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
65+
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and (
66+
process.name == "rmmod" or
67+
(process.name == "modprobe" and process.args in ("--remove", "-r"))
68+
) and process.parent.name in ("sudo", "bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")
6969
'''
7070

71-
7271
[[rule.threat]]
7372
framework = "MITRE ATT&CK"
73+
7474
[[rule.threat.technique]]
7575
id = "T1562"
7676
name = "Impair Defenses"
7777
reference = "https://attack.mitre.org/techniques/T1562/"
78+
7879
[[rule.threat.technique.subtechnique]]
7980
id = "T1562.001"
8081
name = "Disable or Modify Tools"
8182
reference = "https://attack.mitre.org/techniques/T1562/001/"
8283

83-
84-
8584
[rule.threat.tactic]
8685
id = "TA0005"
8786
name = "Defense Evasion"
8887
reference = "https://attack.mitre.org/tactics/TA0005/"
88+
8989
[[rule.threat]]
9090
framework = "MITRE ATT&CK"
91+
9192
[[rule.threat.technique]]
9293
id = "T1547"
9394
name = "Boot or Logon Autostart Execution"
9495
reference = "https://attack.mitre.org/techniques/T1547/"
96+
9597
[[rule.threat.technique.subtechnique]]
9698
id = "T1547.006"
9799
name = "Kernel Modules and Extensions"
98100
reference = "https://attack.mitre.org/techniques/T1547/006/"
99101

100-
101-
102102
[rule.threat.tactic]
103103
id = "TA0003"
104104
name = "Persistence"
105105
reference = "https://attack.mitre.org/tactics/TA0003/"
106-

rules/linux/defense_evasion_mount_execution.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -60,24 +60,22 @@ tags = [
6060
]
6161
timestamp_override = "event.ingested"
6262
type = "eql"
63-
6463
query = '''
65-
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
66-
and process.name == "mount" and process.args == "/proc" and process.args == "-o" and
67-
process.args : "*hidepid=2*"
64+
process where host.os.type == "linux" and event.type == "start" and
65+
event.action in ("exec", "exec_event", "executed", "process_started") and
66+
process.name == "mount" and process.args == "/proc" and process.args == "-o" and process.args : "*hidepid=2*" and
67+
not process.parent.command_line like "/opt/cloudlinux/*"
6868
'''
6969

70-
7170
[[rule.threat]]
7271
framework = "MITRE ATT&CK"
72+
7373
[[rule.threat.technique]]
7474
id = "T1564"
7575
name = "Hide Artifacts"
7676
reference = "https://attack.mitre.org/techniques/T1564/"
7777

78-
7978
[rule.threat.tactic]
8079
id = "TA0005"
8180
name = "Defense Evasion"
8281
reference = "https://attack.mitre.org/tactics/TA0005/"
83-

rules/linux/defense_evasion_root_certificate_installation.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -58,10 +58,11 @@ type = "eql"
5858
query = '''
5959
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
6060
process.name in ("update-ca-trust", "update-ca-certificates") and not (
61-
process.parent.name : (
62-
"ca-certificates.postinst", "ca-certificates-*.trigger", "pacman", "pamac-daemon", "autofirma.postinst"
61+
process.parent.name like (
62+
"ca-certificates.postinst", "ca-certificates-*.trigger", "pacman", "pamac-daemon", "autofirma.postinst",
63+
"ipa-client-install", "su", "platform-python", "python*", "kesl", "execd"
6364
) or
64-
process.parent.args : "/var/tmp/rpm*" or
65+
process.parent.args like "/var/tmp/rpm*" or
6566
(process.parent.name in ("sh", "bash", "zsh") and process.args == "-e")
6667
)
6768
'''

rules/linux/defense_evasion_sus_utility_executed_via_tmux_or_screen.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -29,26 +29,23 @@ tags = [
2929
]
3030
timestamp_override = "event.ingested"
3131
type = "eql"
32-
3332
query = '''
3433
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and
35-
process.parent.name in ("screen", "tmux") and process.name : (
36-
"nmap", "nc", "ncat", "netcat", "socat", "nc.openbsd", "ngrok", "ping", "java", "python*", "php*", "perl", "ruby",
37-
"lua*", "openssl", "telnet", "awk", "wget", "curl", "id"
38-
)
34+
process.parent.name in ("screen", "tmux") and process.name like (
35+
"nmap", "nc", "ncat", "netcat", "socat", "nc.openbsd", "ngrok", "ping", "java", "php*", "perl", "ruby", "lua*",
36+
"openssl", "telnet", "wget", "curl", "id"
37+
)
3938
'''
4039

41-
4240
[[rule.threat]]
4341
framework = "MITRE ATT&CK"
42+
4443
[[rule.threat.technique]]
4544
id = "T1218"
4645
name = "System Binary Proxy Execution"
4746
reference = "https://attack.mitre.org/techniques/T1218/"
4847

49-
5048
[rule.threat.tactic]
5149
id = "TA0005"
5250
name = "Defense Evasion"
5351
reference = "https://attack.mitre.org/tactics/TA0005/"
54-

rules/linux/discovery_esxi_software_via_find.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -59,23 +59,22 @@ tags = [
5959
]
6060
timestamp_override = "event.ingested"
6161
type = "eql"
62-
6362
query = '''
64-
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
65-
and process.name == "find" and process.args : ("/etc/vmware/*", "/usr/lib/vmware/*", "/vmfs/*")
63+
process where host.os.type == "linux" and event.type == "start" and
64+
event.action in ("exec", "exec_event", "executed", "process_started") and process.name == "find" and
65+
process.args : ("/etc/vmware/*", "/usr/lib/vmware/*", "/vmfs/*") and
66+
not process.parent.executable == "/usr/lib/vmware/viewagent/bin/uninstall_viewagent.sh"
6667
'''
6768

68-
6969
[[rule.threat]]
7070
framework = "MITRE ATT&CK"
71+
7172
[[rule.threat.technique]]
7273
id = "T1518"
7374
name = "Software Discovery"
7475
reference = "https://attack.mitre.org/techniques/T1518/"
7576

76-
7777
[rule.threat.tactic]
7878
id = "TA0007"
7979
name = "Discovery"
8080
reference = "https://attack.mitre.org/tactics/TA0007/"
81-

rules/linux/discovery_esxi_software_via_grep.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -59,25 +59,23 @@ tags = [
5959
]
6060
timestamp_override = "event.ingested"
6161
type = "eql"
62-
6362
query = '''
64-
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
65-
and process.name in ("grep", "egrep", "pgrep") and process.args in (
66-
"vmdk", "vmx", "vmxf", "vmsd", "vmsn", "vswp", "vmss", "nvram", "vmem"
67-
)
63+
process where host.os.type == "linux" and event.type == "start" and
64+
event.action in ("exec", "exec_event", "executed", "process_started") and
65+
process.name in ("grep", "egrep", "pgrep") and
66+
process.args in ("vmdk", "vmx", "vmxf", "vmsd", "vmsn", "vswp", "vmss", "nvram", "vmem") and
67+
not process.parent.executable == "/usr/share/qemu/init/qemu-kvm-init"
6868
'''
6969

70-
7170
[[rule.threat]]
7271
framework = "MITRE ATT&CK"
72+
7373
[[rule.threat.technique]]
7474
id = "T1518"
7575
name = "Software Discovery"
7676
reference = "https://attack.mitre.org/techniques/T1518/"
7777

78-
7978
[rule.threat.tactic]
8079
id = "TA0007"
8180
name = "Discovery"
8281
reference = "https://attack.mitre.org/tactics/TA0007/"
83-

rules/linux/discovery_kernel_module_enumeration.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -66,30 +66,33 @@ event.category:process and host.os.type:linux and event.type:start and event.act
6666
(process.name:(lsmod or modinfo)) or
6767
(process.name:kmod and process.args:list) or
6868
(process.name:depmod and process.args:(--all or -a))
69-
) and not process.parent.name:(mkinitramfs or cryptroot or framebuffer or dracut or jem or thin-provisioning-tools
70-
or readykernel or lvm2 or vz-start or iscsi or mdadm or ovalprobes or bcache or plymouth or dkms or overlayroot or
71-
weak-modules or zfs)
69+
) and
70+
not (
71+
process.parent.name:(
72+
mkinitramfs or cryptroot or framebuffer or dracut or jem or thin-provisioning-tools or readykernel or lvm2 or
73+
vz-start or iscsi or mdadm or ovalprobes or bcache or plymouth or dkms or overlayroot or weak-modules or zfs or
74+
systemd or whoopsie-upload-all or kdumpctl or apport-gtk or casper or rear or kernel-install
75+
)
76+
)
7277
'''
7378

74-
7579
[[rule.threat]]
7680
framework = "MITRE ATT&CK"
81+
7782
[[rule.threat.technique]]
7883
id = "T1082"
7984
name = "System Information Discovery"
8085
reference = "https://attack.mitre.org/techniques/T1082/"
8186

82-
8387
[rule.threat.tactic]
8488
id = "TA0007"
8589
name = "Discovery"
8690
reference = "https://attack.mitre.org/tactics/TA0007/"
8791

8892
[rule.new_terms]
8993
field = "new_terms_fields"
90-
value = ["process.parent.command_line", "process.command_line", "host.id"]
94+
value = ["process.executable", "process.parent.executable"]
95+
9196
[[rule.new_terms.history_window_start]]
9297
field = "history_window_start"
9398
value = "now-14d"
94-
95-

rules/linux/discovery_pspy_process_monitoring_detected.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -53,16 +53,17 @@ tags = [
5353
"Tactic: Discovery",
5454
]
5555
type = "eql"
56-
5756
query = '''
5857
sequence by process.pid, host.id with maxspan=5s
5958
[file where host.os.type == "linux" and auditd.data.syscall == "openat" and file.path == "/proc" and
60-
auditd.data.a0 : ("ffffffffffffff9c", "ffffff9c") and auditd.data.a2 : ("80000", "88000") ] with runs=10
59+
auditd.data.a0 : ("ffffffffffffff9c", "ffffff9c") and auditd.data.a2 : ("80000", "88000") and
60+
not process.name == "agentbeat"
61+
] with runs=10
6162
'''
6263

63-
6464
[[rule.threat]]
6565
framework = "MITRE ATT&CK"
66+
6667
[[rule.threat.technique]]
6768
id = "T1057"
6869
name = "Process Discovery"
@@ -73,9 +74,7 @@ id = "T1082"
7374
name = "System Information Discovery"
7475
reference = "https://attack.mitre.org/techniques/T1082/"
7576

76-
7777
[rule.threat.tactic]
7878
id = "TA0007"
7979
name = "Discovery"
8080
reference = "https://attack.mitre.org/tactics/TA0007/"
81-

rules/linux/discovery_sudo_allowed_command_enumeration.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -53,25 +53,22 @@ tags = [
5353
]
5454
timestamp_override = "event.ingested"
5555
type = "eql"
56-
5756
query = '''
5857
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
5958
process.name == "sudo" and process.args == "-l" and process.args_count == 2 and
6059
process.parent.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
61-
not group.Ext.real.id : "0" and not user.Ext.real.id : "0" and not process.args == "dpkg"
60+
not process.args == "dpkg"
6261
'''
6362

64-
6563
[[rule.threat]]
6664
framework = "MITRE ATT&CK"
65+
6766
[[rule.threat.technique]]
6867
id = "T1033"
6968
name = "System Owner/User Discovery"
7069
reference = "https://attack.mitre.org/techniques/T1033/"
7170

72-
7371
[rule.threat.tactic]
7472
id = "TA0007"
7573
name = "Discovery"
7674
reference = "https://attack.mitre.org/tactics/TA0007/"
77-

0 commit comments

Comments
 (0)