Backdoors and covert channels
PAM Backdoors in Linux Rootkits: Traces and Checks
How Linux rootkits backdoor PAM with a replaced pam_unix.so or with preloaded hooks on libpam, what each leaves behind, and how to verify PAM on a host.
- Goal
- Backdoors and covert channels
- Layer
- Userland
- Platforms
- Linux
- ATT&CK
- T1556.003
- Also known as
- pam_unix backdoor, PAM hooking
- Checked by
- Linux kernel
Overview
Most Linux programs that check a password do it through PAM, the Pluggable Authentication Modules library: sshd, su, sudo, login and others. The program calls libpam, and libpam runs the modules that /etc/pam.d/<service> lists, pam_unix.so first among them for local passwords.
A PAM backdoor makes that check succeed for a secret password, whatever account is named, and often records the real passwords that pass through it. It gives an intruder a way back in that survives password changes and key rotation. MITRE ATT&CK lists it as Modify Authentication Process: Pluggable Authentication Modules (T1556.003).
Rootkit families do it in two ways. Some replace a PAM module on disk. Others never touch PAM's files: a preloaded library replaces libpam's functions inside every process that authenticates. The two leave very different traces. Linux Persistence covers the configuration-level variants, such as pam_exec and pam_permit lines.
How it works
| Form | What changes | What stays clean | Example |
|---|---|---|---|
| Replaced module | pam_unix.so (or another packaged module) in the PAM module folder: /usr/lib/x86_64-linux-gnu/security/ on Debian and Ubuntu, /usr/lib64/security/ on RHEL | /etc/pam.d is untouched | Skidmap |
| Added module | A new .so and a line in /etc/pam.d that loads it | Packaged modules | Plague, outside the catalogue |
| In-process hooks | A preloaded library defines pam_authenticate and related functions, so programs call it instead of libpam | All PAM files and modules verify as packaged | Azazel, Symbiote |
The third form works because libpam is a shared library like libc. A library in /etc/ld.so.preload that defines functions with libpam's names takes their place in sshd, su and every other dynamically linked program. It answers "success" for the backdoor password and passes everything else on.
How families use it
| Family | Form | What it does | Source |
|---|---|---|---|
| Skidmap | Replaced module | The 2019 version replaces pam_unix.so with a build that "accepts a specific password for any users"; Trend Micro detects it as Backdoor.Linux.PAMDOR.A. Trustwave's 2023 report on a newer variant does not mention PAM | Trend Micro |
| Azazel | In-process hooks | Its preloaded library replaces pam_authenticate, pam_open_session, pam_acct_mgmt, pam_sm_authenticate and getpwnam, giving a backdoor account for ssh and su set at build time. It can also remove its terminals from utmp and wtmp | Repository |
| Symbiote | In-process hooks | Hooks "a few Linux Pluggable Authentication Module (PAM) functions" so that a hard-coded password logs in "as any user", through "any service that uses PAM", including SSH. Its read hook also captures credentials typed into ssh and scp | Intezer |
Outside the catalogue, Nextron Systems described Plague in 2025: a malicious PAM module with a static backdoor password, which VirusTotal engines did not flag for a year. Nextron does not say how it is installed, and calls its attribution unclear (Nextron).
Traces it leaves
| Form | Where | Trace |
|---|---|---|
| Replaced module | Package database | pam_unix.so digest differs from the package (dpkg -V, rpm -V, debsums) |
| Replaced module | File times | Module modified long after the package install in /var/log/dpkg.log or /var/log/dnf.rpm.log |
| Replaced or added module | Strings in the module | A hard-coded password or a log path for captured passwords |
| Added module | /etc/pam.d | A line naming an unfamiliar module, often by full path; a .so that no package owns |
| In-process hooks | The preloaded library | Its dynamic symbol table defines pam_authenticate and other pam_* names, which only libpam and PAM modules should define |
| In-process hooks | /proc/<pid>/maps of sshd | An unexpected library mapped next to libpam |
| All | Authentication logs | Password logins to accounts that normally use keys or are locked; logins missing from wtmp (Azazel) |
The last row is an inference: a backdoor login still goes through the service, which logs what PAM told it. Check it against what you know of each account.
How to check a host
Verify the PAM packages. Package databases sit on the same disk and root can rewrite them. On a host you distrust, compare with a package downloaded fresh from the distribution's mirror (apt-get download libpam-modules, then dpkg-deb -x).
dpkg --verify libpam-modules libpam-modules-bin libpam-runtime # Debian, Ubuntu: a '5' in the third column means the digest differs
debsums -c libpam-modules # same check with debsums
rpm -V pam # RHEL family: '5' in the third column, as in S.5....T.
grep -rnE '^\s*-?(auth|account|password|session)\s+\S+\s+/' /etc/pam.d/ # modules loaded by full path
Look for in-process hooks from a static shell, since the hooks also run in your tools (why):
/media/ir/busybox cat /etc/ld.so.preload
/media/ir/busybox awk '{print $6}' /proc/$(/media/ir/busybox pidof -s sshd)/maps | /media/ir/busybox sort -u
readelf --dyn-syms -W /path/to/lib.so | awk '$7 != "UND"' | grep -E ' pam_[a-z_]+$'
A library other than libpam or a PAM module that defines pam_authenticate is a finding in itself. Run readelf on a clean machine or from a static build.
Offline, from an image.
R=/mnt/evidence
rpm --root "$R" -V pam 2>/dev/null # RHEL family
debsums --root="$R" -c libpam-modules 2>/dev/null # Debian, Ubuntu
ls -la --time-style=full-iso "$R"/usr/lib/x86_64-linux-gnu/security/ "$R"/usr/lib64/security/ 2>/dev/null
strings -n 6 "$R"/usr/lib/x86_64-linux-gnu/security/pam_unix.so | less
cat "$R"/etc/ld.so.preload 2>/dev/null
Linux Forensics covers the PAM configuration artifact and package verification in more depth.
What the checker looks for
The linuxkernel module sees the in-process form, through the preload file and the libraries it names:
- "Library preloaded into every program" and, outside the packaged library folders, "Preloaded library outside the system library folders".
- "Library replaces libc directory and file functions" for Azazel and Symbiote, which also replace
readdir,fopenand similar names. The detail sheet lists the authentication names the library defines (pam_authenticate,pam_open_session,pam_acct_mgmt,pam_sm_authenticate,getpwnam,getspnam,crypt) without a finding of their own. A preloaded library that replaced only PAM functions would raise the preload findings, with its PAM names in the detail sheet; the same library outside the preload file would not be listed at all.
It does not read /etc/pam.d or the PAM module folders, and the collect script does not gather them. A replaced pam_unix.so, as in Skidmap, raises nothing. Linux Persistence checks PAM configuration and modules offline.
Mitigation and recovery
- Verify and watch. Check PAM packages against fresh copies after any intrusion, and alert on writes to the PAM module folders,
/etc/pam.dand/etc/ld.so.preload. - Use keys for SSH. With
UsePAM yes, sshd runs PAM authentication through password and keyboard-interactive logins (sshd_config(5)). Turning both off keeps a backdoor password from being used over SSH.su,sudoand console logins still go through PAM. - Ship authentication logs off the host, so that a rootkit that edits local records does not erase them.
Recovery. Reinstalling the PAM package removes a replaced module but not whoever planted it, nor the root access that took. Rebuild from known-good media. Every password typed on the host while the backdoor was in place went through it, so rotate them all, and treat SSH and scp credentials used from a Symbiote host as captured.
Sources
Primary public reports, newest first.
- 2025-08-01Plague: A Newly Discovered PAM-Based Backdoor for LinuxNextron Systems
- 2022-06-09Symbiote Deep-Dive: Analysis of a New, Nearly-Impossible-to-Detect Linux ThreatIntezer (with BlackBerry)
- 2019-09-16Skidmap Linux Malware Uses Rootkit Capabilities to Hide Cryptocurrency-Mining PayloadTrend Micro
- 2014-02-14Azazel source repositoryGitHub
See also
Related techniques
- Dynamic linker preloading (LD_PRELOAD)Hiding
- Magic-packet backdoorsBackdoors and covert channels