[Rule Tuning] Q2 Linux DR Tuning - Part 1 (#4162)
* [Rule Tuning] Q2 Linux DR Tuning - Part 1 * Update defense_evasion_binary_copied_to_suspicious_directory.toml
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
creation_date = "2023/08/23"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/05/21"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[transform]
|
||||
[[transform.osquery]]
|
||||
@@ -147,10 +147,11 @@ tags = [
|
||||
type = "eql"
|
||||
|
||||
query = '''
|
||||
sequence by host.id, process.entity_id with maxspan=1s
|
||||
sequence by host.id, process.entity_id with maxspan=3s
|
||||
[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
|
||||
process.args == "client" and process.args : ("R*", "*:*", "*socks*", "*.*") and process.args_count >= 4 and
|
||||
process.parent.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish")]
|
||||
process.parent.name in ("bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish") and
|
||||
not process.name in ("velociraptor", "nbemmcmd")]
|
||||
[network where host.os.type == "linux" and event.action == "connection_attempted" and event.type == "start" and
|
||||
destination.ip != null and destination.ip != "127.0.0.1" and destination.ip != "::1" and
|
||||
not process.name : (
|
||||
@@ -158,17 +159,15 @@ sequence by host.id, process.entity_id with maxspan=1s
|
||||
"ftp", "socat", "curl", "wget", "dpkg", "docker", "dockerd", "yum", "apt", "rpm", "dnf", "ssh", "sshd")]
|
||||
'''
|
||||
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
[[rule.threat.technique]]
|
||||
id = "T1572"
|
||||
name = "Protocol Tunneling"
|
||||
reference = "https://attack.mitre.org/techniques/T1572/"
|
||||
|
||||
|
||||
[rule.threat.tactic]
|
||||
id = "TA0011"
|
||||
name = "Command and Control"
|
||||
reference = "https://attack.mitre.org/tactics/TA0011/"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
creation_date = "2023/10/18"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/05/21"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[rule]
|
||||
author = ["Elastic"]
|
||||
@@ -68,10 +68,9 @@ process.name:kworker* and not destination.ip:(
|
||||
"::1" or
|
||||
"FE80::/10" or
|
||||
"FF00::/8"
|
||||
) and not destination.port:2049
|
||||
) and not destination.port:("2049" or "111" or "892" or "597")
|
||||
'''
|
||||
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
@@ -79,8 +78,10 @@ framework = "MITRE ATT&CK"
|
||||
id = "TA0011"
|
||||
name = "Command and Control"
|
||||
reference = "https://attack.mitre.org/tactics/TA0011/"
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
[[rule.threat.technique]]
|
||||
id = "T1014"
|
||||
name = "Rootkit"
|
||||
@@ -91,19 +92,19 @@ id = "T1036"
|
||||
name = "Masquerading"
|
||||
reference = "https://attack.mitre.org/techniques/T1036/"
|
||||
|
||||
|
||||
[rule.threat.tactic]
|
||||
id = "TA0005"
|
||||
name = "Defense Evasion"
|
||||
reference = "https://attack.mitre.org/tactics/TA0005/"
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
[[rule.threat.technique]]
|
||||
id = "T1041"
|
||||
name = "Exfiltration Over C2 Channel"
|
||||
reference = "https://attack.mitre.org/techniques/T1041/"
|
||||
|
||||
|
||||
[rule.threat.tactic]
|
||||
id = "TA0010"
|
||||
name = "Exfiltration"
|
||||
@@ -111,9 +112,8 @@ reference = "https://attack.mitre.org/tactics/TA0010/"
|
||||
|
||||
[rule.new_terms]
|
||||
field = "new_terms_fields"
|
||||
value = ["process.name", "destination.ip", "destination.port"]
|
||||
value = ["process.name", "host.id"]
|
||||
|
||||
[[rule.new_terms.history_window_start]]
|
||||
field = "history_window_start"
|
||||
value = "now-14d"
|
||||
|
||||
|
||||
|
||||
+24
-21
@@ -2,7 +2,7 @@
|
||||
creation_date = "2023/06/14"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/07/23"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[transform]
|
||||
[[transform.osquery]]
|
||||
@@ -180,35 +180,39 @@ type = "new_terms"
|
||||
|
||||
query = '''
|
||||
host.os.type:linux and event.category:network and event.action:(connection_attempted or ipv4_connection_attempt_event) and
|
||||
process.executable:(
|
||||
(/etc/crontab or /etc/rc.local or ./* or /boot/* or /dev/shm/* or /etc/cron.*/* or /etc/init.d/* or /etc/rc*.d/* or
|
||||
process.executable : (
|
||||
/etc/crontab or /etc/rc.local or ./* or /boot/* or /dev/shm/* or /etc/cron.*/* or /etc/init.d/* or /etc/rc*.d/* or
|
||||
/etc/update-motd.d/* or /home/*/.* or /tmp/* or /usr/lib/update-notifier/* or /var/log/* or /var/tmp/*
|
||||
) and
|
||||
not (/tmp/newroot/* or /tmp/snap.rootfs*) and
|
||||
not /etc/cron.hourly/BitdefenderRedline) and
|
||||
source.ip:(10.0.0.0/8 or 127.0.0.0/8 or 172.16.0.0/12 or 192.168.0.0/16) and
|
||||
not process.name:(
|
||||
apt or chrome or curl or dnf or dockerd or dpkg or firefox-bin or git-remote-https or java or kite-update or kited or node
|
||||
or rpm or saml2aws or selenium-manager or solana-validator or wget or yum or ansible* or aws* or php* or pip* or python*
|
||||
or steam* or terraform*
|
||||
) and
|
||||
not destination.ip:(
|
||||
0.0.0.0 or 10.0.0.0/8 or 100.64.0.0/10 or 127.0.0.0/8 or 169.254.0.0/16 or 172.16.0.0/12 or 192.0.0.0/24 or 192.0.0.0/29 or
|
||||
192.0.0.10/32 or 192.0.0.170/32 or 192.0.0.171/32 or 192.0.0.8/32 or 192.0.0.9/32 or 192.0.2.0/24 or 192.168.0.0/16 or
|
||||
192.175.48.0/24 or 192.31.196.0/24 or 192.52.193.0/24 or 192.88.99.0/24 or 198.18.0.0/15 or 198.51.100.0/24 or 203.0.113.0/24
|
||||
or 224.0.0.0/4 or 240.0.0.0/4 or "::1" or "FE80::/10" or "FF00::/8"
|
||||
) and process.name : * and
|
||||
not (
|
||||
process.executable : (
|
||||
/tmp/newroot/* or /tmp/snap.rootfs* or /etc/cron.hourly/BitdefenderRedline or /tmp/go-build* or /srv/snp/docker/* or
|
||||
/run/containerd/* or /tmp/.mount* or /run/k3s/containerd/* or /tmp/selenium* or /tmp/tmp.*/juliainstaller or
|
||||
/tmp/.criu.mntns* or /home/*/.local/share/containers/* or /etc/update-motd.d/*
|
||||
) or
|
||||
source.ip:(10.0.0.0/8 or 127.0.0.0/8 or 172.16.0.0/12 or 192.168.0.0/16) or
|
||||
process.name : (
|
||||
apt or chrome or curl or dnf or dockerd or dpkg or firefox-bin or git-remote-https or java or kite-update or
|
||||
kited or node or rpm or saml2aws or selenium-manager or solana-validator or wget or yum or ansible* or aws* or
|
||||
php* or pip* or python* or steam* or terraform*
|
||||
) or
|
||||
destination.ip:(
|
||||
0.0.0.0 or 10.0.0.0/8 or 100.64.0.0/10 or 127.0.0.0/8 or 169.254.0.0/16 or 172.16.0.0/12 or 192.0.0.0/24 or
|
||||
192.0.0.0/29 or 192.0.0.10/32 or 192.0.0.170/32 or 192.0.0.171/32 or 192.0.0.8/32 or 192.0.0.9/32 or 192.0.2.0/24 or
|
||||
192.168.0.0/16 or 192.175.48.0/24 or 192.31.196.0/24 or 192.52.193.0/24 or 192.88.99.0/24 or 198.18.0.0/15 or
|
||||
198.51.100.0/24 or 203.0.113.0/24 or 224.0.0.0/4 or 240.0.0.0/4 or "::1" or "FE80::/10" or "FF00::/8"
|
||||
)
|
||||
)
|
||||
'''
|
||||
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
[[rule.threat.technique]]
|
||||
id = "T1071"
|
||||
name = "Application Layer Protocol"
|
||||
reference = "https://attack.mitre.org/techniques/T1071/"
|
||||
|
||||
|
||||
[rule.threat.tactic]
|
||||
id = "TA0011"
|
||||
name = "Command and Control"
|
||||
@@ -217,8 +221,7 @@ reference = "https://attack.mitre.org/tactics/TA0011/"
|
||||
[rule.new_terms]
|
||||
field = "new_terms_fields"
|
||||
value = ["process.executable"]
|
||||
|
||||
[[rule.new_terms.history_window_start]]
|
||||
field = "history_window_start"
|
||||
value = "now-20d"
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
creation_date = "2023/07/26"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/05/21"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[rule]
|
||||
author = ["Elastic"]
|
||||
@@ -58,7 +58,7 @@ sequence by host.id, process.parent.executable, user.id with maxspan=1s
|
||||
[process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.name == "su" and
|
||||
not process.parent.name in (
|
||||
"bash", "dash", "ash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "clickhouse-server", "ma", "gitlab-runner",
|
||||
"updatedb.findutils", "cron"
|
||||
"updatedb.findutils", "cron", "perl", "sudo", "java", "cloud-app-identify", "ambari-sudo.sh"
|
||||
)
|
||||
] with runs=10
|
||||
'''
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
creation_date = "2023/08/29"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/09/23"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[rule]
|
||||
author = ["Elastic"]
|
||||
@@ -59,7 +59,7 @@ timestamp_override = "event.ingested"
|
||||
type = "eql"
|
||||
|
||||
query = '''
|
||||
file where host.os.type == "linux" and event.type == "change" and event.action == "rename" and
|
||||
file where host.os.type == "linux" and event.type == "change" and event.action == "rename" and process.name != null and
|
||||
file.Ext.original.path : (
|
||||
"/bin/*", "/usr/bin/*", "/usr/local/bin/*", "/sbin/*", "/usr/sbin/*", "/usr/local/sbin/*"
|
||||
) and not (
|
||||
@@ -79,6 +79,11 @@ file.Ext.original.path : (
|
||||
"/usr/lib/systemd/systemd", "/usr/sbin/sshd", "/sbin/sshd", "/usr/local/sbin/sshd", "/usr/sbin/crond", "/sbin/crond",
|
||||
"/usr/local/sbin/crond", "/usr/sbin/gdm"
|
||||
) or
|
||||
process.name like (
|
||||
"python*", "packagekitd", "systemd", "ln", "platform-python", "dnf_install", "runc", "apt-get", "ssm-agent-worker",
|
||||
"convert-usrmerge", "updatenow.static-cpanelsync", "apk", "exe", "php", "containerd-shim-runc-v2", "dpkg", "sed",
|
||||
"platform-python*", "gedit", "crond", "sshd", "ruby", "sudo", "chainctl", "update-alternatives", "pip*"
|
||||
) or
|
||||
file.Ext.original.path : (
|
||||
"/bin/*.tmp", "/usr/bin/*.tmp", "/usr/local/bin/*.tmp", "/sbin/*.tmp", "/usr/sbin/*.tmp", "/usr/local/sbin/*.tmp"
|
||||
) or
|
||||
@@ -91,27 +96,25 @@ file.Ext.original.path : (
|
||||
)
|
||||
'''
|
||||
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
[[rule.threat.technique]]
|
||||
id = "T1036"
|
||||
name = "Masquerading"
|
||||
reference = "https://attack.mitre.org/techniques/T1036/"
|
||||
|
||||
[[rule.threat.technique.subtechnique]]
|
||||
id = "T1036.003"
|
||||
name = "Rename System Utilities"
|
||||
reference = "https://attack.mitre.org/techniques/T1036/003/"
|
||||
|
||||
|
||||
[[rule.threat.technique]]
|
||||
id = "T1564"
|
||||
name = "Hide Artifacts"
|
||||
reference = "https://attack.mitre.org/techniques/T1564/"
|
||||
|
||||
|
||||
[rule.threat.tactic]
|
||||
id = "TA0005"
|
||||
name = "Defense Evasion"
|
||||
reference = "https://attack.mitre.org/tactics/TA0005/"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
creation_date = "2022/07/22"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/05/21"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[rule]
|
||||
author = ["Elastic"]
|
||||
@@ -71,30 +71,31 @@ tags = [
|
||||
]
|
||||
timestamp_override = "event.ingested"
|
||||
type = "eql"
|
||||
|
||||
query = '''
|
||||
process where host.os.type == "linux" and event.type == "start" and user.id == "0" and
|
||||
process.executable : "/usr/bin/chattr" and process.args : ("-*i*", "+*i*") and
|
||||
not process.parent.executable: ("/lib/systemd/systemd", "/usr/local/uems_agent/bin/*", "/usr/lib/systemd/systemd") and
|
||||
not process.parent.name in ("systemd", "cf-agent", "ntpdate", "xargs", "px", "preinst", "auth")
|
||||
process where host.os.type == "linux" and event.type == "start" and process.parent.executable != null and
|
||||
process.executable : "/usr/bin/chattr" and process.args : ("-*i*", "+*i*") and not (
|
||||
process.parent.executable: ("/lib/systemd/systemd", "/usr/local/uems_agent/bin/*", "/usr/lib/systemd/systemd") or
|
||||
process.parent.name in (
|
||||
"systemd", "cf-agent", "ntpdate", "xargs", "px", "preinst", "auth", "cf-agent", "dcservice", "dcagentupgrader",
|
||||
"sudo", "ephemeral-disk-warning"
|
||||
)
|
||||
)
|
||||
'''
|
||||
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
[[rule.threat.technique]]
|
||||
id = "T1222"
|
||||
name = "File and Directory Permissions Modification"
|
||||
reference = "https://attack.mitre.org/techniques/T1222/"
|
||||
|
||||
[[rule.threat.technique.subtechnique]]
|
||||
id = "T1222.002"
|
||||
name = "Linux and Mac File and Directory Permissions Modification"
|
||||
reference = "https://attack.mitre.org/techniques/T1222/002/"
|
||||
|
||||
|
||||
|
||||
[rule.threat.tactic]
|
||||
id = "TA0005"
|
||||
name = "Defense Evasion"
|
||||
reference = "https://attack.mitre.org/tactics/TA0005/"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
creation_date = "2024/08/08"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/08/08"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[rule]
|
||||
author = ["Elastic"]
|
||||
@@ -66,16 +66,18 @@ not (
|
||||
"/usr/local/sbin/apk", "/usr/bin/apt", "/usr/sbin/pacman", "/bin/podman", "/usr/bin/podman", "/usr/bin/puppet",
|
||||
"/bin/puppet", "/opt/puppetlabs/puppet/bin/puppet", "/usr/bin/chef-client", "/bin/chef-client",
|
||||
"/bin/autossl_check", "/usr/bin/autossl_check", "/proc/self/exe", "/dev/fd/*", "/usr/bin/pamac-daemon",
|
||||
"/bin/pamac-daemon", "/usr/lib/snapd/snapd", "/usr/local/bin/dockerd", "/usr/libexec/platform-python"
|
||||
"/bin/pamac-daemon", "/usr/lib/snapd/snapd", "/usr/local/bin/dockerd", "/usr/libexec/platform-python",
|
||||
"/usr/lib/snapd/snap-update-ns", "/usr/bin/vmware-config-tools.pl"
|
||||
) or
|
||||
file.extension in ("swp", "swpx", "swx", "dpkg-remove") or
|
||||
file.Ext.original.extension == "dpkg-new" or
|
||||
process.executable : (
|
||||
"/nix/store/*", "/var/lib/dpkg/*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*"
|
||||
"/nix/store/*", "/var/lib/dpkg/*", "/snap/*", "/dev/fd/*", "/usr/lib/virtualbox/*", "/opt/dynatrace/oneagent/*"
|
||||
) or
|
||||
process.executable == null or
|
||||
process.name == "java" or
|
||||
(process.name == "sed" and file.name : "sed*") or
|
||||
(process.name == "perl" and file.name : "e2scrub_all.tmp*")
|
||||
(process.name == "perl" and file.name : "e2scrub_all.tmp*")
|
||||
)
|
||||
'''
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
creation_date = "2020/04/21"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/05/21"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[rule]
|
||||
author = ["Elastic"]
|
||||
@@ -74,7 +74,7 @@ type = "new_terms"
|
||||
query = '''
|
||||
host.os.type:linux and event.category:process and event.type:start and
|
||||
process.name:(chattr or chgrp or chmod or chown) and process.working_directory:(/dev/shm or /tmp or /var/tmp) and
|
||||
not process.parent.name:(apt-key or update-motd-updates-available)
|
||||
not process.parent.name:(apt-key or update-motd-updates-available or apt-get)
|
||||
'''
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
creation_date = "2020/04/29"
|
||||
integration = ["endpoint"]
|
||||
maturity = "production"
|
||||
updated_date = "2024/05/21"
|
||||
updated_date = "2024/10/17"
|
||||
|
||||
[rule]
|
||||
author = ["Elastic"]
|
||||
@@ -75,32 +75,34 @@ tags = [
|
||||
]
|
||||
timestamp_override = "event.ingested"
|
||||
type = "eql"
|
||||
|
||||
query = '''
|
||||
process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and
|
||||
process.working_directory in ("/tmp", "/var/tmp", "/dev/shm") and
|
||||
process.args regex~ """\.[a-z0-9_\-][a-z0-9_\-\.]{1,254}""" and
|
||||
not process.name in ("ls", "find", "grep", "git", "jq", "basename")
|
||||
not process.name in (
|
||||
"ls", "find", "grep", "git", "jq", "basename", "check_snmp", "snmpget", "snmpwalk", "cc1plus", "snap",
|
||||
"command-not-found"
|
||||
)
|
||||
'''
|
||||
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
[[rule.threat.technique]]
|
||||
id = "T1564"
|
||||
name = "Hide Artifacts"
|
||||
reference = "https://attack.mitre.org/techniques/T1564/"
|
||||
|
||||
[[rule.threat.technique.subtechnique]]
|
||||
id = "T1564.001"
|
||||
name = "Hidden Files and Directories"
|
||||
reference = "https://attack.mitre.org/techniques/T1564/001/"
|
||||
|
||||
|
||||
|
||||
[rule.threat.tactic]
|
||||
id = "TA0005"
|
||||
name = "Defense Evasion"
|
||||
reference = "https://attack.mitre.org/tactics/TA0005/"
|
||||
|
||||
[[rule.threat]]
|
||||
framework = "MITRE ATT&CK"
|
||||
|
||||
@@ -108,4 +110,3 @@ framework = "MITRE ATT&CK"
|
||||
id = "TA0003"
|
||||
name = "Persistence"
|
||||
reference = "https://attack.mitre.org/tactics/TA0003/"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user