Linux PAM `pam_exec` Abuse Enables Stealthy SSH Credential Theft
Attack Tradecraft · 2 sources · Updated 5mo ago · First seen May 8, 2026

Group-IB reported that attackers can abuse Linux Pluggable Authentication Modules (PAM) by modifying SSH authentication settings to invoke the pam_exec module, turning a legitimate feature into a stealthy credential-theft and persistence mechanism. In the demonstrated technique, a malicious script is triggered during SSH login attempts—including failed authentications—to collect usernames and environment data and send them to a remote host, while standard logs may show only unsuccessful SSH access and not the hidden execution path.
The technique affects a core authentication framework used by services such as sshd, login, su, and passwd, making PAM configuration integrity a high-value defensive priority on Linux systems. Group-IB said the same approach could support backdoors, covert command execution, and long-term persistence, and recommended hardening measures including timely patching, enforcing SELinux or AppArmor, monitoring with Auditd and Wazuh, and using tools such as PSAD, AIDE, and rkhunter to detect unauthorized changes and suspicious activity.


