Skip to main content
Mallory
← Back to News
credential-access-methodpersistence-methoddefense-evasion-methodcommand-and-control-method

Linux PAM `pam_exec` Abuse Enables Stealthy SSH Credential Theft

Attack Tradecraft · 2 sources · Updated 5mo ago · First seen May 8, 2026

Linux PAM `pam_exec` Abuse Enables Stealthy SSH Credential Theft

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.

Who uses this technique?Get the actors, campaigns, and ATT&CK mapping behind it.
Get the tradecraft
Event timeline

How this story unfolded

Events from the most recent confirmed update back to the earliest known activity.

2 events · Oct 26, 2023 – Sep 11, 2025
  1. Sep 11, 20251y ago

    Group-IB details PAM abuse via pam_exec for SSH credential theft

    Group-IB published a technical analysis showing how Linux PAM configuration can be modified to invoke pam_exec during SSH authentication, enabling malicious scripts to run even on failed login attempts. The write-up describes exfiltration of user and environment data via netcat while standard logs may only show failed SSH authentication, and includes hardening recommendations.

  2. Oct 26, 20233y ago

    Unit 42 describes malware abuse of Linux PAM authentication modules

    Palo Alto Networks Unit 42 published research on malware using Linux PAM authentication modules for malicious activity. The report documented PAM abuse as a persistence and credential-theft mechanism on Linux systems.

    When PAM Goes Rogue: Malware Uses Authentication Modules for Mischief
Linked entities

Related entities

Vulnerabilities, threat actors, malware, products, organizations, and breaches Mallory has linked to this story.

Open in app →

Affected products

1 linked
Linux
Do you run this?Get the adversaries, campaigns, and ATT&CK mapping behind this technique, with detections ready to deploy.
See Who Uses This Technique
Mallory platform

See the full picture, correlated to your attack surface.

This page covers what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which threat actors are using it right now, and what to deploy next.

Exposure mappingMap indicators from this story to your assets and identify affected systems in minutes.
Threat actor evidenceEvery observed campaign, victim, and pivot linked to actors named in this story.
Associated malwareMalware, exploits, and IOCs connected to the activity described here.
Detection signaturesYARA, Sigma, and Snort rules deployed to your SIEM as soon as they’re published.
Scheduled alertsGet matching new stories delivered to your team as they break, not the next morning.
AI threadsAsk questions about this story and take action on the answers.