Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions rules/linux/persistence_linux_user_added_to_privileged_group.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[metadata]
creation_date = "2023/02/13"
integration = ["endpoint", "auditd_manager"]
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2024/10/24"
min_stack_version = "8.13.0"
min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
updated_date = "2025/01/08"

[transform]
[[transform.osquery]]
Expand All @@ -29,7 +31,7 @@ Identifies attempts to add a user to a privileged group. Attackers may add users
establish persistence on a system.
"""
from = "now-9m"
index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*"]
index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*", "logs-crowdstrike.fdr*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Linux User Added to Privileged Group"
Expand Down Expand Up @@ -117,18 +119,21 @@ tags = [
"Resources: Investigation Guide",
"Data Source: Elastic Defend",
"Data Source: Auditd Manager",
"Data Source: Crowdstrike",
"Data Source: SentinelOne",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
and process.args in (
"root", "admin", "wheel", "staff", "sudo","disk", "video", "shadow", "lxc", "lxd"
) and
(
process.name in ("usermod", "adduser") or
(process.name == "gpasswd" and process.args in ("-a", "--add", "-M", "--members"))
)
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
process.args in (
"root", "admin", "wheel", "staff", "sudo","disk", "video", "shadow", "lxc", "lxd"
) and
(
process.name in ("usermod", "adduser") or
(process.name == "gpasswd" and process.args in ("-a", "--add", "-M", "--members"))
)
'''

[[rule.threat]]
Expand Down
88 changes: 54 additions & 34 deletions rules/linux/persistence_message_of_the_day_execution.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[metadata]
creation_date = "2023/02/28"
integration = ["endpoint"]
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2024/05/31"
min_stack_version = "8.13.0"
min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
updated_date = "2025/01/08"

[transform]
[[transform.osquery]]
Expand Down Expand Up @@ -41,7 +43,7 @@ a backdoor script or command. This rule detects the execution of potentially mal
utility.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*", "endgame-*"]
index = ["logs-endpoint.events.process*", "endgame-*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Process Spawned from Message-of-the-Day (MOTD)"
Expand Down Expand Up @@ -142,42 +144,60 @@ tags = [
"Data Source: Elastic Endgame",
"Resources: Investigation Guide",
"Data Source: Elastic Defend",
"Data Source: SentinelOne",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where event.type == "start" and host.os.type == "linux" and event.action : ("exec", "exec_event") and
process.parent.executable : "/etc/update-motd.d/*" and (
(process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and (
(process.args : ("-i", "-l")) or (process.parent.name == "socat" and process.parent.args : "*exec*"))) or
(process.name : ("nc", "ncat", "netcat", "nc.openbsd") and process.args_count >= 3 and
not process.args : ("-*z*", "-*l*")) or
(process.name : "python*" and process.args : "-c" and process.args : (
"*import*pty*spawn*", "*import*subprocess*call*"
)) or
(process.name : "perl*" and process.args : "-e" and process.args : "*socket*" and process.args : (
"*exec*", "*system*"
)) or
(process.name : "ruby*" and process.args : ("-e", "-rsocket") and process.args : (
"*TCPSocket.new*", "*TCPSocket.open*"
)) or
(process.name : "lua*" and process.args : "-e" and process.args : "*socket.tcp*" and process.args : (
"*io.popen*", "*os.execute*"
)) or
(process.name : "php*" and process.args : "-r" and process.args : "*fsockopen*" and process.args : "*/bin/*sh*") or
(process.name : ("awk", "gawk", "mawk", "nawk") and process.args : "*/inet/tcp/*") or
(process.name in ("openssl", "telnet")) or
(process.args : (
"./*", "/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/etc/update-motd.d/*", "/run/*", "/srv/*",
"/tmp/*", "/var/tmp/*", "/var/log/*", "/opt/*"
) and process.args_count == 1
process where event.type == "start" and host.os.type == "linux" and event.action : ("exec", "exec_event", "start") and
process.parent.executable : "/etc/update-motd.d/*" and
(
(
process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
(
process.args : ("-i", "-l") or
(process.parent.name == "socat" and process.parent.args : "*exec*")
)
) or
(
process.name : ("nc", "ncat", "netcat", "nc.openbsd") and process.args_count >= 3 and
not process.args : ("-*z*", "-*l*")
) or
(
process.name : "python*" and process.args : "-c" and process.args : (
"*import*pty*spawn*", "*import*subprocess*call*"
)
) or
(
process.name : "perl*" and process.args : "-e" and process.args : "*socket*" and process.args : (
"*exec*", "*system*"
)
) or
(
process.name : "ruby*" and process.args : ("-e", "-rsocket") and process.args : (
"*TCPSocket.new*", "*TCPSocket.open*"
)
) or
(
process.name : "lua*" and process.args : "-e" and process.args : "*socket.tcp*" and process.args : (
"*io.popen*", "*os.execute*"
)
) or
(process.name : "php*" and process.args : "-r" and process.args : "*fsockopen*" and process.args : "*/bin/*sh*") or
(process.name : ("awk", "gawk", "mawk", "nawk") and process.args : "*/inet/tcp/*") or
(process.name in ("openssl", "telnet")) or
(
process.args : (
"./*", "/boot/*", "/dev/shm/*", "/etc/cron.*/*", "/etc/init.d/*", "/etc/update-motd.d/*", "/run/*", "/srv/*",
"/tmp/*", "/var/tmp/*", "/var/log/*", "/opt/*"
) and process.args_count == 1
)
) and
not (
process.parent.args == "--force" or
process.args in ("/usr/games/lolcat", "/usr/bin/screenfetch") or
process.parent.name == "system-crash-notification"
)
) and
not (
process.parent.args == "--force" or
process.args in ("/usr/games/lolcat", "/usr/bin/screenfetch") or
process.parent.name == "system-crash-notification"
)
'''

[[rule.threat]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[metadata]
creation_date = "2024/06/03"
integration = ["endpoint"]
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2024/09/23"
min_stack_version = "8.13.0"
min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
updated_date = "2025/01/08"

[rule]
author = ["Elastic"]
Expand All @@ -13,7 +15,7 @@ environment. Adversaries may create these scripts to execute malicious code at s
persistence onto the system.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*", "endgame-*"]
index = ["logs-endpoint.events.process*", "endgame-*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Executable Bit Set for Potential Persistence Script"
Expand Down Expand Up @@ -58,12 +60,13 @@ tags = [
"Tactic: Persistence",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: SentinelOne",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "start") and
process.args : (
// Misc.
"/etc/rc.local", "/etc/rc.common", "/etc/rc.d/rc.local", "/etc/init.d/*", "/etc/update-motd.d/*",
Expand Down
13 changes: 8 additions & 5 deletions rules/linux/persistence_process_capability_set_via_setcap.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[metadata]
creation_date = "2024/06/03"
integration = ["endpoint"]
integration = ["endpoint", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2024/06/03"
min_stack_version = "8.13.0"
min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
updated_date = "2025/01/08"

[rule]
author = ["Elastic"]
Expand All @@ -13,7 +15,7 @@ by attackers to establish persistence by creating a backdoor, or escalate privil
system.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*", "endgame-*"]
index = ["logs-endpoint.events.process*", "endgame-*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Process Capability Set via setcap Utility"
Expand Down Expand Up @@ -53,12 +55,13 @@ tags = [
"Tactic: Persistence",
"Tactic: Privilege Escalation",
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend"
"Data Source: Elastic Defend",
"Data Source: SentinelOne"
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "start") and
process.name == "setcap" and not (
process.parent.executable == null or
process.parent.executable : ("/var/lib/dpkg/*", "/var/lib/docker/*", "/tmp/newroot/*", "/var/tmp/newroot/*") or
Expand Down
21 changes: 13 additions & 8 deletions rules/linux/persistence_setuid_setgid_capability_set.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[metadata]
creation_date = "2023/09/05"
integration = ["endpoint"]
integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2024/10/17"
min_stack_version = "8.13.0"
min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
updated_date = "2025/01/08"

[transform]
[[transform.osquery]]
Expand Down Expand Up @@ -39,7 +41,7 @@ file owner or group. Threat actors can exploit these attributes to achieve persi
allowing them to maintain control over a compromised system with elevated permissions.
"""
from = "now-9m"
index = ["logs-endpoint.events.*", "endgame-*"]
index = ["logs-endpoint.events.*", "endgame-*", "logs-crowdstrike.fdr*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Setcap setuid/setgid Capability Set"
Expand Down Expand Up @@ -138,15 +140,18 @@ tags = [
"Tactic: Persistence",
"Data Source: Elastic Defend",
"Data Source: Elastic Endgame",
"Data Source: Crowdstrike",
"Data Source: SentinelOne",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event") and
process.name == "setcap" and process.args : "cap_set?id+ep" and not (
process.parent.name in ("jem", "vzctl") or
process.args like "/usr/bin/new?idmap"
)
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
process.name == "setcap" and process.args : "cap_set?id+ep" and not (
process.parent.name in ("jem", "vzctl") or
process.args like "/usr/bin/new?idmap"
)
'''

[[rule.threat]]
Expand Down
21 changes: 14 additions & 7 deletions rules/linux/persistence_simple_web_server_creation.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[metadata]
creation_date = "2024/12/17"
integration = ["endpoint"]
integration = ["endpoint", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2024/12/17"
min_stack_version = "8.13.0"
min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
updated_date = "2025/01/08"

[rule]
author = ["Elastic"]
Expand All @@ -12,7 +14,7 @@ simple HTTP web servers to establish persistence on a compromised system by uplo
to the server web root, allowing them to regain remote access to the system if lost.
"""
from = "now-9m"
index = ["logs-endpoint.events.process*"]
index = ["logs-endpoint.events.process*", "logs-crowdstrike.fdr*", "logs-sentinel_one_cloud_funnel.*", "endgame-*"]
language = "eql"
license = "Elastic License v2"
name = "Simple HTTP Web Server Creation"
Expand Down Expand Up @@ -52,14 +54,19 @@ tags = [
"Tactic: Execution",
"Tactic: Command and Control",
"Data Source: Elastic Defend",
"Data Source: Crowdstrike",
"Data Source: SentinelOne",
"Data Source: Elastic Endgame",
]
timestamp_override = "event.ingested"
type = "eql"
query = '''
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and (
(process.name regex~ """php?[0-9]?\.?[0-9]{0,2}""" and process.args == "-S") or
(process.name like "python*" and process.args in ("--cgi", "CGIHTTPServer"))
)
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
(
(process.name regex~ """php?[0-9]?\.?[0-9]{0,2}""" and process.args == "-S") or
(process.name like "python*" and process.args in ("--cgi", "CGIHTTPServer"))
)
'''

[[rule.threat]]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[metadata]
creation_date = "2023/07/28"
integration = ["endpoint", "auditd_manager"]
integration = ["endpoint", "auditd_manager", "crowdstrike", "sentinel_one_cloud_funnel"]
maturity = "production"
updated_date = "2024/05/21"
min_stack_version = "8.13.0"
min_stack_comments = "Breaking change at 8.13.0 for SentinelOne Integration."
updated_date = "2025/01/08"

[rule]
author = ["Elastic"]
Expand All @@ -13,7 +15,7 @@ commands or input containing wildcards (e.g., *, ?, []) to execute unintended op
tricking the system into interpreting the wildcard characters in unexpected ways.
"""
from = "now-9m"
index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*"]
index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*", "logs-crowdstrike.fdr*", "logs-sentinel_one_cloud_funnel.*"]
language = "eql"
license = "Elastic License v2"
name = "Potential Unauthorized Access via Wildcard Injection Detected"
Expand Down Expand Up @@ -55,13 +57,16 @@ tags = [
"Data Source: Elastic Endgame",
"Data Source: Elastic Defend",
"Data Source: Auditd Manager",
"Data Source: Crowdstrike",
"Data Source: SentinelOne",
]
timestamp_override = "event.ingested"
type = "eql"

query = '''
process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started")
and process.name in ("chown", "chmod") and process.args == "-R" and process.args : "--reference=*"
process where host.os.type == "linux" and event.type == "start" and
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
process.name in ("chown", "chmod") and process.args == "-R" and process.args : "--reference=*"
'''


Expand Down
Loading
Loading