Linux LKM rootkit
KoviD LKM Rootkit: Traces and Offline Checks
KoviD is an open-source ftrace-based Linux kernel rootkit that hides from sysfs and clears the taint flag. What it changes, what still shows, and recovery.
- Kind
- Linux LKM rootkit · Kernel layer
- Platforms
- Linux
- First seen
- 2022
- Status
- Proof of concept
- Checked by
- Linux kernel
Overview
KoviD is a public, open-source LKM rootkit for Linux. Its repository, created in April 2022, presents it as an educational "Red-Team LKM" for kernel 5 and later. The tested list also includes 4.x kernels on Debian 10 and CentOS 8, and 6.x on Ubuntu 22.04. It is actively maintained.
KoviD matters to defenders because it removes two of the cheap signals that catch simpler modules:
- it hides from
/sys/moduleas well as from the module list; - it resets the kernel's taint flag after loading.
Elastic uses it as a test case in its 2026 rootkit series. It found that static detection of KoviD samples dropped sharply when the binary was stripped or padded with a single byte (Elastic).
In the wild. No vendor report of KoviD used in an intrusion was found for this page, so it is listed as a proof of concept.
The project README says that a rootkit in the 2025 "APT Down" leak published in Phrack "appears to reuse parts of KoviD", notably its sysfs hiding code, and cites ENKI. ENKI's page did not expose the analysis text when this page was written, so the claim is unconfirmed here. Sandfly's analysis of the leaked rootkit describes a khook-based module and does not mention KoviD. Treat the link as the project's own claim.
How it loads and hides
Loading. KoviD is an ordinary .ko loaded with insmod from any path. It has no loader or persistence of its own. The README suggests reloading it at boot by infecting an executable such as sshd with a separate ELF infector, or with "your preferred tool". The file that brings it back may therefore be a modified system binary rather than a configuration line.
Hooking. KoviD uses ftrace, the kernel's function tracer, to divert functions and syscalls; Elastic classifies it as an ftrace-based rootkit (part 1). The README lists what it hides and does:
| Feature (README) | What a defender sees |
|---|---|
Hides itself from the module list and /sys/module | No disagreement between /proc/modules and sysfs to catch |
Hides files and directories through filldir and filldir64 | Files missing from listings, readable by full path |
| Hides tasks, their children and their CPU use | Load without a visible consumer |
Hides connections from ss, netstat and tcpdump (libpcap, recvmsg) | Traffic visible only from outside the host |
Leaves no trace of its hidden tasks in tools such as w, who, ps, lsmod and ls | Sessions and processes missing from live tools |
| Port knocking with crafted packets, through netfilter hooks, opening reverse shells (netcat, OpenSSL, socat) | Outbound shells after inbound odd packets |
Root on request, and a control file under /proc whose name is chosen at build time | Signals sent to PIDs that do not exist; a /proc entry that appears and expires |
Reads /proc/sys/kernel/tainted as 0 after loading | The live taint value lies |
| SSH and FTP session sniffing through the TTY | Credentials typed on the host are exposed |
Traces on disk
KoviD keeps little on disk by design. What usually remains:
| Location | What | Source |
|---|---|---|
The .ko file, wherever it was loaded from | The module; named at build time | Repository |
/var/log/kern.log, /var/log/messages, the journal | loading out-of-tree module taints kernel and module verification failed lines, printed by the kernel while loading the module, before its code runs | Linux kernel source |
/usr/sbin/sshd or another binary that no longer matches its package | An infected executable that reloads the module | Repository (persistence suggestion) |
Shell history, cron, units or rc scripts calling insmod | Other ways the module was loaded | General |
| Packages for kernel headers and compilers installed shortly before | Building on the host | General |
The taint warnings are worth the most here. The kernel prints them during the load, from its own code, and the module only clears the in-memory flag afterwards. A warning in kern.log for a boot in which /proc/sys/kernel/tainted was saved as 0 is a contradiction that points to tampering. The warnings appear only for the first such module after each boot (kernel source).
How to check a host
Live, with caution. KoviD defeats the usual cross-checks, so collect what it cannot easily falsify and compare it with what it reports.
cat /proc/sys/kernel/tainted # KoviD makes this read 0
dmesg | grep -iE 'taint|module verification' # yet the load-time warning may still be here
journalctl -k -b | grep -iE 'taint|module verification'
cat /sys/kernel/tracing/enabled_functions # functions with ftrace callbacks (tracefs; root)
cat /sys/kernel/debug/kprobes/list # active kprobes (debugfs; root)
ss -tanp; cat /proc/net/tcp # compare with a capture taken outside the host
- The kernel's ftrace documentation describes
enabled_functionsas listing every function with a callback attached. Hooks on syscalls,filldiror networking functions without a known tracer, live patch or security agent are suspect. - The rootkit can filter these files, so a clean result does not clear the host.
- Capture memory before doing anything else. Volatility 3's
linux.tracing.ftrace,linux.malware.hidden_modulesandlinux.malware.check_syscallexamine ftrace hooks and modules missing from every list (memory forensics).
Offline.
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'
debsums --root="$R" -c 2>/dev/null # Debian/Ubuntu: packaged files that changed
rpm --root "$R" -Va 2>/dev/null | grep '^..5' # RHEL family: files whose digest changed
find "$R" -xdev \( -name '*.ko' -o -name '*.ko.zst' -o -name '*.ko.xz' \) -newer "$R"/etc/hostname 2>/dev/null
nm -u /path/to/suspect.ko | grep -E 'ftrace|kallsyms|kprobe'
- Package verification is what catches an infected
sshd.debsumschecks against the md5sums stored on the same disk, which a root intruder could have edited. For the binaries that matter, compare with packages downloaded from the distribution mirror. - A module whose undefined symbols include
register_ftrace_functionandftrace_set_filter_ip, and whose strings namefilldiror syscalls, deserves analysis. See checking kernel modules offline.
What the checker looks for
The linuxkernel module can see:
- The kernel log warnings naming the module, from
kern.logormessages: "Kernel log: out-of-tree module loaded" and "Kernel log: unsigned module loaded". The collect script's_live/taintedgives the saved taint value, which raises "Kernel tainted by an out-of-tree or unsigned module" only when bit 12 or 13 is set. Compare the two yourself: a warning in the logs for the boot whose saved taint is0matches KoviD's behaviour, and the checker raises no finding for that contradiction. - A module file under
lib/modules/: "Unsigned module among signed modules" and "Module unknown to the kernel build and to every package". Evidence includes the ftrace imports (register_ftrace_function,ftrace_set_filter_ip) as "Redirects kernel functions with ftrace", symbol lookup throughkallsyms_lookup_nameas "Resolves unexported kernel symbols", and hook targets such asfilldir64as "Names kernel functions that rootkits hook". - A boot entry for such a module, as "Boot configuration loads a flagged module", and, with
_live/outputs, "Set to load at boot, missing from the live module list" when the module is configured to load at boot and on disk but absent from/proc/modules.
It cannot see:
- a module kept outside the module tree;
- an infected
sshd, since it does not verify package digests; - anything that exists only in memory.
Because KoviD hides from sysfs, "Loaded module missing from /proc/modules" will not fire.
Removal and recovery
- Capture memory first. KoviD's hooks, hidden tasks and
/procinterface exist only there. Then image the disk. - Find what loads it. Verify every packaged binary that runs at boot or on login:
sshdabove all. Read history, units, cron and rc scripts from the image. - Rebuild. The module hides processes, connections and logins and offers root on request. Do not attempt to unhide and unload it in place and call the host clean.
- Rotate credentials. KoviD can sniff SSH and FTP sessions through the TTY, so treat every password typed on the host as exposed.
- Harden.
- Enforce module signatures with Secure Boot and lockdown, or
module.sig_enforce=1. - Set
kernel.modules_disabled=1after boot where possible. - Audit
init_moduleandfinit_module. - Ship kernel logs off the host, so that the load-time warning survives local tampering.
- Enforce module signatures with Secure Boot and lockdown, or
PUMAKIT also hooks through ftrace. TripleCross hides without a kernel module at all.
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
- 2025-08-13Leaked Chinese/North Korean Linux Stealth Rootkit AnalysisSandfly Security
- 2022-04-01KoviD source repositoryGitHub
See also
Related families
- DiamorphineLinux LKM rootkit
- ReptileLinux LKM rootkit
- PUMAKITLinux LKM rootkit
- TripleCrosseBPF rootkit