Hiding
Hiding a Loaded Linux Kernel Module: Traces and Checks
How Linux rootkits drop out of lsmod, /proc/modules and /sys/module while still loaded, what the kernel's taint flags and logs keep, and how to check a host.
- Goal
- Hiding
- Layer
- Kernel
- Platforms
- Linux
- ATT&CK
- T1014
- Also known as
- Module unlinking, LKM hiding
- Checked by
- Linux kernel
Overview
A loaded kernel module is registered in two places that userland can read. The kernel keeps every module in a linked list, which /proc/modules prints and lsmod formats. Each module also has a directory under /sys/module/<name>. A rootkit module removes itself from one or both, and keeps running. Its code, hooks and memory stay exactly where they were; only the listings change.
Nearly every kernel-module rootkit in this catalogue does it, usually as soon as it loads. It is the Linux counterpart of direct kernel object manipulation on Windows: editing a kernel list so that the tools that walk it no longer see an entry.
The technique is cheap and old, and it has a weakness: the kernel records the load before the module's own code runs, in the taint flags and the kernel log. Those records, and memory, are where a hidden module shows.
How it works
| View | Built from | How rootkits hide from it |
|---|---|---|
/proc/modules, lsmod | The kernel's module list | Unlinking the module's entry from the list |
/sys/module/<name>/ | The module's kernel object in sysfs | Deleting that object; several rootkits skip this step |
/proc/sys/kernel/tainted | Taint bits set while loading: O (bit 12) for an out-of-tree module, E (bit 13) for an unsigned one (tainted kernels) | The kernel "will remain tainted even after you undo what caused the taint"; only a rootkit that rewrites the value clears it |
| Kernel log | loading out-of-tree module taints kernel and module verification failed: signature and/or required key missing - tainting kernel, printed during the load, before the module runs (kernel source) | Cannot be undone in the log already written; a rootkit can filter later reads of it |
| Memory | The module's structure, code and data | Not hidden: memory analysis carves it |
Two consequences matter during a response. First, the kernel prints each taint line only for the first such module after a boot, so a VirtualBox or ZFS module loaded earlier can take the line instead. Second, rmmod looks modules up by name in the list, so it cannot remove a module that unlinked itself. Avast describes revealing Syslogk through its control file, after which rmmod can remove it (Avast).
How families use it
| Family | Module list | /sys/module | Other | Source |
|---|---|---|---|---|
| Diamorphine | Unlinked at load; signal 63 toggles it | Left in place | Repository | |
| Reptile | Unlinked | Left in place | Encrypted loader calls init_module directly, so insmod never runs | Repository, Elastic |
| KoviD | Hidden | Hidden | Makes /proc/sys/kernel/tainted read 0 | README |
| Adore-ng | Unlinked | Object removed | Source mirror | |
| Syslogk | Avast's sample: list_del, revealed by writing 1 to /proc/syslogk. ASEC's sample: unlinked | Avast: not stated. ASEC: removed | Avast, ASEC | |
| Drovorub | Hides "specified loaded kernel modules, to include itself" | Not stated | NSA and FBI | |
| Skidmap | Trustwave's analysis of a memory dump "confirmed two hidden malicious modules"; the method is not described | Not stated | Trustwave |
Traces it leaves
| Where | Trace | What it proves |
|---|---|---|
/sys/module/<name>/ without a /proc/modules line | A loadable module (it has initstate) that the list no longer shows | Strong sign of Diamorphine- or Reptile-style unlinking |
/proc/sys/kernel/tainted | Bit 12 or 13 set with no module that explains it | Something out-of-tree or unsigned loaded since boot |
/sys/module/<name>/taint | Taint letters of each visible module | Which visible modules explain the taint |
kern.log, messages, journal | The two taint lines, naming the module | Written before the module ran |
| Audit log | init_module, finit_module, KERN_MODULE records | If auditd watched module loads |
| Load configuration | A module set to load at boot that /proc/modules does not list | It failed, was unloaded, or hides |
| Memory | The module's structure and code | The independent view |
How to check a host
Live, with caution. The views come from the suspect kernel. A rootkit that hides from both lists, like KoviD, leaves nothing to compare.
cat /proc/sys/kernel/tainted
for m in /sys/module/*; do [ -e "$m/initstate" ] && ! grep -q "^${m##*/} " /proc/modules && echo "only in sysfs: ${m##*/}"; done
for m in /sys/module/*; do t=$(cat "$m/taint" 2>/dev/null); [ -n "$t" ] && echo "${m##*/} $t"; done
dmesg | grep -iE 'taint|module verification'
journalctl -k -b | grep -iE 'taint|module verification'
ausearch -m KERN_MODULE -i 2>/dev/null | tail -n 20
- Elastic's rule logic: a taint alert for a module that a manual check cannot find "may indicate that the LKM is hiding itself" (Elastic, 2026).
- A taint value of
0next to a logged taint line for the same boot is a contradiction that matches KoviD. - At run time, Tracee's
hidden_kernel_moduleevent periodically looks for modules "loaded in memory but hidden from standard module listing mechanisms".
Memory. Capture memory first. Volatility 3's linux.malware.hidden_modules "carves memory to find hidden kernel modules"; linux.malware.check_modules "compares module list to sysfs info"; linux.malware.modxview puts the two together with lsmod and taints. In Volatility 2, linux_check_modules "finds rootkits that break themselves from the module list but not sysfs" (Volatility wiki). Dump the module and analyse it.
Offline. Logs written before the hiding are the best lead.
R=/mnt/evidence
zgrep -hE 'taint|module verification' "$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'
ausearch -if "$R"/var/log/audit -m KERN_MODULE -i 2>/dev/null
grep -rhvE '^\s*([#;]|$)' "$R"/etc/modules "$R"/etc/modules-load.d "$R"/etc/sysconfig/modules 2>/dev/null
Then find each named module's file and check it: checking Linux kernel modules offline.
What the checker looks for
The linuxkernel module uses the collect script's _live/ outputs (/proc/modules, the /sys/module listing with each entry's initstate and taint, the taint value, dmesg) and the kernel logs:
- "Loaded module missing from /proc/modules" for a module with a
/sys/moduleentry and aninitstate, or with a module file, that/proc/modulesdoes not list. - "Set to load at boot, missing from the live module list" for a module in
/etc/modulesormodules-load.dwhose file is on disk but which/proc/modulesdoes not list. - "Kernel tainted by an out-of-tree or unsigned module" when the saved taint value has bit 12 or 13 set, and "Loaded module carries taint flags" for each visible module with taint letters.
- "Kernel log: out-of-tree module loaded" and "Kernel log: unsigned module loaded" from
kern.log,messagesor the saveddmesg.
It raises nothing for a module hidden from both views, and no finding for a taint value of 0 that contradicts a logged taint line: compare those yourself. Both lists come from the suspect kernel. It does not read the journal or the audit log.
Mitigation and recovery
- Refuse the module. Enforce module signatures (
module.sig_enforce=1, or kernel lockdown) and setkernel.modules_disabled=1after boot where possible (sysctl documentation). - Record loads off the host. Audit
init_moduleandfinit_module, as Elastic recommends, and ship kernel logs and audit records off the host so that the load-time lines survive.
Recovery. Capture memory, then image the disk. A hidden module cannot be listed or removed normally, and revealing it through its own control channel changes the system. Find what loads it at boot, rebuild from known-good media, and rotate credentials. Most of these rootkits also grant root on request.
Sources
Primary public reports, newest first.
- 2026-09-03Detection and Removal of the Syslogk Rootkit in a Linux EnvironmentAhnLab ASEC
- 2026-04-02Hooked on Linux: Rootkit Detection EngineeringElastic Security Labs
- 2023-07-30Honeypot Recon: New Variant of SkidMap Targeting RedisTrustwave SpiderLabs (LevelBlue)
- 2022-06-13Linux Threat Hunting: 'Syslogk' a kernel rootkit found under development in the wildGen Digital (Avast)
- 2022-04-01KoviD source repositoryGitHub
- 2020-08-13Russian GRU 85th GTsSS Deploys Previously Undisclosed Drovorub MalwareNSA and FBI
- 2017-10-22Reptile source repositoryGitHub
- 2014-09-26adore-ng, adapted for 2.6 and 3.x kernels (source mirror)GitHub
- 2013-11-06Diamorphine source repositoryGitHub
See also
Related techniques
- Direct kernel object manipulation (DKOM)Hiding
- Loading a kernel module from memoryGetting into the kernel
- System call table hookingHiding
- ftrace and kprobe hookingHiding
- VFS and /proc hookingHiding