How to Install Chkrootkit on Ubuntu 16.04

Overview

In this tutorial we’ll learn how to install chkrootkit on Ubuntu 16.04 (Xenial Xerus).

Chkrootkit is a tool that will check locally for a sign of a rootkit. It will check the following items:

– Modification of system binaries
– Check whether network interface is in promiscuous mode or not
– Deletion of lastlog, utmp and wtmp.
– Signs for LKM trojans.

Objectives

In this tutorial we’ll learn how to install chkrootkit from Ubuntu repository and also install chkrootkit from source.

Prerequisite

Ubuntu 16.04 installation, you can use any flavor of Ubuntu 16.04 like Kubuntu or Xubuntu. In this tutorial I use Ubuntu Server 16.04. Let’s get started.

Install Chkrootkit on Ubuntu 16.04

Update apt repository metadata


sudo apt-get update

```

install chkrootkit using command below


sudo apt-get -y install chkrootkit

```

When we run chkrootkit without root privileges


chkrootkit 

```

We will get error similar to output below


/usr/sbin/chkrootkit need root privileges

```

We can run chkrootkit using sudo


sudo chkrootkit

```

Sample of chkrootkit scanning output


ROOTDIR is `/'
Checking `amd'...                                           not found
Checking `basename'...                                      not infected
Checking `biff'...                                          not found
Checking `chfn'...                                          not infected
Checking `chsh'...                                          not infected
Checking `cron'...                                          not infected
Checking `crontab'...                                       not infected
Checking `date'...                                          not infected
Checking `du'...                                            not infected
Checking `dirname'...                                       not infected
Checking `echo'...                                          not infected
Checking `egrep'...                                         not infected
Checking `env'...                                           not infected
Checking `find'...                                          not infected
Checking `fingerd'...                                       not found
Checking `gpm'...                                           not found
Checking `grep'...                                          not infected
Checking `hdparm'...                                        not infected
Checking `su'...                                            not infected
Checking `ifconfig'...                                      not infected
Checking `inetd'...                                         not infected
Checking `inetdconf'...                                     not found
Checking `identd'...                                        not found
Checking `init'...                                          not infected
Checking `killall'...                                       not infected
Checking `ldsopreload'...                                   not infected
Checking `login'...                                         not infected
Checking `ls'...                                            not infected
Checking `lsof'...                                          not infected
Checking `mail'...                                          not found
Checking `mingetty'...                                      not found
Checking `netstat'...                                       not infected
Checking `named'...                                         not found
Checking `passwd'...                                        not infected
Checking `pidof'...                                         not infected
Checking `pop2'...                                          not found
Checking `pop3'...                                          not found
Checking `ps'...                                            not infected
Checking `pstree'...                                        not infected
Checking `rpcinfo'...                                       not found
Checking `rlogind'...                                       not found
Checking `rshd'...                                          not found
Checking `slogin'...                                        not infected
Checking `sendmail'...                                      not found
Checking `sshd'...                                          not infected
Checking `syslogd'...                                       not tested
Checking `tar'...                                           not infected
Checking `tcpd'...                                          not infected
Checking `tcpdump'...                                       not infected
Checking `top'...                                           not infected
Checking `telnetd'...                                       not found
Checking `timed'...                                         not found
Checking `traceroute'...                                    not found
Checking `vdir'...                                          not infected
Checking `w'...                                             not infected
Checking `write'...                                         not infected
Checking `aliens'...                                        no suspect files
Searching for sniffer's logs, it may take a while...        nothing found
Searching for rootkit HiDrootkit's default files...         nothing found
Searching for rootkit t0rn's default files...               nothing found
Searching for t0rn's v8 defaults...                         nothing found
Searching for rootkit Lion's default files...               nothing found
Searching for rootkit RSHA's default files...               nothing found
Searching for rootkit RH-Sharpe's default files...          nothing found
Searching for Ambient's rootkit (ark) default files and dirs... nothing found
Searching for suspicious files and dirs, it may take a while... The following suspicious files and directories were found:  
/lib/modules/4.4.0-130-generic/vdso/.build-id
/lib/modules/4.4.0-130-generic/vdso/.build-id
Searching for LPD Worm files and dirs...                    nothing found
Searching for Ramen Worm files and dirs...                  nothing found
Searching for Maniac files and dirs...                      nothing found
Searching for RK17 files and dirs...                        nothing found
Searching for Ducoci rootkit...                             nothing found
Searching for Adore Worm...                                 nothing found
Searching for ShitC Worm...                                 nothing found
Searching for Omega Worm...                                 nothing found
Searching for Sadmind/IIS Worm...                           nothing found
Searching for MonKit...                                     nothing found
Searching for Showtee...                                    nothing found
Searching for OpticKit...                                   nothing found
Searching for T.R.K...                                      nothing found
Searching for Mithra...                                     nothing found
Searching for LOC rootkit...                                nothing found
Searching for Romanian rootkit...                           nothing found
Searching for Suckit rootkit...                             nothing found
Searching for Volc rootkit...                               nothing found
Searching for Gold2 rootkit...                              nothing found
Searching for TC2 Worm default files and dirs...            nothing found
Searching for Anonoying rootkit default files and dirs...   nothing found
Searching for ZK rootkit default files and dirs...          nothing found
Searching for ShKit rootkit default files and dirs...       nothing found
Searching for AjaKit rootkit default files and dirs...      nothing found
Searching for zaRwT rootkit default files and dirs...       nothing found
Searching for Madalin rootkit default files...              nothing found
Searching for Fu rootkit default files...                   nothing found
Searching for ESRK rootkit default files...                 nothing found
Searching for rootedoor...                                  nothing found
Searching for ENYELKM rootkit default files...              nothing found
Searching for common ssh-scanners default files...          nothing found
Searching for Linux/Ebury - Operation Windigo ssh...        Possible Linux/Ebury - Operation Windigo installetd
Searching for 64-bit Linux Rootkit ...                      nothing found
Searching for 64-bit Linux Rootkit modules...               nothing found
Searching for suspect PHP files...                          nothing found
Searching for anomalies in shell history files...           nothing found
Checking `asp'...                                           not infected
Checking `bindshell'...                                     not infected
Checking `lkm'...                                           chkproc: nothing detected
chkdirs: nothing detected
Checking `rexedcs'...                                       not found
Checking `sniffer'...                                       lo: not promisc and no packet sniffer sockets
enp0s3: PACKET SNIFFER(/sbin/dhclient[882])
Checking `w55808'...                                        not infected
Checking `wted'...                                          chkwtmp: nothing deleted
Checking `scalper'...                                       not infected
Checking `slapper'...                                       not infected
Checking `z2'...                                            chklastlog: nothing deleted
Checking `chkutmp'...                                       chkutmp: nothing deleted
Checking `OSX_RSPLUG'...                                    not infected

```

