In 2022, the Symbiote rootkit was discovered hiding inside running Linux processes on financial sector servers — invisible to ps, netstat, and ls simultaneously. That’s the rootkit promise: persistence with invisibility. Understanding how they achieve that invisibility is the first step to catching them.
How Rootkits Hide: The /proc Discrepancy Trick
Most Linux rootkits hook the kernel or libc to filter their own entries out of system calls. The classic tell is a mismatch between what the kernel actually knows and what userspace tools report.
Start by comparing /proc directly against ps output. The kernel can’t lie about /proc — a userland rootkit hasn’t touched it yet.
# List all numeric PIDs in /proc (real kernel view)
ls /proc | grep -E '^[0-9]+$' | sort -n > /tmp/proc_pids.txt
# List PIDs from ps (potentially hooked)
ps aux | awk 'NR>1 {print $2}' | sort -n > /tmp/ps_pids.txt
# Show PIDs visible in /proc but hidden from ps
diff /tmp/proc_pids.txt /tmp/ps_pids.txt
On a clean host — say web01.corp.internal (192.0.2.14) — this diff returns nothing. If you see a PID in proc_pids.txt that’s absent from ps_pids.txt, you have a process that userspace tools are being told to ignore. That’s a rootkit fingerprint.
Once you find a suspicious PID, dig into it directly:
cat /proc/3847/cmdline | tr '\0' ' '
ls -la /proc/3847/exe
cat /proc/3847/maps | grep -v '.so'
If /proc/3847/exe points to a deleted binary — shown as /tmp/.update (deleted) — you’re looking at a dropper that executed and then erased its own file from disk. An attacker would do this to survive a filesystem scan. Your next move: dump the binary from /proc/3847/exe with cp /proc/3847/exe /evidence/sample.bin before the process dies, then submit it to a sandbox.
Automated Detection with rkhunter
rkhunter (Rootkit Hunter) — a free scanner that checks for known rootkit signatures, suspicious file permissions, and tampered system binaries. It’s not perfect, but it catches the common families fast.
Run a full check on your host and pipe output to a file for review:
rkhunter --check --sk --rwo --logfile /var/log/rkhunter_$(date +%F).log
grep -E 'Warning|Found' /var/log/rkhunter_2026-11-23.log
On a compromised server — here’s what a real warning block looks like:
[11:42:03] Warning: The command '/usr/bin/who' has been replaced by a script: /usr/bin/who [ INFECTED ]
[11:42:07] Warning: Hidden directory found: /usr/lib/.cache_lock
[11:42:11] Warning: Suspicious file types found in /dev:
[11:42:11] /dev/shm/.x11 [ ELF binary ]
[11:42:15] Warning: Network interface 'eth0' is in promiscuous mode
Four warnings, four actions. A replaced /usr/bin/who means a userland rootkit swapped a system binary — compare it against your package manager: rpm -V util-linux or debsums -c. A hidden directory under /usr/lib starting with a dot is a classic staging folder. An ELF binary in /dev/shm is a memory-resident payload — it won’t survive a reboot, which is why attackers pair it with a cron-based dropper. And promiscuous mode on eth0 means something is sniffing traffic on 192.0.2.14.
Don’t just read warnings — act on each one sequentially. Pulling the ELF from /dev/shm for hashing and sandbox analysis is your highest priority because it’s volatile.
Kernel-Level Rootkits: Checking Loaded Modules
Kernel rootkits load as LKMs (Loadable Kernel Modules) and are harder to catch because they run in ring 0. Same discrepancy approach applies — compare /proc/modules to lsmod.
# Modules the kernel actually has loaded
cat /proc/modules | awk '{print $1}' | sort > /tmp/proc_modules.txt
# Modules lsmod reports (can be filtered by a rootkit hook)
lsmod | awk 'NR>1 {print $1}' | sort > /tmp/lsmod_modules.txt
diff /tmp/proc_modules.txt /tmp/lsmod_modules.txt
A hidden module — say sysmon_helper — appearing in /proc/modules but not lsmod is your smoking gun. Cross-reference it:
grep sysmon_helper /proc/modules
# Output: sysmon_helper 16384 1 - Live 0xffffffffc08a1000 (OE)
The O flag means the module is out-of-tree (not from your distro). The E flag means the kernel taint flag for unsigned modules is set. At this point, the system’s integrity is gone — image the disk, preserve memory with avml, and move to forensic analysis off the live system. Don’t try to clean a kernel rootkit in place.
What To Do Now
Pick one production Linux host — your web server, a bastion, any internet-facing box — and run this right now:
diff <(ls /proc | grep -E '^[0-9]+$' | sort -n) <(ps aux | awk 'NR>1{print $2}' | sort -n)
If the diff is clean, great — you have a baseline. Save it. If you see unexpected PIDs, start pulling threads with /proc/[PID]/exe and /proc/[PID]/cmdline. Set a cron job to run this diff daily and alert on any output. Rootkits rely on no one looking. Start looking.
