Cos’è Rootkit Hunter ( rkhunter )

Rootkit Hunter ( rkhunter ) è uno shell script che scanna sistemi operativi Linux alla ricerca di rootkits, cavalli di troia e altri rischi per la sicurezza.

Alcune altre funzioni di Rootkit Hunter sono:

  • Controllare i file di configurazione di SSHD per poi dare un avvertimento se le impostazioni non sono sicure
  • Comparare le MD5 hashes
  • Controllare se ci sono stringe di commando sospette nei moduli del Kernel
  • Controllare se i file binari hanno permessi sbagliati
  • Cercare file e cartelle nascoste nel sistema

Un rootkit è un programma installato all’insaputa dell’utente o dell’amministratore su un computer o un server che permette a chi l’ha installato di avere un accesso di tipo privilegiato. Il nome rootkit è formato da due parole, root, che è l’amministratore nei sistemi Unix e Linux, e kit. Con un rootkit un “attacker” può “aprirsi” una backdoor nel sistema compromesso cosa che gli permette di installare programmi, creare degli user account, cambiare le configurazioni del sistema, rubare dati, monitorare le attività degli utenti, cancellare file o intere cartelle e altro.

Cosa fare se si trovano dei Rootkits

Diversi esperti sulla sicurezza affermano che una volta che un sistema è stato compromesso con un rootkit, è consigliato di fare un rebuild del sistema. Il problema è che anche nel caso si sia in grado di rilevare ogni file o processo associato con il rootkit, è moto difficile essere al 100% sicuri di avere eliminato ogni parte del rootkit. Rootkit Hunter ( rkhunter ) non è un Antivirus serve per capire se il proprio sistema è stato compromesso per poi adottare delle misure.

Installazione Rootkit Hunter

# apt install rkhunter 	   [On Debian/Ubuntu]
# yum install rkhunter	   [On RHEL/CentOS] 	
# dnf install rkhunter	   [On Fedora 22+]
# zypper install rkhunter  [On openSUSE]

Fare un update di Rootkit Hunter

Eseguire il Rootkit Hunter updater per riempire la banca dati con i seguenti comandi.

chit-server:/ # rkhunter --update
[ Rootkit Hunter version 1.4.4 ]

Checking rkhunter data files...
  Checking file mirrors.dat                                  [ No update ]
  Checking file programs_bad.dat                             [ No update ]
  Checking file backdoorports.dat                            [ No update ]
  Checking file suspscan.dat                                 [ No update ]
  Checking file i18n/cn                                      [ No update ]
  Checking file i18n/de                                      [ No update ]
  Checking file i18n/en                                      [ Updated ]
  Checking file i18n/tr                                      [ Updated ]
  Checking file i18n/tr.utf8                                 [ Updated ]
  Checking file i18n/zh                                      [ No update ]
  Checking file i18n/zh.utf8                                 [ No update ]
  Checking file i18n/ja                                      [ No update ]
chit-server:/local #

chit-server:/ # rkhunter --propupd
[ Rootkit Hunter version 1.4.4 ]
File created: searched for 175 files, found 196
chit-server:/ # 

Scannare il sistema con Rootkit Hunter

Eseguire il seguente comando per avviare lo scanner manualmente.

chit-server:/ # rkhunter --check
[ Rootkit Hunter version 1.4.4 ]

