Potential OpenSSH Backdoor Logging Activity

edit

Identifies a Secure Shell (SSH) client or server process creating or writing to a known SSH backdoor log file. Adversaries may modify SSH related binaries for persistence or credential access via patching sensitive functions to enable unauthorized access or to log SSH credentials for exfiltration.

Rule type: eql

Rule indices:

  • auditbeat-*
  • logs-endpoint.events.*

Severity: high

Risk score: 73

Runs every: 5 minutes

Searches indices from: now-9m (Date Math format, see also Additional look-back time)

Maximum alerts per execution: 100

References:

Tags:

  • Elastic
  • Host
  • Linux
  • Threat Detection
  • Persistence
  • Credential Access

Version: 100 (version history)

Added (Elastic Stack release): 7.12.0

Last modified (Elastic Stack release): 8.5.0

Rule authors: Elastic

Rule license: Elastic License v2

Potential false positives

edit

Updates to approved and trusted SSH executables can trigger this rule.

Investigation guide

edit

Rule query

edit
file where event.type == "change" and process.executable :
("/usr/sbin/sshd", "/usr/bin/ssh") and ( (file.name : (".*",
"~*", "*~") and not file.name : (".cache", ".viminfo",
".bash_history")) or file.extension : ("in", "out", "ini", "h",
"gz", "so", "sock", "sync", "0", "1", "2", "3", "4", "5", "6", "7",
"8", "9") or file.path : ( "/private/etc/*--",
"/usr/share/*", "/usr/include/*", "/usr/local/include/*",
"/private/tmp/*", "/private/var/tmp/*", "/usr/tmp/*",
"/usr/share/man/*", "/usr/local/share/*",
"/usr/lib/*.so.*", "/private/etc/ssh/.sshd_auth",
"/usr/bin/ssd", "/private/var/opt/power",
"/private/etc/ssh/ssh_known_hosts", "/private/var/html/lol",
"/private/var/log/utmp", "/private/var/lib",
"/var/run/sshd/sshd.pid", "/var/run/nscd/ns.pid",
"/var/run/udev/ud.pid", "/var/run/udevd.pid" ) )

Threat mapping

edit

Framework: MITRE ATT&CKTM

Rule version history

edit
Version 100 (8.5.0 release)
  • Formatting only
Version 4 (8.4.0 release)
  • Updated query, changed from:

    file where event.type == "change" and process.executable :
    ("/usr/sbin/sshd", "/usr/bin/ssh") and ( file.name : (".*",
    "~*") or file.extension : ("in", "out", "ini", "h", "gz", "so",
    "sock", "sync", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9") or
    file.path : ( "/private/etc/*--", "/usr/share/*",
    "/usr/include/*", "/usr/local/include/*",
    "/private/tmp/*", "/private/var/tmp/*", "/usr/tmp/*",
    "/usr/share/man/*", "/usr/local/share/*",
    "/usr/lib/*.so.*", "/private/etc/ssh/.sshd_auth",
    "/usr/bin/ssd", "/private/var/opt/power",
    "/private/etc/ssh/ssh_known_hosts", "/private/var/html/lol",
    "/private/var/log/utmp", "/private/var/lib",
    "/var/run/sshd/sshd.pid", "/var/run/nscd/ns.pid",
    "/var/run/udev/ud.pid", "/var/run/udevd.pid" ) )
Version 2 (8.2.0 release)
  • Formatting only