Skip to content

Commit 83b9882

Browse files
committed
[Rule Tuning] Linux DR Tuning - 5
1 parent f43bf99 commit 83b9882

File tree

30 files changed

+280
-219
lines changed

30 files changed

+280
-219
lines changed

rules/linux/defense_evasion_hidden_directory_creation.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/11/01"
33
integration = ["endpoint", "sentinel_one_cloud_funnel"]
44
maturity = "production"
5-
updated_date = "2025/03/20"
5+
updated_date = "2025/12/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -98,44 +98,44 @@ tags = [
9898
]
9999
timestamp_override = "event.ingested"
100100
type = "eql"
101-
102101
query = '''
103102
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "start", "exec_event") and
104103
process.name == "mkdir" and process.parent.executable like (
105104
"/dev/shm/*", "/tmp/*", "/var/tmp/*", "/var/run/*", "/root/*", "/boot/*", "/var/www/html/*", "/opt/.*"
106-
) and process.args like (".*", "/*/.*") and process.args_count <= 3 and not (
107-
process.parent.executable like ("/tmp/newroot/*", "/run/containerd/*") or
105+
) and process.args like (".*", "/*/.*") and process.args_count <= 3 and
106+
not (
108107
process.command_line like ("mkdir -p .", "mkdir ./*") or
109-
process.args == "/root/.ssh" or
108+
process.args like ("/root/.ssh", "/home/*/.ssh", "/root/.cache/install4j") or
110109
process.parent.executable like (
111-
"/tmp/pear/temp/*", "/var/tmp/buildah*", "/tmp/python-build.*", "/tmp/cliphist-wofi-img", "/tmp/snap.rootfs_*"
112-
)
110+
"/tmp/pear/temp/*", "/var/tmp/buildah*", "/tmp/python-build.*", "/tmp/cliphist-wofi-img", "/tmp/snap.rootfs_*",
111+
"/root/.acme.sh/acme.sh", "/tmp/buildpacks/*go/bin/test-compile", "/tmp/newroot/*", "/run/containerd/*"
112+
) or
113+
process.parent.name in ("libtool", "jpenable", "configure")
113114
)
114115
'''
115116

116-
117117
[[rule.threat]]
118118
framework = "MITRE ATT&CK"
119+
119120
[[rule.threat.technique]]
120121
id = "T1564"
121122
name = "Hide Artifacts"
122123
reference = "https://attack.mitre.org/techniques/T1564/"
124+
123125
[[rule.threat.technique.subtechnique]]
124126
id = "T1564.001"
125127
name = "Hidden Files and Directories"
126128
reference = "https://attack.mitre.org/techniques/T1564/001/"
127129

128-
129-
130130
[rule.threat.tactic]
131131
id = "TA0005"
132132
name = "Defense Evasion"
133133
reference = "https://attack.mitre.org/tactics/TA0005/"
134+
134135
[[rule.threat]]
135136
framework = "MITRE ATT&CK"
136137

137138
[rule.threat.tactic]
138139
id = "TA0003"
139140
name = "Persistence"
140141
reference = "https://attack.mitre.org/tactics/TA0003/"
141-

