The Group-IB Digital Forensics and Incident Response (DFIR) team has recently uncovered a sophisticated technique that abuses Linux’s Pluggable Authentication Modules (PAM) to create persistent backdoors on compromised systems. This new attack vector leverages the flexibility of the pam_exec module, which allows the execution of external commands during the PAM authentication process. This method, not yet included in the MITRE ATT&CK framework, poses significant risks by enabling attackers to gain and maintain privileged access to targeted hosts.
PAM is a versatile framework designed to manage user authentication and authorization across various applications by separating these processes from specific application requirements. While this modularity offers increased flexibility, it also introduces potential security vulnerabilities. Attackers have exploited PAM’s flexibility by modifying the SSH authentication configuration to invoke malicious scripts through pam_exec. These scripts can perform actions such as data exfiltration and credential theft, even if login attempts fail, effectively avoiding detection by conventional security measures.
The malicious scripts executed through pam_exec can silently transfer sensitive information, such as usernames, environment variables, and authentication details, to remote servers controlled by attackers. This stealthy approach ensures that traces of data exfiltration are not captured in system logs, making forensic investigations more challenging. The ability of attackers to create persistent backdoors and steal credentials highlights a critical vulnerability in PAM’s design, as it transmits values in plaintext rather than encrypting them.
To mitigate these risks, organizations must implement proactive defenses and enhanced monitoring strategies. Privilege Management for Unix & Linux (PMUL) can help prevent unauthorized access by using restricted versions of high-risk commands. Additionally, file integrity monitoring (FIM) can aid in detecting suspicious changes to PAM configurations. Monitoring PAM API usage in sandboxed environments is crucial for identifying potential threats. As the Linux community continues to address these vulnerabilities, it is essential for organizations to prioritize robust security measures to safeguard against PAM-based attacks.
Reference: