Skip to content

Commit cc300bf

Browse files
committed
[Rule Tuning] Linux DR Tuning - 4
1 parent 6ac69db commit cc300bf

21 files changed

+252
-229
lines changed

rules/linux/command_and_control_frequent_egress_netcon_from_sus_executable.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -92,7 +92,8 @@ tags = [
9292
timestamp_override = "event.ingested"
9393
type = "esql"
9494
query = '''
95-
from logs-endpoint.events.network-*
95+
from logs-endpoint.events.network-* metadata _id, _index, _version
96+
| mv_expand event.action
9697
| where
9798
@timestamp > now() - 1h and
9899
host.os.type == "linux" and
@@ -134,12 +135,15 @@ from logs-endpoint.events.network-*
134135
process.executable,
135136
destination.ip,
136137
agent.id,
137-
host.name
138+
host.name,
139+
Esql.*
138140
| stats
139141
Esql.event_count = count(),
140142
Esql.agent_id_count_distinct = count_distinct(agent.id),
141143
Esql.host_name_values = values(host.name),
142-
Esql.agent_id_values = values(agent.id)
144+
Esql.agent_id_values = values(agent.id),
145+
Esql.event_dataset_values = values(event.dataset),
146+
Esql.data_stream_namespace_values = values(data_stream.namespace)
143147
by process.executable
144148
| where
145149
Esql.agent_id_count_distinct == 1 and

rules/linux/defense_evasion_acl_modification_via_setfacl.toml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
creation_date = "2024/08/23"
33
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
44
maturity = "production"
5-
updated_date = "2025/03/20"
5+
updated_date = "2025/12/17"
66

77
[rule]
88
author = ["Elastic"]
9-
description = "This rule detects Linux Access Control List (ACL) modification via the setfacl command.\n"
9+
description = """
10+
This rule detects Linux Access Control List (ACL) modification via the setfacl command. Attackers may
11+
use the setfacl utility to modify file and directory permissions in order to evade detection and maintain
12+
persistence on a compromised system.
13+
"""
1014
from = "now-9m"
1115
index = [
1216
"auditbeat-*",
@@ -72,34 +76,36 @@ tags = [
7276
]
7377
timestamp_override = "event.ingested"
7478
type = "eql"
75-
7679
query = '''
7780
process where host.os.type == "linux" and event.type == "start" and
7881
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
7982
process.name == "setfacl" and not (
83+
?process.parent.executable in (
84+
"/opt/puppetlabs/puppet/bin/ruby", "/usr/libexec/dirsrv/ds_systemd_ask_password_acl", "/usr/lib/systemd/systemd-udevd",
85+
"/usr/bin/udevadm", "/usr/sbin/ds_systemd_ask_password_acl", "/usr/bin/su", "/bin/su"
86+
) or
8087
process.command_line == "/bin/setfacl --restore=-" or
8188
process.args == "/var/log/journal/" or
82-
process.parent.name in ("stats.pl", "perl", "find") or
83-
process.parent.command_line like~ "/bin/sh -c *ansible*"
89+
?process.parent.name in ("stats.pl", "perl", "find") or
90+
?process.parent.command_line like~ "*ansible*" or
91+
?process.parent.args == "/opt/audit-log-acl.sh"
8492
)
8593
'''
8694

87-
8895
[[rule.threat]]
8996
framework = "MITRE ATT&CK"
97+
9098
[[rule.threat.technique]]
9199
id = "T1222"
92100
name = "File and Directory Permissions Modification"
93101
reference = "https://attack.mitre.org/techniques/T1222/"
102+
94103
[[rule.threat.technique.subtechnique]]
95104
id = "T1222.002"
96105
name = "Linux and Mac File and Directory Permissions Modification"
97106
reference = "https://attack.mitre.org/techniques/T1222/002/"
98107

99-
100-
101108
[rule.threat.tactic]
102109
id = "TA0005"
103110
name = "Defense Evasion"
104111
reference = "https://attack.mitre.org/tactics/TA0005/"
105-

rules/linux/defense_evasion_attempt_to_disable_auditd_service.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -54,7 +54,7 @@ Auditd is a critical Linux service responsible for system auditing and logging,
5454
- Apply any necessary security patches or updates to the affected system to address vulnerabilities that may have been exploited by the adversary.
5555
- Escalate the incident to the security operations team for further investigation and to determine if additional systems may be affected.
5656
- Implement enhanced monitoring and alerting for similar activities across the network to detect and respond to future attempts to disable critical security services."""
57-
risk_score = 21
57+
risk_score = 47
5858
rule_id = "6a058ed6-4e9f-49f3-8f8e-f32165ae7ebf"
5959
setup = """## Setup
6060
@@ -81,7 +81,7 @@ For more details on Elastic Agent configuration settings, refer to the [helper g
8181
- 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.
8282
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
8383
"""
84-
severity = "low"
84+
severity = "medium"
8585
tags = [
8686
"Domain: Endpoint",
8787
"OS: Linux",
@@ -95,33 +95,31 @@ tags = [
9595
]
9696
timestamp_override = "event.ingested"
9797
type = "eql"
98-
9998
query = '''
10099
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "start", "ProcessRollup2") and (
101100
(process.name == "service" and process.args == "stop") or
102101
(process.name == "chkconfig" and process.args == "off") or
103-
(process.name == "systemctl" and process.args in ("disable", "stop", "kill"))
102+
(process.name == "update-rc.d" and process.args in ("remove", "disable")) or
103+
(process.name == "systemctl" and process.args in ("disable", "stop", "kill", "mask"))
104104
) and
105105
process.args in ("auditd", "auditd.service") and
106-
not process.parent.name == "auditd.prerm"
106+
not ?process.parent.name == "auditd.prerm"
107107
'''
108108

109-
110109
[[rule.threat]]
111110
framework = "MITRE ATT&CK"
111+
112112
[[rule.threat.technique]]
113113
id = "T1562"
114114
name = "Impair Defenses"
115115
reference = "https://attack.mitre.org/techniques/T1562/"
116+
116117
[[rule.threat.technique.subtechnique]]
117118
id = "T1562.001"
118119
name = "Disable or Modify Tools"
119120
reference = "https://attack.mitre.org/techniques/T1562/001/"
120121

121-
122-
123122
[rule.threat.tactic]
124123
id = "TA0005"
125124
name = "Defense Evasion"
126125
reference = "https://attack.mitre.org/tactics/TA0005/"
127-

rules/linux/defense_evasion_attempt_to_disable_iptables_or_firewall.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -51,7 +51,7 @@ Firewalls like IPTables on Linux systems are crucial for controlling network tra
5151
- Implement additional monitoring and alerting for similar activities across the network to detect and respond to future attempts to disable firewall services promptly.
5252
- Review and update firewall policies and configurations to enhance security measures and prevent similar defense evasion tactics in the future."""
5353
references = ["https://www.elastic.co/security-labs/detecting-log4j2-with-elastic-security"]
54-
risk_score = 21
54+
risk_score = 47
5555
rule_id = "83e9c2b3-24ef-4c1d-a8cd-5ebafb5dfa2f"
5656
setup = """## Setup
5757
@@ -78,7 +78,7 @@ For more details on Elastic Agent configuration settings, refer to the [helper g
7878
- 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.
7979
For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
8080
"""
81-
severity = "low"
81+
severity = "medium"
8282
tags = [
8383
"Domain: Endpoint",
8484
"OS: Linux",
@@ -91,43 +91,43 @@ tags = [
9191
]
9292
timestamp_override = "event.ingested"
9393
type = "eql"
94-
9594
query = '''
9695
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "start") and
97-
(
96+
(
9897
/* disable FW */
99-
(
100-
(process.name == "ufw" and process.args == "disable") or
101-
(process.name == "iptables" and process.args in ("-F", "--flush", "-X", "--delete-chain") and process.args_count == 2) or
102-
(process.name in ("iptables", "ip6tables") and process.parent.args == "force-stop")
103-
) or
98+
(
99+
(process.name == "ufw" and process.args == "disable") or
100+
(process.name == "iptables" and process.args in ("-F", "--flush", "-X", "--delete-chain") and process.args_count == 2) or
101+
(process.name in ("iptables", "ip6tables") and process.parent.args == "force-stop")
102+
) or
104103
105104
/* stop FW service */
106-
(
107-
((process.name == "service" and process.args == "stop") or
108-
(process.name == "chkconfig" and process.args == "off") or
109-
(process.name == "systemctl" and process.args in ("disable", "stop", "kill"))) and
105+
(
106+
(
107+
(process.name == "service" and process.args == "stop") or
108+
(process.name == "chkconfig" and process.args == "off") or
109+
(process.name == "update-rc.d" and process.args in ("remove", "disable")) or
110+
(process.name == "systemctl" and process.args in ("disable", "stop", "kill", "mask"))
111+
) and
110112
process.args in ("firewalld", "ip6tables", "iptables", "firewalld.service", "ip6tables.service", "iptables.service")
111-
)
112113
)
114+
)
113115
'''
114116

115-
116117
[[rule.threat]]
117118
framework = "MITRE ATT&CK"
119+
118120
[[rule.threat.technique]]
119121
id = "T1562"
120122
name = "Impair Defenses"
121123
reference = "https://attack.mitre.org/techniques/T1562/"
124+
122125
[[rule.threat.technique.subtechnique]]
123126
id = "T1562.001"
124127
name = "Disable or Modify Tools"
125128
reference = "https://attack.mitre.org/techniques/T1562/001/"
126129

127-
128-
129130
[rule.threat.tactic]
130131
id = "TA0005"
131132
name = "Defense Evasion"
132133
reference = "https://attack.mitre.org/tactics/TA0005/"
133-

rules/linux/defense_evasion_attempt_to_disable_syslog_service.toml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
creation_date = "2020/04/27"
33
integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
44
maturity = "production"
5-
updated_date = "2025/09/29"
5+
updated_date = "2025/12/17"
66

77
[rule]
88
author = ["Elastic"]
99
description = """
10-
Adversaries may attempt to disable the syslog service in an attempt to an attempt to disrupt event logging and evade
11-
detection by security controls.
10+
Syslog is a critical component in Linux environments, responsible for logging system events and activities. Adversaries
11+
may attempt to disable the syslog service to disrupt event logging and evade detection by security controls.
1212
"""
1313
from = "now-9m"
1414
index = [
@@ -110,11 +110,14 @@ tags = [
110110
timestamp_override = "event.ingested"
111111
type = "eql"
112112
query = '''
113-
process where host.os.type == "linux" and event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
114-
( (process.name == "service" and process.args == "stop") or
115-
(process.name == "chkconfig" and process.args == "off") or
116-
(process.name == "systemctl" and process.args in ("disable", "stop", "kill"))
117-
) and process.args in ("syslog", "rsyslog", "syslog-ng", "syslog.service", "rsyslog.service", "syslog-ng.service") and
113+
process where host.os.type == "linux" and event.type == "start" and
114+
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and (
115+
(process.name == "service" and process.args == "stop") or
116+
(process.name == "chkconfig" and process.args == "off") or
117+
(process.name == "update-rc.d" and process.args in ("remove", "disable")) or
118+
(process.name == "systemctl" and process.args in ("disable", "stop", "kill", "mask"))
119+
) and
120+
process.args in ("syslog", "rsyslog", "syslog-ng", "syslog.service", "rsyslog.service", "syslog-ng.service") and
118121
not (
119122
process.parent.name == "rsyslog-rotate" or
120123
process.args == "HUP"

rules/linux/defense_evasion_authorized_keys_file_deletion.toml

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

77
[rule]
88
author = ["Elastic"]
@@ -96,7 +96,8 @@ not (
9696
process.executable in (
9797
"/usr/bin/google_guest_agent", "/usr/bin/dockerd", "/bin/dockerd", "/usr/bin/containerd"
9898
) or
99-
process.executable like~ "/nix/store/*"
99+
process.executable like~ "/nix/store/*" or
100+
file.path like~ ("*backup*", "*ansible*", "*puppet*")
100101
)
101102
'''
102103

rules/linux/defense_evasion_base16_or_base32_encoding_or_decoding_activity.toml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
creation_date = "2020/04/17"
33
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
44
maturity = "production"
5-
updated_date = "2025/03/20"
5+
updated_date = "2025/12/17"
66

77
[rule]
88
author = ["Elastic"]
9-
description = "Adversaries may encode/decode data in an attempt to evade detection by host- or network-based security controls."
9+
description = """
10+
Base16 and Base32 are encoding schemes that convert binary data into text, making it easier to transmit and store. This rule
11+
monitors for Base16 or Base32 encoding and decoding activity on Linux systems. Attackers may use these encoding schemes to
12+
obfuscate malicious payloads, evade detection, and facilitate data exfiltration.
13+
"""
1014
false_positives = [
1115
"""
1216
Automated tools such as Jenkins may encode or decode files as part of their normal behavior. These events can be
@@ -60,7 +64,7 @@ Base16 and Base32 are encoding schemes used to convert binary data into text, fa
6064
- Restore any affected files or systems from known good backups to ensure system integrity and data accuracy.
6165
- Update and patch the affected system to close any vulnerabilities that may have been exploited by the adversary.
6266
- Escalate the incident to the security operations center (SOC) or incident response team for further analysis and to determine if additional systems are affected."""
63-
risk_score = 21
67+
risk_score = 47
6468
rule_id = "debff20a-46bc-4a4d-bae5-5cdd14222795"
6569
setup = """## Setup
6670
@@ -99,7 +103,7 @@ Auditbeat is a lightweight shipper that you can install on your servers to audit
99103
- To run Auditbeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-kubernetes.html).
100104
- For complete “Setup and Run Auditbeat” information refer to the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setting-up-and-running.html).
101105
"""
102-
severity = "low"
106+
severity = "medium"
103107
tags = [
104108
"Domain: Endpoint",
105109
"OS: Linux",
@@ -114,17 +118,16 @@ tags = [
114118
]
115119
timestamp_override = "event.ingested"
116120
type = "eql"
117-
118121
query = '''
119122
process where host.os.type == "linux" and event.type == "start" and
120-
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
121-
process.name in ("base16", "base32", "base32plain", "base32hex") and
123+
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
124+
process.name in ("base16", "base32", "base32plain", "base32hex") and
122125
not process.args in ("--help", "--version")
123126
'''
124127

125-
126128
[[rule.threat]]
127129
framework = "MITRE ATT&CK"
130+
128131
[[rule.threat.technique]]
129132
id = "T1027"
130133
name = "Obfuscated Files or Information"
@@ -135,9 +138,7 @@ id = "T1140"
135138
name = "Deobfuscate/Decode Files or Information"
136139
reference = "https://attack.mitre.org/techniques/T1140/"
137140

138-
139141
[rule.threat.tactic]
140142
id = "TA0005"
141143
name = "Defense Evasion"
142144
reference = "https://attack.mitre.org/tactics/TA0005/"
143-

0 commit comments

Comments
 (0)