Persistence (TA0003)(external, opens in a new tab or window)
Credential Access (TA0006)(external, opens in a new tab or window)
text code block:sequence by process.entity_id with maxspan=3s [process where host.os.type == "linux" and event.type == "change" and event.action == "session_id_change" and process.name in ("ssh", "sshd")] [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.parent.name in ("ssh", "sshd") and process.args_count == 2 and ( process.name like ("perl*", "python*", "php*", "ruby*", "lua*") or process.executable like ( "/tmp/*", "/var/tmp/*", "/dev/shm/*", "./*", "/boot/*", "/sys/*", "/lost+found/*", "/media/*", "/proc/*", "/var/backups/*", "/var/log/*", "/var/mail/*", "/var/spool/*") or process.name like ".*" )]
Install detection rules in Elastic Security
Detect Potential Backdoor Execution Through PAM_EXEC in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(external, opens in a new tab or window).