rules/linux/defense_evasion_hidden_file_dir_tmp.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2020/04/29"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/02/04"
5+
updated_date = "2025/12/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -23,7 +23,7 @@ language = "eql"
2323
license = "Elastic License v2"
2424
max_signals = 33
2525
name = "Creation of Hidden Files and Directories via CommandLine"
26-
risk_score = 47
26+
risk_score = 21
2727
rule_id = "b9666521-4742-49ce-9ddc-b8e84c35acae"
2828
setup = """## Setup
2929
@@ -65,7 +65,7 @@ Auditbeat is a lightweight shipper that you can install on your servers to audit
6565
#### Custom Ingest Pipeline
6666
For versions <8.2, you need to add a custom ingest pipeline to populate `event.ingested` with @timestamp for non-elastic-agent indexes, like auditbeats/filebeat/winlogbeat etc. For more details to add a custom ingest pipeline refer to the [guide](https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html).
6767
"""
68-
severity = "medium"
68+
severity = "low"
6969
tags = [
7070
"Domain: Endpoint",
7171
"OS: Linux",
@@ -80,9 +80,10 @@ query = '''
8080
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
8181
process.working_directory in ("/tmp", "/var/tmp", "/dev/shm") and
8282
process.args regex~ """\.[a-z0-9_\-][a-z0-9_\-\.]{1,254}""" and
83-
not process.name in (
84-
"ls", "find", "grep", "git", "jq", "basename", "check_snmp", "snmpget", "snmpwalk", "cc1plus", "snap",
85-
"command-not-found", "sqlite", "apk", "fgrep", "locate", "objdump"
83+
process.name like (
84+
"touch", "tee", "cp", "mv", "install", "dd", "vi", "vim", "nano", "truncate", "sed", "awk", "curl", "wget",
85+
"ftp", "scp", "rsync", "sftp", "tar", "unzip", "gunzip", "7z", "bzip2", "xz", "python*", "php*", "perl*",
86+
"ruby*", "node*", "java", "printf", "echo", "cat", ".*"
8687
)
8788
'''
8889
note = """## Triage and analysis

rules/linux/defense_evasion_hidden_shared_object.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2022/07/20"
33
integration = ["endpoint", "sentinel_one_cloud_funnel"]
44
maturity = "production"
5-
updated_date = "2025/03/20"
5+
updated_date = "2025/12/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -106,28 +106,26 @@ tags = [
106106
]
107107
timestamp_override = "event.ingested"
108108
type = "eql"
109-
110109
query = '''
111-
file where host.os.type == "linux" and event.type == "creation" and file.extension == "so" and file.name : ".*.so" and
112-
not process.name in ("dockerd", "azcopy", "podman")
110+
file where host.os.type == "linux" and event.type == "creation" and
111+
(file.extension:"so" or file.name:*.so.*) and file.name : ".*.so" and
112+
not process.name in ("dockerd", "azcopy", "podman", "opencode") and not file.name like "._*"
113113
'''
114114

115-
116115
[[rule.threat]]
117116
framework = "MITRE ATT&CK"
117+
118118
[[rule.threat.technique]]
119119
id = "T1564"
120120
name = "Hide Artifacts"
121121
reference = "https://attack.mitre.org/techniques/T1564/"
122+
122123
[[rule.threat.technique.subtechnique]]
123124
id = "T1564.001"
124125
name = "Hidden Files and Directories"
125126
reference = "https://attack.mitre.org/techniques/T1564/001/"
126127

127-
128-
129128
[rule.threat.tactic]
130129
id = "TA0005"
131130
name = "Defense Evasion"
132131
reference = "https://attack.mitre.org/tactics/TA0005/"
133-

rules/linux/defense_evasion_interactive_shell_from_system_user.toml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2024/11/04"
33
integration = ["endpoint"]
44
maturity = "production"
5-
updated_date = "2025/01/24"
5+
updated_date = "2025/12/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -15,7 +15,8 @@ index = ["logs-endpoint.events.process*"]
1515
language = "kuery"
1616
license = "Elastic License v2"
1717
name = "Unusual Interactive Shell Launched from System User"
18-
risk_score = 21
18+
references = ["https://www.elastic.co/security-labs/continuation-on-persistence-mechanisms"]
19+
risk_score = 47
1920
rule_id = "9c5b2382-19d2-4b5d-8f14-9e1631a3acdb"
2021
setup = """## Setup
2122
@@ -44,15 +45,15 @@ For more details on Elastic Agent configuration settings, refer to the [helper g
4445
4546
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
4647
"""
47-
severity = "low"
48+
severity = "medium"
4849
tags = [
4950
"Domain: Endpoint",
5051
"OS: Linux",
5152
"Use Case: Threat Detection",
5253
"Tactic: Defense Evasion",
5354
"Data Source: Elastic Defend",
5455
"Resources: Investigation Guide"
55-
]
56+
]
5657
timestamp_override = "event.ingested"
5758
type = "new_terms"
5859
query = '''
@@ -65,11 +66,22 @@ event.category:process and host.os.type:linux and event.type:start and event.act
6566
process.parent.name:(
6667
apt-key or apt-config or gpgv or gpgconf or man-db.postinst or sendmail or rpm or nullmailer-inject
6768
) or
68-
process.args:(/etc/apt/trusted.gpg.d/* or /tmp/apt-key-gpg*) or
69+
process.args:(/etc/apt/trusted.gpg.d/* or /tmp/apt-key-gpg* or "/usr/bin/dnf") or
6970
process.name:(awk or apt-config or dpkg or grep or gpgv or sed) or
7071
(user.name:_apt and process.name:(sqv or apt-key or gpgconf or sort or mktemp or find or cmp or gpg-connect-agent)) or
7172
(user.name:man and process.name:mandb) or
72-
(user.name:daemon and process.name:at)
73+
(user.name:daemon and process.name:at) or
74+
process.parent.args:("/usr/bin/apt-key" or "/var/lib/dpkg/info/man-db.postinst") or
75+
process.parent.executable:(
76+
"/usr/lib/polkit-1/polkitd" or "./runc" or "/usr/bin/apt-get" or "/opt/gitlab/embedded/bin/bundle" or "/run/podman-init" or
77+
/tmp/newroot/* or /var/lib/docker/overlay2/* or /usr/libexec/platform-python*
78+
) or
79+
process.parent.command_line:"runc init" or
80+
process.executable:(
81+
"/opt/gitlab/embedded/bin/bundle" or "/usr/bin/env" or "/usr/bin/readlink" or "/usr/bin/date" or "/usr/bin/dircolors" or
82+
"/usr/sbin/sendmail" or "/usr/bin/atrm" or "/usr/bin/atq" or "/run/podman-init" or "/usr/bin/basename" or "/usr/bin/locale" or
83+
"/usr/bin/tr"
84+
)
7385
)
7486
'''
7587
note = """## Triage and analysis
@@ -108,6 +120,7 @@ In Linux environments, system users are typically non-interactive and serve spec
108120
- Implement stricter access controls and monitoring for system user accounts to prevent unauthorized interactive shell launches in the future.
109121
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if additional systems are affected.
110122
- Update detection mechanisms and rules to enhance monitoring for similar threats, ensuring that any future attempts are quickly identified and addressed."""
123+
111124
[[rule.threat]]
112125
framework = "MITRE ATT&CK"
113126

@@ -132,4 +145,4 @@ value = ["process.executable"]
132145

133146
[[rule.new_terms.history_window_start]]
134147
field = "history_window_start"
135-
value = "now-14d"
148+
value = "now-5d"

rules/linux/defense_evasion_interpreter_launched_from_decoded_payload.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -52,7 +52,7 @@ Base64 encoding is a method to encode binary data into ASCII text, often used fo
5252
- Implement enhanced monitoring and logging for base64 decoding activities and interpreter executions to detect similar threats in the future.
5353
- Escalate the incident to the security operations center (SOC) or incident response team for further investigation and to determine if broader organizational impacts exist.
5454
"""
55-
risk_score = 47
55+
risk_score = 73
5656
rule_id = "5bdad1d5-5001-4a13-ae99-fa8619500f1a"
5757
setup = """## Setup
5858
@@ -79,7 +79,7 @@ For more details on Elastic Agent configuration settings, refer to the [helper g
7979
- 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.
8080
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
8181
"""
82-
severity = "medium"
82+
severity = "high"
8383
tags = [
8484
"Domain: Endpoint",
8585
"OS: Linux",
@@ -106,9 +106,18 @@ sequence by host.id, process.parent.entity_id with maxspan=3s
106106
)]
107107
[process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "ProcessRollup2") and process.name like~ (
108108
"bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "python*", "perl*", "ruby*", "lua*", "php*"
109-
)]
109+
) and
110+
not (
111+
?process.parent.command_line in ("bash ./run_tests.sh unit-integration", "/bin/sh /var/lib/dpkg/info/nmap-common.postinst configure") or
112+
process.command_line == "/usr/bin/perl /usr/bin/shasum -a 256" or
113+
?process.working_directory like (
114+
"/usr/local/zeek", "/opt/zeek", "/var/lib/docker/overlay2/*/opt/zeek", "/usr/local/zeek_old_install",
115+
"/var/lib/docker/overlay2/*/usr/local/zeek", "/proc/self/fd/*/usr/local/zeek"
116+
) or
117+
(?process.parent.name == "zsh" and ?process.parent.command_line like "*extendedglob*") or
118+
(process.name like "python*" and ?process.parent.name == "python*")
119+
)]
110120
'''
111-
112121
[[rule.threat]]
113122
framework = "MITRE ATT&CK"
114123

rules/linux/defense_evasion_journalctl_clear_logs.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
creation_date = "2025/10/01"
33
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
44
maturity = "production"
5-
updated_date = "2025/10/06"
5+
updated_date = "2025/12/18"
66

77
[rule]
88
author = ["Elastic"]
@@ -55,7 +55,7 @@ This detection flags attempts to purge systemd journal logs by invoking journalc
5555
- Preserve evidence by archiving remaining /var/log/journal entries, journald.conf and its mtime, modified unit files under /etc/systemd/system, and shell/auth logs, and capture a disk snapshot before making further changes.
5656
- Escalate to incident response if root executed "journalctl --vacuum-time/size/files" outside a documented maintenance window, if Storage=volatile was set or retention reduced below policy, or if the same actor performed vacuums on multiple hosts within 24 hours.
5757
"""
58-
risk_score = 21
58+
risk_score = 47
5959
rule_id = "09073bf4-a8ea-4bce-9fd5-2bb56b4d31f4"
6060
setup = """## Setup
6161
@@ -82,7 +82,7 @@ For more details on Elastic Agent configuration settings, refer to the [helper g
8282
- 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.
8383
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
8484
"""
85-
severity = "low"
85+
severity = "medium"
8686
tags = [
8787
"Domain: Endpoint",
8888
"OS: Linux",
@@ -100,7 +100,8 @@ type = "eql"
100100
query = '''
101101
process where host.os.type == "linux" and event.type == "start" and
102102
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
103-
process.name == "journalctl" and process.args like ("--vacuum-time=*", "--vacuum-size=*", "--vacuum-files=*")
103+
process.name == "journalctl" and process.args like ("--vacuum-time=*", "--vacuum-size=*", "--vacuum-files=*") and
104+
not process.parent.args == "/etc/cron.daily/clean-journal-logs"
104105
'''
105106

106107
[[rule.threat]]

0 commit comments

Comments
 (0)