Nikto

Siehe auch

Nikto ist ein in Perl geschriebener Open Source Web Server Scanner: er testet Web Server auf über 6’700 potentiell schädliche Dateien und Programme, prüft über 1’250 Server-Versionen auf ihre Aktualität und weist bei über 270 Server-Versionen auf bekannte Sicherheitslücken hin. Der Scanner prüft Header und versucht ausserdem, ausnutzbare Fehler und Defaults in der Webserver-Konfiguration aufzudecken.

Nikto schickt ca. 7’500 GET-Requests an den Webserver, um auf das Vorhandensein unsicherer Inhalte zu prüfen, richtet also keinen Schaden an und kann daher auch regelmässig gegen Produktivumgebungen laufen gelassen werden.

Die Konfigurationsdatei liegt unter /etc/nikto/config. Nikto arbeitet mit Plugins, die unter /usr/share/nikto/plugins zu finden sind; die Vulnerability-„Datenbanken“ sind reiner ASCII-Text und liegen unter /usr/share/nikto/databases. Nikto kann nicht über SOCKS-Proxies arbeiten.

Auf CentOS und Fedora kommen die Signatur-Updates für den Scanner über die Paketverwaltung, da muss man sich nicht drum kümmern.

Versionen
  • Fedora 32+: 2.1.6 (fedora)

  • CentOS 8: -

  • CentOS 7: 2.1.6 (EPEL)

  • CentOS 6: -

Links

Installation und Konfiguration

yum -y install perl-Net perl-bignum
yum -y install nikto

Besser:

git clone https://github.com/sullo/nikto

Achtung

Nikto installiert und verwendet nmap, was von einigen anderen Security-Scannern naturgemäss als Finding moniert wird.

Bei der Konfiguration stösst man auf den Begriff RFI (Remote File Inclusion). Damit Nikto erfolgreich testen kann, ob sich einer Seite erfolgreich ein externes, ausführbares Dokument (z.B. Malware) unterschieben lässt, hinterlegt man ein harmloses RFI-Beispiel auf dem eigenen Server, und referenziert das in der /etc/nikto/config in RFIURL. Beispiele für solch eine Datei rfiinc.php, hier in PHP:

rfiinc.php
<?php
    print "nik" . "to:" . 76197629 * 134.22 . ":<br>\n";

Wer Nikto aktualisieren möchte, verwendet:

# git version:
git pull --all

# yum/dnf version:
nikto -update

Verwendung

Scan gegen einen Host auf Port 80:

nikto -host $HOST -ssl

Die Ausgabe während der Arbeit:

- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:          1.2.3.4
+ Target Hostname:    $HOST
+ Target Port:        80
+ Start Time:         2020-06-29 09:38:06 (GMT2)
---------------------------------------------------------------------------
+ Server: Apache
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
+ Root page / redirects to: https://$HOST/
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ 7518 requests: 0 error(s) and 3 item(s) reported on remote host
+ End Time:           2020-06-29 09:39:52 (GMT2) (106 seconds)
---------------------------------------------------------------------------

Scan gegen einen Host auf Port 443 (dauert knapp 15 Minuten), Output soll etwas ausführlicher sein:

nikto -host $HOST -Display V -ssl

So scannt man einen Webserver, dessen Angebot über HTTP Basic Auth erreichbar ist:

nikto -host $HOST -id $USERNAME:$PASSWORD

Nur Misconfiguration (2) und SQL-Injections (9) testen:

nikto -host $HOST -Tuning 29

Alles testen, ausser Denial of Service (6):

nikto -host $HOST -Tuning x 6

Ausgabe in Datei speichern. Als Format kann CSV, HTML, Text und XML gewählt werden:

nikto -host $HOST -output $FILE -Format htm

Ein komplexerer Aufruf:

nikto -host $HOST -id $USERNAME:$PASSWORD -Cgidirs all -ssl -plugins ALL -vhost $HOST

Die Tuning-Options im Überblick:

0 – File Upload
1 – Interesting File / Seen in logs
2 – Misconfiguration / Default File
3 – Information Disclosure
4 – Injection (XSS/Script/HTML)
5 – Remote File Retrieval – Inside Web Root
6 – Denial of Service
7 – Remote File Retrieval – Server Wide
8 – Command Execution / Remote Shell
9 – SQL Injection
a – Authentication Bypass
b – Software Identification
c – Remote Source Inclusion
x – Reverse Tuning Options (i.e., include all except specified)

Individuelle Config-Datei mit geändertem User-Agent (absolute Pfade verwenden):

~/.config/nikto.conf
CHECKMETHODS=GET
CIRT=107.170.99.251
DBDIR=/home/nikto/program/databases
DEFAULTHTTPVER=1.1
DOCDIR=/home/nikto/program/docs
EXECDIR=/home/nikto/program
FAILURES=20
LW_SSL_ENGINE=auto
MAX_WARN=20
NIKTODTD=/home/nikto/program/docs/nikto.dtd
PLUGINDIR=/home/nikto/program/plugins
RFIURL=http://cirt.net/rfiinc.txt?
SKIPPORTS=21 111
TEMPLATEDIR=/home/nikto/program/templates
UPDATES=yes
USERAGENT=Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0
nikto -config ~/.config/nikto -host $HOST

Built on 2024-04-18