Checking system commands...

  Performing 'strings' command checks
    Checking 'strings' command                               [ OK ]

  Performing 'shared libraries' checks
    Checking for preloading variables                        [ None found ]
    Checking for preloaded libraries                         [ None found ]
    Checking LD_LIBRARY_PATH variable                        [ Not found ]

  Performing file properties checks
    Checking for prerequisites                               [ OK ]
    /usr/bin/awk                                             [ OK ]
    /usr/bin/basename                                        [ OK ]
    /usr/bin/cat                                             [ OK ]
    /usr/bin/chattr                                          [ OK ]
    /usr/bin/chkconfig                                       [ OK ]
    /usr/bin/chmod                                           [ OK ]
    /usr/bin/chown                                           [ OK ]
    /usr/bin/chroot                                          [ OK ]
    /usr/bin/cp                                              [ OK ]
    /usr/bin/csh                                             [ OK ]
    /usr/bin/curl                                            [ OK ]
    /usr/bin/cut                                             [ OK ]
    /usr/bin/date                                            [ OK ]
    /usr/bin/df                                              [ OK ]
    /usr/bin/diff                                            [ OK ]
    /usr/bin/dirname                                         [ OK ]
    /usr/bin/dmesg                                           [ OK ]                                                                                                                             
    /usr/bin/du                                              [ OK ]                                                                                                                             
    /usr/bin/echo                                            [ OK ]                                                                                                                             
    /usr/bin/ed                                              [ OK ]                                                                                                                             
    /usr/bin/egrep                                           [ OK ]                                                                                                                             
    /usr/bin/env                                             [ OK ]                                                                                                                             
    /usr/bin/fgrep                                           [ OK ]                                                                                                                             
    /usr/bin/file                                            [ OK ]                                                                                                                             
    /usr/bin/find                                            [ OK ]                                                                                                                             
    /usr/bin/grep                                            [ OK ]                                                                                                                             
    /usr/bin/groups                                          [ OK ]                                                                                                                             
    /usr/bin/head                                            [ OK ]                                                                                                                             
    /usr/bin/id                                              [ OK ]                                                                                                                             
    /usr/bin/ipcs                                            [ OK ]                                                                                                                             
    /usr/bin/kill                                            [ OK ]                                                                                                                             
    /usr/bin/killall                                         [ OK ]                                                                                                                             
    /usr/bin/last                                            [ OK ]                                                                                                                             
    /usr/bin/lastlog                                         [ OK ]                                                                                                                             
    /usr/bin/ldd                                             [ OK ]                                                                                                                             
    /usr/bin/less                                            [ OK ]                                                                                                                             
    /usr/bin/logger                                          [ OK ]                                                                                                                             
    /usr/bin/ls                                              [ OK ]                                                                                                                             
    /usr/bin/lsattr                                          [ OK ]                                                                                                                             
    /usr/bin/lsmod                                           [ OK ]                                                                                                                             
    /usr/bin/lsof                                            [ OK ]
    /usr/bin/mail                                            [ OK ]
    /usr/bin/md5sum                                          [ OK ]
    /usr/bin/mktemp                                          [ OK ]
    /usr/bin/more                                            [ OK ]
    /usr/bin/mount                                           [ OK ]
    /usr/bin/mv                                              [ OK ]
    /usr/bin/newgrp                                          [ OK ]
    /usr/bin/passwd                                          [ OK ]
    /usr/bin/perl                                            [ OK ]
    /usr/bin/pgrep                                           [ OK ]
    /usr/bin/ping                                            [ OK ]
    /usr/bin/pkill                                           [ OK ]
    /usr/bin/ps                                              [ OK ]
    /usr/bin/pstree                                          [ OK ]
    /usr/bin/pwd                                             [ OK ]
.........................................................................
    /bin/ls                                                  [ OK ]
    /bin/lsmod                                               [ OK ]
    /bin/mail                                                [ OK ]
    /bin/md5sum                                              [ OK ]
    /bin/mktemp                                              [ OK ]
    /bin/more                                                [ OK ]
    /bin/mount                                               [ OK ]
    /bin/mv                                                  [ OK ]
    /bin/netstat                                             [ OK ]
    /bin/pgrep                                               [ OK ]
    /bin/ping                                                [ OK ]
    /bin/pkill                                               [ OK ]
    /bin/ps                                                  [ OK ]
    /bin/pwd                                                 [ OK ]
    /bin/readlink                                            [ OK ]
    /bin/rpm                                                 [ OK ]
    /bin/sed                                                 [ OK ]
    /bin/sh                                                  [ OK ]
    /bin/sort                                                [ OK ]
    /bin/stat                                                [ OK ]
    /bin/su                                                  [ OK ]
    /bin/touch                                               [ OK ]
    /bin/uname                                               [ OK ]
    /bin/gawk                                                [ OK ]
    /bin/tcsh                                                [ OK ]
    /bin/kmod                                                [ OK ]
    /bin/systemd                                             [ OK ]
    /bin/systemctl                                           [ OK ]
    /usr/lib/systemd/systemd                                 [ OK ]
    /etc/rkhunter.conf                                       [ OK ]
    /etc/rkhunter.d/00-opensuse.conf                         [ OK ]

