Potential Backdoor Execution Through PAM_EXEC

Last updated 15 days ago on 2025-04-29
Created 15 days ago on 2025-04-29

About

This rule detects SSH session ID change followed by a suspicious SSHD child process, this may indicate the successful execution of a potentially malicious process through the Pluggable Authentication Module (PAM) utility. PAM is a framework used by Linux systems to authenticate users. Adversaries may create malicious PAM modules that grant them persistence onto the target every time a user logs in by executing a backdoor script or command.
Tags
Domain: EndpointOS: LinuxUse Case: Threat DetectionTactic: Credential AccessTactic: PersistenceData Source: Elastic DefendLanguage: eql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Persistence (TA0003)(opens in a new tab or window)

Credential Access (TA0006)(opens in a new tab or window)

False Positive Examples
Trusted system module updates or allowed Pluggable Authentication Module (PAM) daemon configuration changes.
License
Elastic License v2(opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-endpoint.events.process*
Related Integrations

endpoint(opens in a new tab or window)

Query
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(opens in a new tab or window).