Hiding
LD_PRELOAD and ld.so.preload Rootkits: Traces and Checks
How userland rootkits use LD_PRELOAD and /etc/ld.so.preload to replace libc functions in every program, what they leave on disk, and how to check a host.
- Goal
- Hiding
- Layer
- Userland
- Platforms
- Linux
- Also known as
- LD_PRELOAD, ld.so.preload, Dynamic linker hijacking
- Checked by
- Linux kernel
Overview
On Linux, most programs are dynamically linked. When one starts, the dynamic linker (ld.so) loads the shared libraries it needs, libc first among them. Preloading tells the linker to load one more library before all the others. A preloaded library that defines functions with libc's own names, such as readdir or fopen, replaces them in that program. Its version calls the real one and filters the answer: a directory entry, a /proc PID or a line of /proc/net/tcp disappears.
This is a userland technique. No kernel code runs, so it works on any kernel and leaves no module, taint or signature trace. MITRE ATT&CK lists it as Dynamic Linker Hijacking (T1574.006). Public tools date back more than a decade: Azazel (2014) describes itself as based on the older Jynx, and libprocesshider dates from the same year (Sysdig). Crimeware and espionage tools still use it, because it is simple and needs no kernel build.
Its weakness is just as simple: programs that do not go through the dynamic linker never see it.
How it works
The linker reads preload settings from three places, in this order (ld.so(8)):
| Setting | Reaches | Who can set it | Notes |
|---|---|---|---|
LD_PRELOAD environment variable | The process and the children that inherit its environment | Any user, for their own processes; also /etc/environment, shell startup files and Environment= in systemd units | In secure-execution mode (set-user-ID programs), paths with slashes are ignored |
--preload option | One program started through ld.so directly | Whoever runs it | Rare |
/etc/ld.so.preload | Every dynamically linked program on the system | Root | ld.so(8) calls its effect system-wide; the file is absent on stock Debian, Ubuntu and RHEL installs |
Elastic notes that LD_PRELOAD "works on a per-process basis and does not require root access", while /etc/ld.so.preload injects the library into every dynamically linked binary (Elastic, 2026).
What preloaded rootkits replace, from the families below:
| Replaced functions | Effect in every program that loads the library |
|---|---|
readdir, readdir64, opendir | Files and /proc/<pid> entries left out of ls, ps, top and shell globbing |
fopen, fopen64, open, stat family | /proc/net/tcp lines removed; hidden paths refused |
execve | Detects ldd and similar tools and hides the library from them |
accept, setsockopt, pcap_loop | Backdoor connections; traffic removed from local captures |
PAM functions, read | Backdoor passwords and captured credentials; see PAM backdoors |
Not affected: statically linked programs, programs that make system calls directly, anything that reads the kernel by other means, and processes already running when the setting changed (Sysdig, libprocesshider).
How families use it
| Family | How it preloads | What it hides or adds |
|---|---|---|
| Azazel | Install step writes /lib/libselinux.so into /etc/ld.so.preload | Paths containing __, its own preload file, processes marked by an environment variable, ports, a PAM backdoor. Moves /etc/ld.so.preload aside while ldd or unhide runs |
| libprocesshider | A line in /etc/ld.so.preload; TeamTNT used /usr/local/lib/systemhealt.so (Alien Labs) | One process name, through readdir and readdir64 only |
| Symbiote | Intezer says it is loaded "into all running processes using LD_PRELOAD" (Intezer) | Files, processes, /proc/net/tcp lines, traffic in capture tools; PAM backdoor; credential capture |
| PUMAKIT | Its userland part, Kitsune, is referenced as LD_PRELOAD=/lib64/libs.so; Elastic does not say where the variable is set (Elastic) | Elastic says Kitsune plays a part in persistence and stealth beside the kernel module |
Outside the catalogue: MITRE's Winnti for Linux entry describes a modified Azazel; Unit 42 describes TeamTNT's Hildegard writing /etc/ld.so.preload to hide tmate, xmrig and ziggy (Unit 42). When its eBPF hiding cannot load, LinkPro writes /etc/libld.so into /etc/ld.so.preload and hooks fopen, getdents, readdir and kill instead (Synacktiv).
Traces it leaves
| Where | Trace | Notes |
|---|---|---|
/etc/ld.so.preload | Any line, with its file times | Rarely legitimate; the Snoopy command logger is one known user |
| The library | A .so that no package owns, often named after a system library (libselinux.so) | Its dynamic symbol table defines libc names: readdir, fopen, execve, pam_authenticate |
/etc/environment, shell startup files, unit files | LD_PRELOAD= | For the per-process route |
/proc/<pid>/maps | The same unexpected library mapped into nearly every process | Live only |
/proc/<pid>/environ | LD_PRELOAD in a process's starting environment | Live only |
/etc/.ld.so.preload | Azazel's temporary name while ldd or unhide runs | Azazel only |
| Strings in the library | Hidden names, ports, prefixes | Azazel XOR-encodes its strings |
How to check a host
Live. Every dynamically linked tool, your shell included, runs through the library. Use a statically linked toolkit from trusted media and start a static shell first, or your shell's globbing goes through the hooked readdir.
/media/ir/busybox sh # static shell from trusted media; run the rest inside it
B=/media/ir/busybox # call every tool through it, never through PATH
$B cat /etc/ld.so.preload
$B grep -l LD_PRELOAD /proc/[0-9]*/environ 2>/dev/null
$B grep -h '\.so' /proc/[0-9]*/maps | $B awk '{print $6}' | $B sort | $B uniq -c | $B sort -rn | $B head -30
- If the system's
cat /etc/ld.so.preloadsays the file does not exist but the staticcatprints it, a preload rootkit is active. - A library mapped into almost every process that is not libc, the linker or a known agent is the live signature of system-wide preloading.
- Never run
lddon a suspect binary: the ldd manual warns it may execute it, and Azazel and Symbiote hide from it. Usereadelf -d. - A collection made on the live host by a dynamically linked script is blind in the same way.
Offline, from an image.
R=/mnt/evidence
ls -la --time-style=full-iso "$R"/etc/ld.so.preload "$R"/etc/.ld.so.preload 2>&1; cat "$R"/etc/ld.so.preload
readelf --dyn-syms -W /path/to/lib.so | awk '$7 != "UND"' | grep -wE 'readdir|readdir64|fopen|fopen64|execve|accept|pcap_loop|pam_authenticate'
grep -rn 'LD_PRELOAD' "$R"/etc/environment "$R"/etc/profile* "$R"/etc/systemd "$R"/root/.[a-z]* "$R"/home/*/.[a-z]* 2>/dev/null
dpkg --root="$R" -S /path/to/lib.so 2>&1 # or: rpm --root "$R" -qf /path/to/lib.so
A library that defines libc's directory and file functions at a path no package owns is a finding in itself. Memory: Volatility 3's linux.library_list and linux.envars show libraries and environments per process. The ld.so.preload guide and Linux Forensics' ld.so.preload artifact go further.
What the checker looks for
The linuxkernel module reads etc/ld.so.preload, the libraries it names (the collect script copies them) and other shared objects in the collection:
- "Library preloaded into every program" for each entry in
/etc/ld.so.preload. - "Preloaded library outside the system library folders" when the library is not in
/lib,/usr/lib,/lib64,/usr/lib64or their multiarch folders. It says whether a dpkg package owns it. - "Library replaces libc directory and file functions" when a library defines
readdir,opendir,fopen,open, thestatfamily,unlinkand similar names. It is rated high when the library is preloaded, and still raised for a library outside the packaged folders that nothing preloads, sinceLD_PRELOADmay load it. The detail sheet also lists, without findings of their own, the process, network, authentication and logging names it defines. - "Preloaded library not read" when the collection lacks the library, or it is over 256 KiB in a system folder.
It does not read LD_PRELOAD in environment, profile or unit files, /proc/<pid>/maps or environ. On a host where Azazel was active during a live collection, the collect script may not have seen /etc/ld.so.preload at all, so a missing file proves nothing. Linux Persistence reads the configuration side.
Mitigation and recovery
- Watch the file. Alert on any write or rename of
/etc/ld.so.preload, including the temporary name; Elastic ships rules for preload modification and unusual preload variables (Elastic, 2026). - Keep static tools. Intezer recommends statically linked security tools, which userland rootkits cannot reach (Intezer).
- Limit root. System-wide preloading needs root; per-process
LD_PRELOADdoes not.
Recovery. Preserve the preload file, the library and their times, and capture memory if the hidden processes matter. Remove the entry from a rescue boot, the mounted image or a static shell, then delete the library. Processes already running keep it mapped until they restart. What the library hid (a miner, a backdoor, a credential log) is the real intrusion. Anyone who wrote /etc/ld.so.preload had root, so rebuild unless you can account for everything that root session did, and rotate credentials.
Sources
Primary public reports, newest first.
- 2026-04-02Hooked on Linux: Rootkit Detection EngineeringElastic Security Labs
- 2026-03-05Hooked on Linux: Rootkit Taxonomy, Hooking Techniques and TradecraftElastic Security Labs
- 2025-10-14LinkPro: eBPF rootkit analysisSynacktiv
- 2024-12-12Declawing PUMAKITElastic Security Labs
- 2022-06-09Symbiote Deep-Dive: Analysis of a New, Nearly-Impossible-to-Detect Linux ThreatIntezer (with BlackBerry)
- 2021-02-03Hildegard: New TeamTNT Cryptojacking Malware Targeting KubernetesPalo Alto Networks Unit 42
- 2021-01-27TeamTNT delivers malware with new detection evasion toolAT&T Alien Labs (LevelBlue)
- 2014-08-28Hiding Linux processes for fun + profitSysdig
- 2014-02-14Azazel source repositoryGitHub
See also
Related techniques
- PAM backdoorsBackdoors and covert channels
- System call table hookingHiding
- eBPF programs as rootkitsHiding
Families that use it
- AzazelLinux user-land rootkit
- libprocesshiderLinux user-land rootkit
- PUMAKITLinux LKM rootkit
- SymbioteLinux user-land rootkit