Checking for rootkits...                                                                                                                                                                                                                                                       
                                                                                                                                                                                                                                                                               
  Performing check of known rootkit files and directories                                                                                                                                                                                                                      
    55808 Trojan - Variant A                                 [ Not found ]
    ADM Worm                                                 [ Not found ]
    AjaKit Rootkit                                           [ Not found ]
    Adore Rootkit                                            [ Not found ]
    aPa Kit                                                  [ Not found ]
    Apache Worm                                              [ Not found ]
    Ambient (ark) Rootkit                                    [ Not found ]
    Balaur Rootkit                                           [ Not found ]
    BeastKit Rootkit                                         [ Not found ]
    beX2 Rootkit                                             [ Not found ]
    BOBKit Rootkit                                           [ Not found ]
    cb Rootkit                                               [ Not found ]
    CiNIK Worm (Slapper.B variant)                           [ Not found ]
    Danny-Boy's Abuse Kit                                    [ Not found ]
    Devil RootKit                                            [ Not found ]
    Dica-Kit Rootkit                                         [ Not found ]
    Dreams Rootkit                                           [ Not found ]
    Duarawkz Rootkit                                         [ Not found ]
    Enye LKM                                                 [ Not found ]
    Flea Linux Rootkit                                       [ Not found ]
    Fu Rootkit                                               [ Not found ]
    Fuck`it Rootkit                                          [ Not found ]
    GasKit Rootkit                                           [ Not found ]
    Heroin LKM                                               [ Not found ]
    HjC Kit                                                  [ Not found ]
    ignoKit Rootkit                                          [ Not found ]
    IntoXonia-NG Rootkit                                     [ Not found ]
    Irix Rootkit                                             [ Not found ]
    Jynx Rootkit                                             [ Not found ]
    KBeast Rootkit                                           [ Not found ]
    Kitko Rootkit                                            [ Not found ]
    Knark Rootkit                                            [ Not found ]
    ld-linuxv.so Rootkit                                     [ Not found ]
    Li0n Worm                                                [ Not found ]
    Lockit / LJK2 Rootkit                                    [ Not found ]
    Mood-NT Rootkit                                          [ Not found ]
    MRK Rootkit                                              [ Not found ]
    Ni0 Rootkit                                              [ Not found ]
    Ohhara Rootkit                                           [ Not found ]
    Optic Kit (Tux) Worm                                     [ Not found ]
    Oz Rootkit                                               [ Not found ]
    Phalanx Rootkit                                          [ Not found ]
    Phalanx2 Rootkit                                         [ Not found ]
    Phalanx2 Rootkit (extended tests)                        [ Not found ]
    Portacelo Rootkit                                        [ Not found ]
    R3dstorm Toolkit                                         [ Not found ]
    RH-Sharpe's Rootkit                                      [ Not found ]
    RSHA's Rootkit                                           [ Not found ]
    Scalper Worm                                             [ Not found ]
    Sebek LKM                                                [ Not found ]
    Shutdown Rootkit                                         [ Not found ]
    SHV4 Rootkit                                             [ Not found ]
    SHV5 Rootkit                                             [ Not found ]
    Sin Rootkit                                              [ Not found ]
    Slapper Worm                                             [ Not found ]
    Sneakin Rootkit                                          [ Not found ]
    'Spanish' Rootkit                                        [ Not found ]
    Suckit Rootkit                                           [ Not found ]
    Superkit Rootkit                                         [ Not found ]
    TBD (Telnet BackDoor)                                    [ Not found ]
    TeLeKiT Rootkit                                          [ Not found ]
    T0rn Rootkit                                             [ Not found ]
    trNkit Rootkit                                           [ Not found ]
    Trojanit Kit                                             [ Not found ]
    Tuxtendo Rootkit                                         [ Not found ]
    URK Rootkit                                              [ Not found ]
    Vampire Rootkit                                          [ Not found ]
    VcKit Rootkit                                            [ Not found ]
    Volc Rootkit                                             [ Not found ]
    Xzibit Rootkit                                           [ Not found ]
    zaRwT.KiT Rootkit                                        [ Not found ]
    ZK Rootkit                                               [ Not found ]

[Press  to continue]


  Performing additional rootkit checks
    Suckit Rootkit additional checks                         [ OK ]
    Checking for possible rootkit files and directories      [ None found ]
    Checking for possible rootkit strings                    [ None found ]

  Performing malware checks
    Checking running processes for suspicious files          [ None found ]
    Checking for login backdoors                             [ None found ]
    Checking for sniffer log files                           [ None found ]
    Checking for suspicious directories                      [ None found ]
    Checking for suspicious shared memory segments           [ None found ]
  Performing trojan specific checks
    Checking for enabled xinetd services                     [ None found ]

  Performing Linux specific checks
    Checking loaded kernel modules                           [ OK ]
    Checking kernel module names                             [ OK ]

[Press  to continue]


Checking the network...

  Performing checks on the network ports
    Checking for backdoor ports                              [ None found ]

  Performing checks on the network interfaces
    Checking for promiscuous interfaces                      [ None found ]

Checking the local host...

  Performing system boot checks
    Checking for local host name                             [ Found ]
    Checking for system startup files                        [ Found ]
    Checking system startup files for malware                [ None found ]

  Performing group and account checks
    Checking for passwd file                                 [ Found ]
    Checking for root equivalent (UID 0) accounts            [ None found ]
    Checking for passwordless accounts                       [ None found ]
    Checking for passwd file changes                         [ None found ]
    Checking for group file changes                          [ None found ]
    Checking root account shell history files                [ OK ]

  Performing system configuration file checks
    Checking for an SSH configuration file                   [ Found ]
    Checking if SSH root access is allowed                   [ Not allowed ]
    Checking if SSH protocol v1 is allowed                   [ Not allowed ]
    Checking for a running system logging daemon             [ Found ]
    Checking for a system logging configuration file         [ Found ]
    Checking if syslog remote logging is allowed             [ Not allowed ]

  Performing filesystem checks
    Checking /dev for suspicious file types                  [ None found ]
    Checking for hidden files and directories                [ Warning ]

[Press  to continue]



System checks summary
=====================

File properties checks...
    Files checked: 196
    Suspect files: 0

Rootkit checks...
    Rootkits checked : 478
    Possible rootkits: 0

Applications checks...
    All checks skipped

The system checks took: 10 minutes and 31 seconds

All results have been written to the log file: /var/log/rkhunter.log

One or more warnings have been found while checking the system.
Please check the log file (/var/log/rkhunter.log)