## Enable Daily Check of chkrootkit

We can enable daily check by changing configuration file. Open `/etc/chkrootkit.conf`

Find line


RUN_DAILY="false"

```

Replace with


RUN_DAILY="true"

```

## Install Latest Version of Chkrootkit from Source

chkrootkit shipped with Ubuntu 16.04 (Xenial Xerus) is not the latest version of chkrootkit.

We can check using dpkg with option -l


dpkg -l | grep chkrootkit
ii  chkrootkit                       0.50-3.2                                   amd64        rootkit detector

```

At the time of this writing, the latest stable version of chkrootkit is version 0.52. We can download latest stable version of chkrootkit from [chkrootkit download page][1].

Before we download and compile chkrootkit let's install `make` and `gcc`


sudo apt-get install -y make gcc

```

Download chkrootkit source code


wget -c ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit-0.52.tar.gz

```

Extract downloaded archive. This will create new directory named `chkrootkit-0.52`


tar xzf chkrootkit-0.52.tar.gz

```

Go to extracted directory


cd chkrootkit-0.52/

```

Compile chkrootkit using command below


make sense

```

We can check chkrootkit that we just compile


./chkrootkit -V
chkrootkit version 0.52

```

## Summary

In this tutorial we learned how to install chkrootkit on Ubuntu 16.04 (Xenial Xerus). We also learn enabling daily check of chkrootkit.

To get the updated chkrootkit version we learn compiling chkrootkit from source.

Hope this tutorial help you secure your system from potential rootkit by scanning your systems from known rootkit.

 [1]: http://www.chkrootkit.org/download/