2021-01-26 08:45:38 +01:00
|
|
|
[metadata]
|
|
|
|
|
creation_date = "2020/12/22"
|
2023-01-04 09:30:07 -05:00
|
|
|
integration = ["endpoint"]
|
2021-01-26 08:45:38 +01:00
|
|
|
maturity = "production"
|
2023-10-23 16:28:58 +02:00
|
|
|
min_stack_comments = "Multiple field support in the New Terms rule type was added in Elastic 8.6"
|
|
|
|
|
min_stack_version = "8.6.0"
|
|
|
|
|
updated_date = "2023/09/22"
|
2021-01-26 08:45:38 +01:00
|
|
|
|
|
|
|
|
[rule]
|
|
|
|
|
author = ["Elastic"]
|
|
|
|
|
description = """
|
2021-02-17 19:49:58 -09:00
|
|
|
The Secure Shell (SSH) authorized_keys file specifies which users are allowed to log into a server using public key
|
|
|
|
|
authentication. Adversaries may modify it to maintain persistence on a victim host by adding their own public key(s).
|
2021-01-26 08:45:38 +01:00
|
|
|
"""
|
|
|
|
|
from = "now-9m"
|
|
|
|
|
index = ["auditbeat-*", "logs-endpoint.events.*"]
|
|
|
|
|
language = "kuery"
|
2021-03-03 22:12:11 -09:00
|
|
|
license = "Elastic License v2"
|
2021-01-26 08:45:38 +01:00
|
|
|
name = "SSH Authorized Keys File Modification"
|
|
|
|
|
risk_score = 47
|
|
|
|
|
rule_id = "2215b8bd-1759-4ffa-8ab8-55c8e6b32e7f"
|
|
|
|
|
severity = "medium"
|
2023-10-23 16:28:58 +02:00
|
|
|
tags = ["Domain: Endpoint",
|
|
|
|
|
"OS: Linux",
|
|
|
|
|
"OS: macOS",
|
|
|
|
|
"Use Case: Threat Detection",
|
|
|
|
|
"Tactic: Lateral Movement",
|
|
|
|
|
"Tactic: Persistence",
|
|
|
|
|
"Data Source: Elastic Defend"
|
|
|
|
|
]
|
2021-02-17 19:49:58 -09:00
|
|
|
timestamp_override = "event.ingested"
|
2023-10-23 16:28:58 +02:00
|
|
|
type = "new_terms"
|
2021-01-26 08:45:38 +01:00
|
|
|
|
|
|
|
|
query = '''
|
2022-08-24 10:38:49 -06:00
|
|
|
event.category:file and event.type:(change or creation) and
|
2023-01-27 19:51:22 +00:00
|
|
|
file.name:("authorized_keys" or "authorized_keys2" or "/etc/ssh/sshd_config" or "/root/.ssh") and
|
2021-01-26 08:45:38 +01:00
|
|
|
not process.executable:
|
2022-08-24 10:38:49 -06:00
|
|
|
(/Library/Developer/CommandLineTools/usr/bin/git or
|
|
|
|
|
/usr/local/Cellar/maven/*/libexec/bin/mvn or
|
|
|
|
|
/Library/Java/JavaVirtualMachines/jdk*.jdk/Contents/Home/bin/java or
|
|
|
|
|
/usr/bin/vim or
|
|
|
|
|
/usr/local/Cellar/coreutils/*/bin/gcat or
|
2021-01-26 08:45:38 +01:00
|
|
|
/usr/bin/bsdtar or
|
2022-08-24 10:38:49 -06:00
|
|
|
/usr/bin/nautilus or
|
2021-01-26 08:45:38 +01:00
|
|
|
/usr/bin/scp or
|
2022-08-24 10:38:49 -06:00
|
|
|
/usr/bin/touch or
|
2022-05-09 07:50:27 -08:00
|
|
|
/var/lib/docker/* or
|
2023-01-27 19:51:22 +00:00
|
|
|
/usr/bin/google_guest_agent or
|
|
|
|
|
/opt/jc/bin/jumpcloud-agent)
|
2021-01-26 08:45:38 +01:00
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
[[rule.threat]]
|
|
|
|
|
framework = "MITRE ATT&CK"
|
2023-10-23 16:28:58 +02:00
|
|
|
|
2021-01-26 08:45:38 +01:00
|
|
|
[[rule.threat.technique]]
|
|
|
|
|
id = "T1098"
|
|
|
|
|
name = "Account Manipulation"
|
|
|
|
|
reference = "https://attack.mitre.org/techniques/T1098/"
|
2023-10-23 16:28:58 +02:00
|
|
|
|
2021-01-26 08:45:38 +01:00
|
|
|
[[rule.threat.technique.subtechnique]]
|
|
|
|
|
id = "T1098.004"
|
|
|
|
|
name = "SSH Authorized Keys"
|
|
|
|
|
reference = "https://attack.mitre.org/techniques/T1098/004/"
|
|
|
|
|
|
|
|
|
|
[rule.threat.tactic]
|
|
|
|
|
id = "TA0003"
|
|
|
|
|
name = "Persistence"
|
|
|
|
|
reference = "https://attack.mitre.org/tactics/TA0003/"
|
2021-02-17 19:49:58 -09:00
|
|
|
|
2023-01-27 19:51:22 +00:00
|
|
|
[[rule.threat]]
|
|
|
|
|
framework = "MITRE ATT&CK"
|
2023-10-23 16:28:58 +02:00
|
|
|
|
2023-01-27 19:51:22 +00:00
|
|
|
[[rule.threat.technique]]
|
|
|
|
|
id = "T1563"
|
|
|
|
|
name = "Remote Service Session Hijacking"
|
|
|
|
|
reference = "https://attack.mitre.org/techniques/T1563/"
|
2023-10-23 16:28:58 +02:00
|
|
|
|
2023-01-27 19:51:22 +00:00
|
|
|
[[rule.threat.technique.subtechnique]]
|
|
|
|
|
id = "T1563.001"
|
|
|
|
|
name = "SSH Hijacking"
|
|
|
|
|
reference = "https://attack.mitre.org/techniques/T1563/001/"
|
|
|
|
|
|
|
|
|
|
[[rule.threat.technique]]
|
|
|
|
|
id = "T1021"
|
|
|
|
|
name = "Remote Services"
|
|
|
|
|
reference = "https://attack.mitre.org/techniques/T1021/"
|
2023-10-23 16:28:58 +02:00
|
|
|
|
2023-01-27 19:51:22 +00:00
|
|
|
[[rule.threat.technique.subtechnique]]
|
|
|
|
|
id = "T1021.004"
|
|
|
|
|
name = "SSH"
|
|
|
|
|
reference = "https://attack.mitre.org/techniques/T1021/004/"
|
|
|
|
|
|
|
|
|
|
[rule.threat.tactic]
|
|
|
|
|
id = "TA0008"
|
|
|
|
|
name = "Lateral Movement"
|
|
|
|
|
reference = "https://attack.mitre.org/tactics/TA0008/"
|
2023-10-23 16:28:58 +02:00
|
|
|
|
|
|
|
|
[rule.new_terms]
|
|
|
|
|
field = "new_terms_fields"
|
|
|
|
|
value = ["host.id", "process.executable", "file.path"]
|
|
|
|
|
|
|
|
|
|
[[rule.new_terms.history_window_start]]
|
|
|
|
|
field = "history_window_start"
|
|
|
|
|
value = "now-7d"
|