chkrootkit is an open-source rootkit scanner for Unix-like systems that inspects a host for the signatures, hidden files and kernel tricks left behind by known rootkits. In Linux security it serves as a lightweight detection tool: it does not prevent compromise, but it helps an administrator decide whether a machine shows the typical traces of an attacker who has gained root access.
The tool consists of a POSIX shell script plus a few small C programs, which makes it portable and easy to run on servers without extra dependencies. It is packaged by Debian, Ubuntu and most other distributions and is often used next to rkhunter as a second opinion during incident triage.
How chkrootkit detects rootkit traces
chkrootkit combines signature matching with a set of anomaly checks. The main script examines common system binaries such as ls, ps, netstat, login and sshd for strings and patterns known to appear in trojanized versions, and it searches the file system for files and directories that specific rootkits are known to create.
The compiled helpers look for inconsistencies that rootkits try to hide. Comparing different views of the same system state is the core idea: if /proc lists a process that ps does not show, or a directory link count does not match its visible entries, something may be concealing data.
The following table summarizes the bundled helper programs and what each one checks.
| Helper | What it checks | Indicator of compromise |
|---|---|---|
| chkproc | Process list in /proc against ps output | Hidden processes from kernel modules |
| chkdirs | Directory link counts against entries | Hidden directories |
| ifpromisc | Network interface flags | Interfaces in promiscuous mode for sniffing |
| chklastlog | Consistency of lastlog records | Deleted login records |
| chkwtmp | Gaps in the wtmp login file | Erased session entries |
| chkutmp | Current sessions against processes | Hidden logged-in users |
Running chkrootkit and reading its output
chkrootkit must run as root, because many of its checks read protected files and kernel interfaces. A plain run executes every test in sequence and prints one result line per test, which can be several hundred lines on a typical server.
Several command-line options change the scope or the trust model of a scan, as the next table shows.
| Option | Effect | When to use it |
|---|---|---|
| -q | Quiet mode that prints only findings | Scheduled scans and email reports |
| -x | Expert mode with raw string output | Manual analysis of suspicious binaries |
| -r directory | Uses another directory as the root | Scanning a mounted disk from rescue media |
| -p path | Takes external commands from a trusted path | Avoiding possibly trojanized tools |
| -l | Lists the available tests | Selecting individual checks |
| -n | Skips NFS-mounted directories | Hosts with large network shares |
Each result line uses a small vocabulary. not infected and nothing found mean that the test saw no known pattern, not found means that the inspected command does not exist on the system, and INFECTED means that a signature matched. Lines such as Searching for suspicious files list paths for manual review rather than confirmed threats.
chkrootkit among Linux security tools
chkrootkit is a post-compromise detector, and it is most useful when its role is clear relative to neighboring tools. It answers a narrow question about known rootkits, whereas integrity checkers, malware scanners and audit tools address broader questions.
| Tool | Detection method | Main strength |
|---|---|---|
| chkrootkit | Signatures and anomaly checks | Fast, dependency-free rootkit triage |
| rkhunter | Signatures plus file property checks | Baseline comparison of system binaries |
| AIDE | Cryptographic file integrity database | Detects any unauthorized file change |
| ClamAV | Antivirus signature database | Malware in files and mail attachments |
| Lynis | Configuration audit | Hardening recommendations, not detection |
A sound design uses these tools in layers: AIDE or IMA for integrity, auditd for event logging, and chkrootkit and rkhunter as periodic rootkit-specific checks. No single scanner covers all attacker techniques.
Scheduling and operational practice
On Debian-based systems the package can run a daily scan through cron, configured in /etc/chkrootkit.conf or a related file depending on the release. A useful setting compares each run with the previous output and reports only differences, which keeps known false positives from flooding the inbox.
- Record a clean baseline right after installation, before the host is exposed.
- Send quiet-mode output to a central log or mailbox that an attacker on the host cannot edit.
- Investigate every new INFECTED line promptly, even if earlier alerts were false.
- Keep the package updated, because signatures only cover known rootkits.
For a real investigation, the most reliable method is an offline scan: boot the machine from trusted rescue media, mount its disk and run chkrootkit with -r and -p pointing to clean binaries. This avoids relying on a kernel and tools that may already be under attacker control.
Limitations and false positives
chkrootkit has clear structural limits. It detects only rootkits whose traces are in its signature set, so a new or custom rootkit, an eBPF-based implant or a well-designed kernel module can pass unnoticed. A clean report therefore means no known indicators, not a proven clean system.
False positives are common and well documented. The table below lists typical cases.
| Reported finding | Common benign cause | Verification step |
|---|---|---|
| Bindshell on a port | Legitimate service on a listed port | Check the owning process with ss -tlnp |
| Suspicious hidden files | Package metadata or language caches | Confirm ownership with dpkg -S |
| Promiscuous interface | Packet capture or bridge in use | Check for tcpdump or a Linux bridge |
| Hidden process warning | Short-lived processes during the scan | Repeat the test and compare |
The key operational warning is that a compromised host can lie to any tool running on it. Treat chkrootkit as an early warning signal and confirm any serious finding with offline analysis and independent integrity data.
The simple explanation
A rootkit is hidden software that lets an intruder control a computer while concealing that it is there. chkrootkit is a checklist-driven inspector: it looks for the fingerprints that well-known rootkits usually leave behind and for places where the system seems to be hiding something.
It is like a security guard comparing two guest lists. If one list shows a person the other list leaves out, the guard raises a flag. The guard only recognizes familiar tricks, so a quiet result is reassuring but not a guarantee.
How it is used in practice
A hosting administrator notices that a Linux web server sends unusual outbound traffic at night, while ps and netstat show nothing out of place. Instead of trusting the running system, the administrator schedules a maintenance window, boots the server from a trusted rescue image and mounts its root file system under /mnt/target.
Running chkrootkit with -r /mnt/target and clean binaries from the rescue image reports a trojanized ps binary and a hidden directory under /usr/lib. The administrator preserves a disk image for forensic analysis, rotates all credentials and rebuilds the server from scratch, because a host with a confirmed rootkit cannot be trusted even after the visible files are removed. The rebuilt server is back in service within one working day.