Hiding
System Call Table Hooking on Linux: Traces and Checks
How Linux rootkits replace sys_call_table entries to hide files and processes, why newer kernels resist it, and how to check a host from memory and disk.
- Goal
- Hiding
- Layer
- Kernel
- Platforms
- Linux
- ATT&CK
- T1014
- Also known as
- sys_call_table hooking, syscall hooking
- Used by
- DiamorphinePUMAKIT
- Checked by
- Linux kernel
Overview
The system call table is the kernel's array of handlers, one slot per system call number. On x86-64 it is called sys_call_table. Directory listing (getdents64), kill, open and read each have a slot. A kernel module that overwrites a slot makes every call with that number run the module's code instead. The replacement usually calls the original handler, then edits the result before the program sees it: directory entries, /proc PIDs or lines are dropped.
It is the oldest and simplest way for a Linux kernel rootkit to hide. Elastic's taxonomy names Diamorphine, Knark and Reveng_rtkit as examples. Because the filter sits in the kernel, every program is affected, statically linked tools included. That is the difference from preload rootkits, which a static binary escapes.
Kernel developers have made it harder for twenty years. On x86-64 kernels that carry a 2024 change to system call dispatch, editing the table no longer changes which handler runs. Older kernels remain common on servers, and public rootkits still carry the code.
How it works
Each step a rootkit needs has been hardened at some point:
| Step | What the rootkit does | What the kernel changed |
|---|---|---|
| Find the table | Looks up the address of sys_call_table | The symbol is not exported to modules. A kernel mailing list post noted in October 2002: "As of 2.5.40bk it is now also not exported" |
| Look up symbols | Calls kallsyms_lookup_name(), which returns the address of any kernel symbol | Unexported in Linux 5.7 (commit), because it let modules reach non-exported code (LWN). Rootkits now find it through a kprobe; Elastic says a recent Diamorphine does |
| Write to it | The table is read-only. On x86, rootkits clear the write-protect (WP) bit in the CR0 register (Elastic) | Since Linux 5.3, the kernel's own CR0 write routine sets WP again and warns CR0 WP bit went missing!? (commit). The absence of the warning proves nothing |
| Make it count | The system call entry code must call through the table | Since Linux 6.9, x86-64 dispatches through a switch statement in x64_sys_call() (commit). The source now says "The sys_call_table[] is no longer used for system calls" (syscall_64.c) |
The 6.9 change was made for a CPU speculation issue, CVE-2024-2201, and distributions backported it: Canonical's kernel team backported it to Ubuntu 20.04 (Focal). Check your vendor kernel rather than its version number. Elastic says the change renders table overwrites "entirely ineffective" and describes research that patches the dispatch code instead. Such a change shows as modified kernel code, not as a changed table entry.
What a hooked table does to the view of the system:
| Slot replaced | Effect for every program |
|---|---|
getdents, getdents64 | Files with a chosen prefix, and the /proc/<pid> entries of hidden processes, are left out of ls, ps, find and a static busybox |
kill | Unused signal numbers become commands: hide a PID, show the module, grant root (Diamorphine) |
This filters listings only. A hidden file still opens by its full path, and a hidden PID still answers at /proc/<pid>/.
How families use it
| Family | What it does | Source |
|---|---|---|
| Diamorphine | Replaces getdents, getdents64 and kill. Finds the table through kallsyms_lookup_name, or a kprobe on 5.7 and later, and clears WP in CR0 on x86. Gen Digital's 2024 variant replaces table pointers with the same hooking code | Repository, Gen Digital |
| PUMAKIT | Elastic's taxonomy says PUMA uses a direct table hook beside its ftrace hooks. Elastic's analysis shows it resolving sys_call_table and a cleanup routine that points system calls back at the originals. It imports kallsyms_lookup_name, so it targets kernels before 5.7 | Elastic, 2024, Elastic, 2026 |
The other kernel families in the catalogue hook elsewhere: Adore-ng, Syslogk and Drovorub in the VFS, KoviD through ftrace, and Reptile and ASEC's Syslogk sample by patching kernel functions inline. Trend Micro says Skidmap's iproute module "hooks the system call, getdents" without saying how, so Skidmap is not listed here.
Traces it leaves
| Where | Trace | Notes |
|---|---|---|
| Memory | Table entries that point outside the kernel's own handlers, usually into a module | The proof; needs a memory image |
| Memory | The module itself, often unlinked from the module list | See hiding a loaded module |
| Module file | The string sys_call_table; an import of kallsyms_lookup_name, or register_kprobe with that name as a string; handler names such as __x64_sys_getdents64 | Only when the .ko exists on disk; a modified build can obscure strings |
kern.log, messages, journal | loading out-of-tree module taints kernel and module verification failed, naming the module | Printed once per boot, for the first such module (kernel source) |
kern.log, journal | CR0 WP bit went missing!? with a call trace | Its absence proves nothing |
| Audit log | init_module or finit_module calls; kill() with unusual signal numbers | If auditd watched them, as Elastic recommends |
How to check a host
Live, with caution. The rootkit filters the system calls every tool uses, static tools included. Look for disagreement, not for the files.
cat /proc/sys/kernel/tainted # bits 12 (O) and 13 (E): out-of-tree or unsigned module since boot
dmesg | grep -iE 'taint|module verification|CR0 WP bit'
journalctl -k -b | grep -iE 'taint|module verification|CR0 WP bit'
unhide brute proc # PIDs that answer but are missing from listings
unhide sys # compares what different system calls report about PIDs
- Elastic recommends auditing
kill()with high signal numbers, which Diamorphine uses as commands, and auditinginit_moduleandfinit_modulerather thaninsmod(Elastic, 2026). - Tracee's
hooked_syscallevent checks that each system call "points to its corresponding legitimate function symbol". - LKRG validates "kernel and modules code and read-only data" and CPU bits including WP. The table is declared
constin the kernel source, so it sits in read-only data. LKRG must be loaded before the compromise, and its authors call it "bypassable by design" (lkrg.org).
Memory. Capture memory first (LiME or AVML). Volatility 3's linux.malware.check_syscall compares each table entry with the kernel's symbols; in Volatility 2 it is linux_check_syscall, which "prints the system call tables and checks for hooked functions" (Volatility wiki). Add linux.malware.hidden_modules and linux.malware.modxview for the module. On 6.9 and later x86-64 kernels a clean table proves less, since dispatch no longer goes through it.
Offline, from an image.
R=/mnt/evidence
find "$R" -xdev -type f \( -name '*.ko' -o -name '*.ko.xz' -o -name '*.ko.zst' \) -newer "$R"/etc/hostname 2>/dev/null
strings -a /path/to/suspect.ko | grep -E 'sys_call_table|kallsyms_lookup_name|__x64_sys_'
nm -u /path/to/suspect.ko | grep -E 'kallsyms|register_kprobe'
zgrep -hE 'taint|module verification|CR0 WP bit' "$R"/var/log/kern.log* "$R"/var/log/messages* 2>/dev/null
journalctl -D "$R"/var/log/journal _TRANSPORT=kernel -o short-iso | grep -iE 'taint|module verification|CR0 WP bit'
Search the whole image, not only /lib/modules: insmod loads a module from any path. Checking Linux kernel modules offline covers signatures, package ownership and modules.order.
What the checker looks for
The linuxkernel module reads module files under lib/modules/. For this technique it raises:
- "Looks up the system call table" when a module contains the string
sys_call_table. - "Resolves unexported kernel symbols" for an import of
kallsyms_lookup_name,kallsyms_on_each_symbolormodule_kallsyms_lookup_name, or forregister_kprobewith one of those names as a string. - "Names kernel functions that rootkits hook" for names such as
__x64_sys_getdents64,__x64_sys_kill,x64_sys_callordo_syscall_64. It is rated high when one of the two findings above also fired.
The usual module findings apply too: "Unsigned module among signed modules", "Module unknown to the kernel build and to every package", "Boot configuration loads a flagged module", the kernel log's taint lines, and, from the collect script's _live/ outputs, "Loaded module missing from /proc/modules".
It cannot see the table itself, which exists only in memory. It does not read a .ko kept outside the module tree, or one loaded and deleted. A build that hides its strings raises none of the three findings. See what an offline check cannot prove.
Mitigation and recovery
- Refuse unsigned modules. Enforce module signatures with
module.sig_enforce=1(module signing) or kernel lockdown, which restricts "unsigned module loading" (kernel_lockdown(7)). - Close module loading after boot with
kernel.modules_disabled=1on servers that do not load modules later (sysctl documentation). - Keep kernels current. On x86-64, a kernel with the 6.9 dispatch change no longer follows table edits.
- Monitor. Audit
init_moduleandfinit_module, ship kernel logs off the host, and consider LKRG.
Recovery. Capture memory, then image the disk. Do not unload the module and restore the table in place: the rootkit ran in the kernel, and Diamorphine grants root on request. Rebuild from known-good media and rotate the credentials used on the host.
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
- 2024-12-12Declawing PUMAKITElastic Security Labs
- 2024-06-18New Diamorphine rootkit variant seen undetected in the wildGen Digital (Avast)
- 2024-04-03x86/syscall: Don't force use of indirect calls for system callsLinux kernel (git.kernel.org)
- 2020-04-06kallsyms: unexport kallsyms_lookup_name() and kallsyms_on_each_symbol()Linux kernel (git.kernel.org)
- 2020-02-28Unexporting kallsyms_lookup_name()LWN.net
- 2019-06-17x86/asm: Pin sensitive CR0 bitsLinux kernel (git.kernel.org)
- 2013-11-06Diamorphine source repositoryGitHub
- 2002-10-03Re: export of sys_call_tableLinux kernel mailing list
See also
Related techniques
Families that use it
- DiamorphineLinux LKM rootkit
- PUMAKITLinux LKM rootkit