Skip to content

Linux user-land rootkit

Azazel Userland Rootkit: Traces and Offline Checks

Azazel is an open-source LD_PRELOAD rootkit that hides files, processes, ports and its own preload file, reused by Winnti for Linux. Traces, checks, recovery.

Kind
Linux user-land rootkit · Userland layer
Platforms
Linux
First seen
2014
Status
In the wild
Checked by
Linux kernel

Overview

Azazel is a public, open-source userland rootkit for Linux. Its repository, published in February 2014 under the GPL-2.0, describes it as based on the LD_PRELOAD technique of the older Jynx rootkit, "more robust", with a focus on "anti-debugging and anti-detection". It is a shared library: it hides things by replacing libc functions inside every dynamically linked program, without touching the kernel.

Use in intrusions. In May 2019 Google's Chronicle described a Linux version of the Winnti malware. Its rootkit component, libxselinux.so, is a modified copy of Azazel. MITRE ATT&CK's Winnti for Linux entry:

  • summarises it the same way: "a modified copy of the open-source userland rootkit Azazel";
  • says the copy was used to hide the malware's operations and network activity;
  • dates the Linux malware to at least 2015.

Chronicle's original post is listed in the sources. It could not be retrieved for this page, so the summary above follows MITRE's.

Expect a modified build in any serious use. The defaults below are where the public source starts, not a fingerprint.

How it loads and hides

Loading. The project's install step copies the library to /lib/libselinux.so and writes that path to /etc/ld.so.preload. Every dynamically linked program then loads it before libc (ld.so(8)). The name imitates SELinux's real library, which is normally libselinux.so.1 in the distribution's library folder.

What it hooks. The configuration lists the libc functions it replaces:

  • files: open, fopen, fopen64, opendir, readdir, readdir64, stat-family calls, access, link, unlink, unlinkat, rmdir;
  • processes and networking: execve, accept, read, write;
  • authentication: the PAM calls pam_authenticate, pam_open_session, pam_acct_mgmt, pam_sm_authenticate, and getpwnam;
  • capture: pcap_loop;
  • anti-debugging: ptrace.

The public source's defaults are set at build time:

DefaultEffect
Paths containing __ (two underscores)Hidden from listings and refused on access
Paths containing ld.so.preloadHidden: /etc/ld.so.preload seems not to exist to dynamically linked programs
Processes whose environment contains HIDE_THIS_SHELLHidden from /proc listings
Source ports 61040–61060, and 61061Plaintext and encrypted accept() backdoors, and the PAM port; hidden from /proc/net/tcp
PAM hooksA backdoor account for ssh and su, set at build time
pcap_loop hookIts traffic filtered from local captures
utmp and wtmpEntries for its terminals removed on request
Strings XOR-encoded with 0xFEPaths and names do not show in strings output

Defeating checks. Its execve hook watches for ldd, the dynamic linker run directly, unhide, and the LD_TRACE_LOADED_OBJECTS variable. When one of these runs, Azazel briefly renames /etc/ld.so.preload to /etc/.ld.so.preload. It runs the command with an empty environment, without itself, and renames the file back afterwards. ldd and unhide therefore see a clean system.

Traces on disk

LocationWhatSource
/etc/ld.so.preload naming /lib/libselinux.soDefault install; invisible to dynamically linked tools on the live hostRepository
/lib/libselinux.soThe library; no package owns this pathRepository
/etc/.ld.so.preloadExists briefly while ldd or unhide run; its appearance resets the preload file's change timeRepository
libxselinux.soWinnti for Linux's modified copyChronicle, MITRE
Files and folders with __ in their namesHidden by the default buildRepository
/var/log/wtmp, /var/run/utmp with gapsRemoved login recordsRepository
A library defining readdir, fopen, accept, execve, pam_authenticate and pcap_loopAzazel or a derivative, whatever its nameRepository

How to check a host

Live. Every dynamically linked tool, including your shell's globbing, runs through Azazel. Use a static toolkit from trusted media, started as a static shell.

