Website-Suche

So scannen Sie mit „Rootkit Hunter“ unter Linux nach Rootkits, Backdoors und Exploits


Leute, wenn Sie regelmäßig linux-console.net lesen, werden Sie feststellen, dass dies unser dritter Artikel über Sicherheitstools ist. In unseren beiden vorherigen Artikeln haben wir Ihnen alle Anleitungen gegeben, wie Sie Apache- und Linux-Systeme vor Malware, DOS, - und DDOS-Angriffe mit mod_security und mod_evasive sowie LMD (Linux Malware Detect).

Wieder einmal sind wir hier, um ein neues Sicherheitstool namens Rkhunter (Rootkit Hunter) vorzustellen. Dieser Artikel zeigt Ihnen, wie Sie RKH (RootKit Hunter) in Linux-Systemen mithilfe von Quellcode installieren und konfigurieren.

Was ist Rkhunter?

Rkhunter (Rootkit Hunter) ist ein Open-Source-Scanner-Tool auf Unix/Linux-Basis für Linux-Systeme, das unter der GPL veröffentlicht wurde und Hintertüren, Rootkits usw. scannt lokale Exploits auf Ihren Systemen.

Es scannt versteckte Dateien, falsche Berechtigungen für Binärdateien, verdächtige Zeichenfolgen im Kernel usw. Um mehr über Rkhunter und seine Funktionen zu erfahren, besuchen Sie http://rkhunter.sourceforge.net/.

Installieren Sie den Rootkit Hunter Scanner in Linux-Systemen

Schritt 1: Rkhunter herunterladen

Laden Sie zunächst die neueste stabile Version des Rkhunter-Tools herunter, indem Sie auf http://rkhunter.sourceforge.net/ gehen oder den folgenden Wget-Befehl verwenden, um es auf Ihre Systeme herunterzuladen .

cd /tmp
wget http://downloads.sourceforge.net/project/rkhunter/rkhunter/1.4.6/rkhunter-1.4.6.tar.gz

Schritt 2: Rkhunter installieren

Nachdem Sie die neueste Version heruntergeladen haben, führen Sie die folgenden Befehle als root-Benutzer aus, um sie zu installieren.

tar -xvf rkhunter-1.4.6.tar.gz 
cd rkhunter-1.4.6
./installer.sh --layout default --install
Beispielausgabe
Checking system for:
 Rootkit Hunter installer files: found
 A web file download command: wget found
Starting installation:
 Checking installation directory "/usr/local": it exists and is writable.
 Checking installation directories:
  Directory /usr/local/share/doc/rkhunter-1.4.2: creating: OK
  Directory /usr/local/share/man/man8: exists and is writable.
  Directory /etc: exists and is writable.
  Directory /usr/local/bin: exists and is writable.
  Directory /usr/local/lib64: exists and is writable.
  Directory /var/lib: exists and is writable.
  Directory /usr/local/lib64/rkhunter/scripts: creating: OK
  Directory /var/lib/rkhunter/db: creating: OK
  Directory /var/lib/rkhunter/tmp: creating: OK
  Directory /var/lib/rkhunter/db/i18n: creating: OK
  Directory /var/lib/rkhunter/db/signatures: creating: OK
 Installing check_modules.pl: OK
 Installing filehashsha.pl: OK
 Installing stat.pl: OK
 Installing readlink.sh: OK
 Installing backdoorports.dat: OK
 Installing mirrors.dat: OK
 Installing programs_bad.dat: OK
 Installing suspscan.dat: OK
 Installing rkhunter.8: OK
 Installing ACKNOWLEDGMENTS: OK
 Installing CHANGELOG: OK
 Installing FAQ: OK
 Installing LICENSE: OK
 Installing README: OK
 Installing language support files: OK
 Installing ClamAV signatures: OK
 Installing rkhunter: OK
 Installing rkhunter.conf: OK
Installation complete

Schritt 3: Rkhunter aktualisieren

Führen Sie den RKH-Updater aus, um die Datenbankeigenschaften zu füllen, indem Sie den folgenden Befehl ausführen.

/usr/local/bin/rkhunter --update
/usr/local/bin/rkhunter --propupd
Beispielausgabe
[ Rootkit Hunter version 1.4.6 ]

Checking rkhunter data files...
  Checking file mirrors.dat                                  [ Updated ]
  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                                      [ No update ]
  Checking file i18n/tr                                      [ No update ]
  Checking file i18n/tr.utf8                                 [ No update ]
  Checking file i18n/zh                                      [ No update ]
  Checking file i18n/zh.utf8                                 [ No update ]
  Checking file i18n/ja                                      [ No update ]
File created: searched for 177 files, found 131, missing hashes 1

Schritt 4: Cronjob- und E-Mail-Benachrichtigungen einrichten

Erstellen Sie unter /etc/cron.daily/ eine Datei mit dem Namen rkhunter.sh, die dann täglich Ihr Dateisystem scannt und E-Mail-Benachrichtigungen sendet an Ihre E-Mail-ID. Erstellen Sie die folgende Datei mit Hilfe Ihres bevorzugten Editors.

vi /etc/cron.daily/rkhunter.sh

Fügen Sie die folgenden Codezeilen hinzu und ersetzen Sie „YourServerNameHere“ durch Ihren „Servernamen“ und „PutYourServerNameHere)' [email 

Legen Sie die Ausführungsberechtigung für die Datei fest.

