Skip to content

Rootkit detection on cPanel with rkhunter and chkrootkit

Where rootkit scanners earn their keep on cPanel servers, how to schedule them without filling the inbox, and what to do when they alert.

rkhunter and chkrootkit have been on cPanel servers for over a decade. The reflex install is: yum install, set up cron, ignore the resulting daily emails. The signal-to-noise is low. But on the day a host is actually compromised at the system level — kernel module, modified /bin/login, hidden processes — these are the only tools that catch it before behavior changes.

What’s happening

rkhunter and chkrootkit scan for known rootkit signatures, modified system binaries, hidden processes, and suspicious network ports. They produce false positives liberally because every cPanel update changes binaries they thought were canonical. Without baselining and configuration, the daily report is unreadable. With baselining, it becomes a tripwire.

How to verify

rkhunter --version
chkrootkit -V
rkhunter --check --skip-keypress --quiet 2>&1 | tail -30
grep "Warning" /var/log/rkhunter.log | head
cat /etc/cron.daily/rkhunter 2>/dev/null

The Warning count in the rkhunter log is what an operator should be watching, not the volume of normal output.

The fix

  1. Install both if not present: yum install rkhunter chkrootkit. cPanel does not ship them.
  2. Baseline before running: rkhunter --propupd. This stores hashes of every system binary in /var/lib/rkhunter/db/rkhunter.dat. Without it, every legitimate binary change reads as a warning.
  3. Schedule via cron: /etc/cron.daily/rkhunter:
    #!/bin/bash
    /usr/bin/rkhunter --cronjob --update --quiet > /var/log/rkhunter.log
    grep "Warning" /var/log/rkhunter.log | mail -s "rkhunter $(hostname) warnings" ops@yourdomain.com
    Only mail when warnings exist — silent runs do not generate noise.
  4. Re-baseline after each cPanel update: rkhunter --propupd after upcp. Otherwise every cPanel binary change becomes a warning.
  5. chkrootkit weekly: less frequent because it overlaps with rkhunter heavily. /etc/cron.weekly/chkrootkit running chkrootkit | mail is fine.
  6. When a warning is real: do not panic, but do not ignore. Compare the file in question against a known-good copy from the package (rpm -V <pkg> or equivalent). If the file is genuinely modified outside the package manager, escalate to a clean-room procedure.
  7. False positives to whitelist: cPanel scripts, CSF binaries, and a few EasyApache files are common false positives. Add them to /etc/rkhunter.conf.local with RTKT_FILE_WHITELIST=.

Stack Harbor configures rootkit detection and weekly review under cPanel/WHM management.