/media/ir/busybox sh                                         # static shell; run the rest inside it
/media/ir/busybox cat /etc/ld.so.preload                     # visible to a static program
/media/ir/busybox ls -la --full-time /etc/ld.so.preload /lib/libselinux.so
/media/ir/busybox grep -l HIDE_THIS_SHELL /proc/[0-9]*/environ
/media/ir/busybox grep -h libselinux /proc/[0-9]*/maps | /media/ir/busybox sort -u
/media/ir/busybox netstat -tan                               # compare with the system's ss output

If cat /etc/ld.so.preload from the system says the file does not exist but the static cat prints it, a preload rootkit is active.

A collection made on the running host by a dynamically linked script inherits the same blindness. tar or cp will not find /etc/ld.so.preload, and will skip files with __ in their names. Collect from a disk image or with static tools.

Offline.

R=/mnt/evidence
cat "$R"/etc/ld.so.preload
ls -la --time-style=full-iso "$R"/etc/ld.so.preload "$R"/lib/libselinux.so "$R"/etc/.ld.so.preload 2>&1
readelf --dyn-syms -W "$R"/lib/libselinux.so | grep -wE 'readdir|fopen|accept|execve|pam_authenticate|pcap_loop|ptrace'
find "$R" -xdev -name '*__*' -newer "$R"/etc/hostname 2>/dev/null | grep -v -e '/__pycache__' -e '/usr/' | head
last -f "$R"/var/log/wtmp | head -50
  • Python's __pycache__ folders and many system files use double underscores, so filter them out and look at recent files outside /usr.
  • A library at a path no package owns, defining dozens of libc and PAM functions, is a finding regardless of its name.
  • More on these checks: ld.so.preload and userland rootkits, and PAM backdoors on Linux Persistence.

What the checker looks for

The linuxkernel module reads etc/ld.so.preload, the libraries it names and other shared objects in the collection. On a collection taken from an image, it shows:

  • The preload file. "Library preloaded into every program" for /etc/ld.so.preload naming /lib/libselinux.so. Because /lib is a packaged library folder, "Preloaded library outside the system library folders" does not fire; the detail sheet shows whether a dpkg package owns the path, and none does for the default install.
  • The library's exports. "Library replaces libc directory and file functions" for readdir, readdir64, opendir, open, fopen, the stat family and unlink. The detail sheet also lists, without a finding of their own, the process (execve, ptrace), network (accept, pcap_loop) and authentication (PAM) names it exports.

It cannot see what a live collection never captured. On a host with Azazel active, a dynamically linked collection script may not archive /etc/ld.so.preload at all, so a missing file proves nothing.

It does not read wtmp, the environment marker or PAM configuration.

Removal and recovery

  1. Preserve. Image the disk, or copy the preload file and library with a static tool, with their times. Capture memory if you need the hidden processes' state.
  2. Remove the preload from a clean environment, such as a rescue boot or the mounted image, or with static tools. Delete the line in /etc/ld.so.preload, then the library. Restart services or reboot so that no process keeps it mapped.
  3. Investigate what it hid. Look for:
    • the backdoor sessions on the hidden ports;
    • logins through the PAM backdoor, which leave gaps rather than records;
    • processes started with the hiding variable;
    • the payload it served: in Winnti's case, the main backdoor.
  4. Rebuild when the intruder had root, which installing to /etc/ld.so.preload requires, and rotate every credential that passed through PAM on the host.
  5. Harden. Alert on changes to /etc/ld.so.preload, including renames. Ship authentication logs off the host. Keep a statically linked toolkit for responders.

libprocesshider is the minimal version of this technique. Symbiote is a later, more capable preload rootkit seen in the wild.

Sources

Primary public reports, newest first.

  1. 2026-04-02Hooked on Linux: Rootkit Detection EngineeringElastic Security Labs
  2. 2026-03-05Hooked on Linux: Rootkit Taxonomy, Hooking Techniques and TradecraftElastic Security Labs
  3. 2019-05-15Winnti: More than just Windows and GatesChronicle
  4. 2014-02-14Azazel source repositoryGitHub

See also

Related families