Linux LKM rootkit
Reptile LKM Rootkit: Traces and Offline Checks
Reptile is an open-source Linux kernel rootkit with a userland loader and port-knocking shell, used in espionage intrusions. Its traces, checks and recovery.
- Kind
- Linux LKM rootkit · Kernel layer
- Platforms
- Linux
- First seen
- 2017
- Status
- In the wild
- Also known as
- REPTILE
- Checked by
- Linux kernel
Overview
Reptile is a public, open-source LKM rootkit for Linux. Its repository dates from October 2017 and still carries a "security research" disclaimer. The README lists kernels it was tested on, from 2.6.32 (CentOS 6) to 4.19 (Debian 10).
Reptile is more than a hiding module. It ships with:
- a userland loader that carries the kernel module encrypted;
- a reverse shell started by a "magic packet";
- a command tool, and an option to hide lines inside files.
Reported uses:
- Korean organisations, 2022–2023. AhnLab ASEC described several campaigns against Korean organisations since 2022. In one, the operator renamed every component after the keyword
intel_audioand paired the rootkit with an ICMP shell. - Mélofée, 2023. ExaTrack found that the Mélofée implant installs a rootkit "based on a modified version" of Reptile. ExaTrack links Mélofée "with high confidence" to Chinese state-sponsored groups, naming Winnti.
- UNC3886, 2024. Mandiant reported REPTILE as the preferred rootkit of UNC3886, which it calls "a suspected China-nexus cyber espionage actor". The actor deployed it on Linux guest virtual machines right after gaining access.
Because the source is public, finding Reptile on a host does not identify an actor on its own.
How it loads and hides
Loading. The default build installs four programs in a hidden directory named after the build keyword, by default /reptile/:
reptile, the loader;reptile_cmd, the command tool;reptile_shell, the reverse shell;reptile_start, a start script.
The loader decrypts the module it carries and passes it to the kernel with init_module(). In the default install there is no standalone .ko on disk. The packing comes from the open-source kmatryoshka loader. Elastic notes that, because of this, insmod never runs; only syscall auditing of init_module sees the load (Elastic, 2026).
Persistence varies:
- The public installer writes a udev rule named
<random>-<keyword>.rulesinto/lib/udev/rules.d/(or/etc/udev/rules.d/). - Mandiant notes that older versions used modprobe configuration.
- UNC3886 mostly used RC scripts or systemd units instead, and only a few samples used udev.
- In ASEC's Korean case, an
rc.localentry started the loader, wrapped in tags that the rootkit hides.
Hiding. Reptile hooks kernel functions with the KHOOK engine. The public source hooks:
| Hooked | What it hides |
|---|---|
filldir, filldir64, fillonedir, __d_lookup, vfs_statx | Files and directories whose path contains the keyword |
next_tgid, find_task_by_vpid, sys_kill | Hidden processes, from /proc and from signals |
tcp4_seq_show, udp4_seq_show | Connections to chosen IP addresses |
vfs_read | Text between #<keyword> and #</keyword> tags, in any file read |
ip_rcv | Watches TCP, UDP and ICMP packets for the port-knocking trigger |
The module unlinks itself from the kernel's module list, so lsmod misses it. The public source does not remove its /sys/module entry.
The magic packet carries the command-and-control address. When it arrives, the rootkit starts the reverse shell towards that address (ASEC). UNC3886's customised listener spoke TLS, using the victim's own certificate and key taken from compromised FortiGate devices (Mandiant).
Traces on disk
| Location | What | Source |
|---|---|---|
/reptile/reptile, /reptile/reptile_cmd, /reptile/reptile_shell, /reptile/reptile_start | Default install; the keyword replaces reptile in renamed builds | ASEC, repository |
/lib/udev/rules.d/<random>-<keyword>.rules (or /etc/udev/rules.d/) | Public installer's persistence | Repository, Elastic |
/etc/intel_audio/intel_audio.ko, intel_audio_start, intel_audio_reverse, gvfs-gdb-volume-monitor | ASEC's Korean case: module, start script, shell, ICMP shell | ASEC |
rc.local lines between #<intel_audio> and #</intel_audio> | Hidden autostart in the same case | ASEC |
/etc/rc.modules | Mélofée's module persistence | ExaTrack |
/var/lib/fwupdd/<keyword>_cmd, _reverse, _start | UNC3886 components | Mandiant |
/lib/modules/<release>/kernel/drivers/<keyword>/<keyword>, /usr/bin/<keyword> | UNC3886 encrypted kernel component and its launcher | Mandiant |
| RC scripts or systemd units running the launcher | UNC3886 persistence | Mandiant |
Text after #</Centos_Selinux_Config_And_Module> | UNC3886's file-tampering marker | Mandiant |
| Kernel log taint lines naming an unknown module | Load of an unsigned, out-of-tree module | Linux kernel |
Mandiant's report lists hashes, component names such as bubba and authdd, and YARA rules for the launcher. Use those from the report itself.
How to check a host
Live, with caution. The rootkit filters listings, /proc, connections and even file contents for every program, static tools included. Look for disagreement between views rather than for the files.
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
dmesg | grep -iE 'taint|module verification'
ausearch -m KERN_MODULE -i 2>/dev/null | tail -n 20 # if auditd watches module loads
ls -la /reptile 2>&1 # the default keyword: hidden from listings but reachable by name
- A hidden directory still answers when you name it.
ls -la /reptilefailing proves nothing, because the keyword is usually changed. - Elastic suggests watching for network connections and file creation by
kworkerkernel threads, which Reptile's shell start produces. - Capture memory before going further. In a memory image, Volatility 3's
linux.malware.hidden_modulesandlinux.malware.check_moduleslook for modules missing from the list (Linux Forensics: memory forensics).
Offline, from an image. On a clean machine, the keyword-hidden files and tagged lines are plain to read.
R=/mnt/evidence
ls -la "$R"/lib/udev/rules.d "$R"/etc/udev/rules.d
grep -rnE 'RUN\+?=' "$R"/etc/udev/rules.d "$R"/lib/udev/rules.d 2>/dev/null # programs started by udev
grep -rnE '^#<[^>]+>|^#</[^>]+>' "$R"/etc 2>/dev/null # file-tampering tags
find "$R"/lib/modules "$R"/usr/lib/modules -type f ! -name '*.ko*' ! -name 'modules.*' 2>/dev/null
cat "$R"/etc/rc.local "$R"/etc/rc.modules 2>/dev/null
zgrep -hE 'taint|module verification' "$R"/var/log/kern.log* "$R"/var/log/messages* 2>/dev/null
- Udev rules are the persistence to review first; see udev rules on Linux Persistence.
- Files under the module tree without a
.koextension are not modules the kernel's tools load by name. UNC3886's encrypted component sat in such a path. - Hunt for small ELF files that call
init_modulefrom/usr/binor other system paths, and check whether a package owns them (dpkg -S,rpm -qf).
What the checker looks for
The linuxkernel module sees part of Reptile:
- Kernel log taint messages: "Kernel log: out-of-tree module loaded" and "Kernel log: unsigned module loaded", naming the loaded module when it was the first such module of the boot. The name is the build's name, which operators change.
- A module hidden from
/proc/modules. With the collect script's_live/outputs, "Loaded module missing from /proc/modules" for a module listed under/sys/modulebut missing from/proc/modules, matching the public source's hiding, and "Kernel tainted by an out-of-tree or unsigned module" from the saved taint value. - An unpacked module. When an operator stored the module as a plain
.kounderlib/modules/, it raises "Unsigned module among signed modules" and "Module unknown to the kernel build and to every package". Hook-target names such asfilldirandtcp4_seq_show, when the module carries them as strings, raise "Names kernel functions that rootkits hook". UNC3886's encrypted component underlib/modules/has no.koname, so it is not read as a module.
It does not see the default install:
- the module travels encrypted inside the loader;
- udev rules, rc scripts, systemd units and
/etc/intel_audio-style folders outside the module tree are not read by the checker; - tagged lines in
rc.localand/etc/rc.modulesare not read either.
Check those by hand, or with Linux Persistence, which reads the persistence side.
Removal and recovery
-
Capture memory, then image the disk. The module and its hidden list exist only in memory. A reboot also restarts the loader if persistence is in place.
-
Map everything from the image.
- the loader, the command tool, the shell and the start script;
- every persistence entry: udev rule, rc script, unit,
rc.modules; - tagged lines in configuration files;
- companion tools such as the ICMP shell.
Then search the network logs for the magic-packet source and the shell's destination.
-
Rebuild. Reptile gives root to unprivileged users on request, runs a remote shell as root and edits what files appear to contain. Cleaning in place cannot prove that nothing else was changed. Rebuild the host from known-good media.
-
Rotate credentials. Rotate everything stored on or used from the host. In UNC3886's case, also rotate the TLS certificates and keys that were reused from network devices.
-
Harden. Enforce module signatures (Secure Boot with lockdown, or
module.sig_enforce=1), and auditinit_moduleandfinit_module. Alert on new udev rules and rc scripts, and on network activity from kernel threads.
Syslogk and Adore-ng use similar magic-packet and hiding designs. Diamorphine is the simpler open-source module often seen beside it in cryptomining cases.
Sources
Primary public reports, newest first.
- 2026-04-02Hooked on Linux: Rootkit Detection EngineeringElastic Security Labs
- 2024-06-18Cloaked and Covert: Uncovering UNC3886 Espionage OperationsGoogle Cloud (Mandiant)
- 2023-07-21Reptile Malware Targeting Linux SystemsAhnLab ASEC
- 2023-03-28Mélofée: a new alien malware in the Panda's toolset targeting Linux hostsExaTrack
- 2017-10-22Reptile source repositoryGitHub
See also
Related families
- DiamorphineLinux LKM rootkit
- KoviDLinux LKM rootkit
- SyslogkLinux LKM rootkit
- Adore-ngLinux LKM rootkit