From 440a7fbdee35424f4979a8ae63a42ee290d393ee Mon Sep 17 00:00:00 2001 From: Samirbous <64742097+Samirbous@users.noreply.github.com> Date: Tue, 26 Jan 2021 08:45:38 +0100 Subject: [PATCH] [New Rule] SSH Authorized Keys File Modification (#754) * [New Rule] SSH Authorized Keys File Modification * excluded some noisy procs * Update rules/cross-platform/persistence_ssh_authorized_keys_modification.toml Co-authored-by: David French <56409778+threat-punter@users.noreply.github.com> * Update rules/cross-platform/persistence_ssh_authorized_keys_modification.toml Co-authored-by: David French <56409778+threat-punter@users.noreply.github.com> * Update persistence_ssh_authorized_keys_modification.toml * Update rules/cross-platform/persistence_ssh_authorized_keys_modification.toml Co-authored-by: Brent Murphy <56412096+bm11100@users.noreply.github.com> Co-authored-by: David French <56409778+threat-punter@users.noreply.github.com> Co-authored-by: Brent Murphy <56412096+bm11100@users.noreply.github.com> --- ...ence_ssh_authorized_keys_modification.toml | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 rules/cross-platform/persistence_ssh_authorized_keys_modification.toml diff --git a/rules/cross-platform/persistence_ssh_authorized_keys_modification.toml b/rules/cross-platform/persistence_ssh_authorized_keys_modification.toml new file mode 100644 index 000000000..4cb321fe7 --- /dev/null +++ b/rules/cross-platform/persistence_ssh_authorized_keys_modification.toml @@ -0,0 +1,56 @@ +[metadata] +creation_date = "2020/12/22" +maturity = "production" +updated_date = "2020/12/22" + +[rule] +author = ["Elastic"] +description = """ +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). +""" +from = "now-9m" +index = ["auditbeat-*", "logs-endpoint.events.*"] +language = "kuery" +license = "Elastic License" +name = "SSH Authorized Keys File Modification" +risk_score = 47 +rule_id = "2215b8bd-1759-4ffa-8ab8-55c8e6b32e7f" +severity = "medium" +tags = ["Elastic", "Host", "Linux", "macOS", "Threat Detection", "Persistence"] +type = "query" + +query = ''' +event.category:file and event.type:(change or creation) and + file.name:("authorized_keys" or "authorized_keys2") and + not process.executable: + (/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 + /usr/bin/bsdtar or + /usr/bin/nautilus or + /usr/bin/scp or + /usr/bin/touch or + /var/lib/docker/*) +''' + + +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1098" +name = "Account Manipulation" +reference = "https://attack.mitre.org/techniques/T1098/" +[[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/"