Skip to content

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

ViewBuilt fromHow rootkits hide from it
/proc/modules, lsmodThe kernel's module listUnlinking the module's entry from the list
/sys/module/<name>/The module's kernel object in sysfsDeleting that object; several rootkits skip this step
/proc/sys/kernel/taintedTaint 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 logloading 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
MemoryThe module's structure, code and dataNot 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

FamilyModule list/sys/moduleOtherSource
DiamorphineUnlinked at load; signal 63 toggles itLeft in placeRepository
ReptileUnlinkedLeft in placeEncrypted loader calls init_module directly, so insmod never runsRepository, Elastic
KoviDHiddenHiddenMakes /proc/sys/kernel/tainted read 0README
Adore-ngUnlinkedObject removedSource mirror
SyslogkAvast's sample: list_del, revealed by writing 1 to /proc/syslogk. ASEC's sample: unlinkedAvast: not stated. ASEC: removedAvast, ASEC
DrovorubHides "specified loaded kernel modules, to include itself"Not statedNSA and FBI
SkidmapTrustwave's analysis of a memory dump "confirmed two hidden malicious modules"; the method is not describedNot statedTrustwave

Traces it leaves

WhereTraceWhat it proves
/sys/module/<name>/ without a /proc/modules lineA loadable module (it has initstate) that the list no longer showsStrong sign of Diamorphine- or Reptile-style unlinking
/proc/sys/kernel/taintedBit 12 or 13 set with no module that explains itSomething out-of-tree or unsigned loaded since boot
/sys/module/<name>/taintTaint letters of each visible moduleWhich visible modules explain the taint
kern.log, messages, journalThe two taint lines, naming the moduleWritten before the module ran
Audit loginit_module, finit_module, KERN_MODULE recordsIf auditd watched module loads
Load configurationA module set to load at boot that /proc/modules does not listIt failed, was unloaded, or hides
MemoryThe module's structure and codeThe 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 0 next to a logged taint line for the same boot is a contradiction that matches KoviD.
  • At run time, Tracee's hidden_kernel_module event 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/module entry and an initstate, or with a module file, that /proc/modules does not list.
  • "Set to load at boot, missing from the live module list" for a module in /etc/modules or modules-load.d whose file is on disk but which /proc/modules does 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, messages or the saved dmesg.

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 set kernel.modules_disabled=1 after boot where possible (sysctl documentation).
  • Record loads off the host. Audit init_module and finit_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.

  1. 2026-09-03Detection and Removal of the Syslogk Rootkit in a Linux EnvironmentAhnLab ASEC
  2. 2026-04-02Hooked on Linux: Rootkit Detection EngineeringElastic Security Labs
  3. 2023-07-30Honeypot Recon: New Variant of SkidMap Targeting RedisTrustwave SpiderLabs (LevelBlue)
  4. 2022-06-13Linux Threat Hunting: 'Syslogk' a kernel rootkit found under development in the wildGen Digital (Avast)
  5. 2022-04-01KoviD source repositoryGitHub
  6. 2020-08-13Russian GRU 85th GTsSS Deploys Previously Undisclosed Drovorub MalwareNSA and FBI
  7. 2017-10-22Reptile source repositoryGitHub
  8. 2014-09-26adore-ng, adapted for 2.6 and 3.x kernels (source mirror)GitHub
  9. 2013-11-06Diamorphine source repositoryGitHub

See also

Families that use it