chmod 755 /etc/cron.daily/rkhunter.sh

Schritt 5: Manueller Scan und Verwendung

Um das gesamte Dateisystem zu scannen, führen Sie Rkhunter als Root-Benutzer aus.

rkhunter --check
Beispielausgabe
[ Rootkit Hunter version 1.4.6 ]

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/local/bin/rkhunter                                  [ OK ]
    /usr/sbin/adduser                                        [ OK ]
    /usr/sbin/chkconfig                                      [ OK ]
    /usr/sbin/chroot                                         [ OK ]
    /usr/sbin/depmod                                         [ OK ]
    /usr/sbin/fsck                                           [ OK ]
    /usr/sbin/fuser                                          [ OK ]
    /usr/sbin/groupadd                                       [ OK ]
    /usr/sbin/groupdel                                       [ OK ]
    /usr/sbin/groupmod                                       [ OK ]
    /usr/sbin/grpck                                          [ OK ]
    /usr/sbin/ifconfig                                       [ OK ]
    /usr/sbin/ifdown                                         [ Warning ]
    /usr/sbin/ifup                                           [ Warning ]
    /usr/sbin/init                                           [ OK ]
    /usr/sbin/insmod                                         [ OK ]
    /usr/sbin/ip                                             [ OK ]
    /usr/sbin/lsmod                                          [ OK ]
    /usr/sbin/lsof                                           [ OK ]
    /usr/sbin/modinfo                                        [ OK ]
    /usr/sbin/modprobe                                       [ OK ]
    /usr/sbin/nologin                                        [ OK ]
    /usr/sbin/pwck                                           [ OK ]
    /usr/sbin/rmmod                                          [ OK ]
    /usr/sbin/route                                          [ OK ]
    /usr/sbin/rsyslogd                                       [ OK ]
    /usr/sbin/runlevel                                       [ OK ]
    /usr/sbin/sestatus                                       [ OK ]
    /usr/sbin/sshd                                           [ OK ]
    /usr/sbin/sulogin                                        [ OK ]
    /usr/sbin/sysctl                                         [ OK ]
    /usr/sbin/tcpd                                           [ OK ]
    /usr/sbin/useradd                                        [ OK ]
    /usr/sbin/userdel                                        [ OK ]
    /usr/sbin/usermod                                        [ OK ]
....
[Press  to continue]


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 ]
.....

[Press  to continue]


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

....
[Press  to continue]


Checking the network...

  Performing checks on the network ports
    Checking for backdoor ports                              [ None found ]
....
  Performing system configuration file checks
    Checking for an SSH configuration file                   [ Found ]
    Checking if SSH root access is allowed                   [ Warning ]
    Checking if SSH protocol v1 is allowed                   [ Warning ]
    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 ]
...
System checks summary
=====================

File properties checks...
    Files checked: 137
    Suspect files: 6

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

Applications checks...
    Applications checked: 5
    Suspect applications: 2

The system checks took: 5 minutes and 38 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)

Der obige Befehl generiert eine Protokolldatei unter /var/log/rkhunter.log mit den von Rkhunter durchgeführten Prüfergebnissen.

cat /var/log/rkhunter.log
Beispielausgabe
[11:21:04] Running Rootkit Hunter version 1.4.6 on tecmint
[11:21:04]
[11:21:04] Info: Start date is Mon Dec 21 11:21:04 AM IST 2020
[11:21:04]
[11:21:04] Checking configuration file and command-line options...
[11:21:04] Info: Detected operating system is 'Linux'
[11:21:04] Info: Found O/S name: Fedora release 33 (Thirty Three)
[11:21:04] Info: Command line is /usr/local/bin/rkhunter --check
[11:21:04] Info: Environment shell is /bin/bash; rkhunter is using bash
[11:21:04] Info: Using configuration file '/etc/rkhunter.conf'
[11:21:04] Info: Installation directory is '/usr/local'
[11:21:04] Info: Using language 'en'
[11:21:04] Info: Using '/var/lib/rkhunter/db' as the database directory
[11:21:04] Info: Using '/usr/local/lib64/rkhunter/scripts' as the support script directory
[11:21:04] Info: Using '/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /bin /sbin /usr/libexec /usr/local/libexec' as the command directories
[11:21:04] Info: Using '/var/lib/rkhunter/tmp' as the temporary directory
[11:21:04] Info: No mail-on-warning address configured
[11:21:04] Info: X will be automatically detected
[11:21:04] Info: Found the 'basename' command: /usr/bin/basename
[11:21:04] Info: Found the 'diff' command: /usr/bin/diff
[11:21:04] Info: Found the 'dirname' command: /usr/bin/dirname
[11:21:04] Info: Found the 'file' command: /usr/bin/file
[11:21:04] Info: Found the 'find' command: /usr/bin/find
[11:21:04] Info: Found the 'ifconfig' command: /usr/sbin/ifconfig
[11:21:04] Info: Found the 'ip' command: /usr/sbin/ip
[11:21:04] Info: Found the 'ipcs' command: /usr/bin/ipcs
[11:21:04] Info: Found the 'ldd' command: /usr/bin/ldd
[11:21:04] Info: Found the 'lsattr' command: /usr/bin/lsattr
...

Für weitere Informationen und Optionen führen Sie bitte den folgenden Befehl aus.

rkhunter --help

Wenn Ihnen dieser Artikel gefallen hat, dann ist das Teilen die richtige Art, sich zu bedanken.