serveur-debian-securite:nikto-tester-failles-securites-site-web

Ceci est une ancienne révision du document !


Tester les failles de sécurité de votre serveur web avec Nikto

Nikto est un scanner de sécurité pour tester les serveurs web.
C'est un programme écrit en langage PERL. Il permet de tester votre serveur web. Il recherche des failles diverses, de tester plus de 6000 vulnérabilités, de vérifier l'obsolescence du serveur et de ses logiciels.

Il faut disposer une connexion à internet configurée et activée.
Les lignes de commandes ci-dessous sont à entrer dans un terminal ayant les droits de super-administrateur (root).
Ce tutoriel a été testé sur Debian 8 et 9.

Difficulté
Facile

Merci d'utiliser Nikto sur vos serveurs web seulement

Nikto est présent dans les dépôts de Debian. Vous pouvez l'installer avec aptitude:

aptitude install nikto

ou apt-get:

apt-get install nikto

Et voilà, le paquet Nikto est installé sur votre Debian.

Le fichier de configuration de nikto se trouve dans le répertoire /etc/nikto , c'est le fichier config.txt. Il n'y a aucune modification a apporter à ce fichier. Sauf, si vous êtes derrière un serveur proxy. Cette configuration est expliquée plus loin.

Pour lancer un scan de vulnérabilité, le paramètre -h suivi de l'adresse IP ou du nom de domaine.

nikto -h http://www.monsite.com

Si nous voulons effectuer le scan de vulnérabilités sur le port 443 (https:), nous ajoutons le paramètre -p. <code bash> nikto -h http://www.monsite.com -p 443 </code> Nous allons corsé un peu les choses et faire une recherche multi-ports. Nous utilisons toujours le paramètre -p, mais nous précisons l'adresse des différents ports avec une virgule : <code bash> nikto -h http://www.monsite.com -p 21,80,443 </code> Et voici comment obtenir un fichier nommé scan.txt et contenant les résultats du scan de vulnérabilité. La paramètre -o sert à préciser le nom du fichier et le paramètre -F permet de préciser que le format de sortie doit être au format txt. <code bash> nikto -h http://www.monsite.com -p 443 -F txt -o scan.txt </code> ===== Utilisation d'un proxy ===== Si vous êtes derrière un serveur proxy, il faut modifier le fichier /etc/nikto/config.txt avec votre éditeur de texte. Il faut décommenter et renseigner les lignes suivantes : <code bash> # Proxy settings – still must be enabled by -useproxy PROXYHOST=proxy.domaine.tld PROXYPORT=8080 PROXYUSER=user-proxy PROXYPASS=pass-proxy </code> * PROXYHOST : l’URL ou l’IP du serveur proxy * PROXYPORT : le port du serveur proxy * PROXYUSER : le nom d'utilisateur du serveur proxy (laissez commenter si l'authentification n'est pas nécessaire) * PROXYPASS : le mot de passe de l’utilisateur (laissez commenter si l'authentification n'est pas nécessaire) Pour préciser à nikto qu'il faut utiliser le serveur proxy, on ajoute le paramètre -useproxy. <code bash> nikto -h http://www.monsite.com -p 443 -useproxy </code> ===== Les options et paramètres en détails ===== -Cgidirs Scan these CGI directories. Special words "none" or "all" may be used to scan all CGI directories or none, (respectively). A literal value for a CGI directory such as "/cgi-test/" may be specified (must include trailing slash). If this is option is not specified, all CGI directories listed in config.txt will be tested. -config Specify an alternative config file to use instead of the config.txt located in the install directory. -dbcheck Check the scan databases for syntax errors. -Display Control the output that Nikto shows. See Chapter 5 for detailed information on these options. Use the reference number or letter to specify the type, multiple may be used: 1 - Show redirects 2 - Show cookies received 3 - Show all 200/OK responses 4 - Show URLs which require authentication D - Debug Output V - Verbose Output -evasion Specify the LibWhisker IDS evasion technique to use (see the LibWhisker docs for detailed information on these). Use the reference number to specify the type, multiple may be used: 1 - Random URI encoding (non-UTF8) 2 - Directory self-reference (/./) 3 - Premature URL ending 4 - Prepend long random string 5 - Fake parameter 6 - TAB as request spacer 7 - Change the case of the URL 8 - Use Windows directory separator (\) -findonly Only discover the HTTP(S) ports, do not perform a security scan. This will attempt to connect with HTTP or HTTPS, and report the Server header. -Format Save the output file specified with -o (-output) option in this format. If not specified, the default will be taken from the file extension specified in the -output option. Valid formats are: csv - a comma-seperated list htm - an HTML report txt - a text report xml - an XML report -host Host(s) to target. Can be an IP address, hostname or text file of hosts. A single dash (-) maybe used for stdout. Can also parse nmap -oG style output -Help Display extended help information. -id ID and password to use for host Basic host authentication. Format is "id:password". -list-plugins Will list all plugins that Nikto can run against targets and then will exit without performing a scan. These can be tuned for a session using the -plugins option. The output format is: Plugin name full name - description Written by author, Copyright (C) copyright -mutate Specify mutation technique. A mutation will cause Nikto to combine tests or attempt to guess values. These techniques may cause a tremendous amount of tests to be launched against the target. Use the reference number to specify the type, multiple may be used: 1 - Test all files with all root directories 2 - Guess for password file names 3 - Enumerate user names via Apache (/~user type requests) 4 - Enumerate user names via cgiwrap (/cgi-bin/cgiwrap/~user type requests) 5 - Attempt to brute force sub-domain names, assume that the host name is the parent domain 6 - Attempt to guess directory names from the supplied dictionary file -mutate-options Provide extra information for mutates, e.g. a dictionary file -nolookup Do not perform name lookups on IP addresses. -nossl Do not use SSL to connect to the server. -no404 Disable 404 (file not found) checking. This will reduce the total number of requests made to the webserver and may be preferable when checking a server over a slow link, or an embedded device. This will generally lead to more false positives being discovered. -output Write output to the file specified. The format used will be taken from the file extension. This can be over-riden by using the -Format option (e.g. to write text files with a different extenstion. Existing files will have new information appended. -plugins Select which plugins will be run on the specified targets. A comma separated list should be provided which lists the names of the plugins. The names can be found by using -list-plugins. There are two special entries: ALL, which specifies all plugins shall be run and NONE, which specifies no plugins shall be run. The default is ALL -port TCP port(s) to target. To test more than one port on the same host, specify the list of ports in the -p (-port) option. Ports can be specified as a range (i.e., 80-90), or as a comma-delimited list, (i.e., 80,88,90). If not specified, port 80 is used. -Pause Seconds to delay between each test. -root Prepend the value specified to the beginning of every request. This is useful to test applications or web servers which have all of their files under a certain directory. -ssl Only test SSL on the ports specified. Using this option will dramatically speed up requests to HTTPS ports, since otherwise the HTTP request will have to timeout first. -Single Perform a single request to a target server. Nikto will prompt for all options which can be specified, and then report the detailed output. See Chapter 5 for detailed information. -timeout Seconds to wait before timing out a request. Default timeout is 10 seconds. -Tuning Tuning options will control the test that Nikto will use against a target. By default, if any options are specified, only those tests will be performed. If the "x" option is used, it will reverse the logic and exclude only those tests. Use the reference number or letter to specify the type, multiple may be used: 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) The given string will be parsed from left to right, any x characters will apply to all characters to the right of the character. -useproxy Use the HTTP proxy defined in the configuration file. ===== Titre 6 ===== ===== Notes de version ===== * [23/11/2017] : Création de l'article ===== Auteurs et sources ===== * Auteur : montuy337513 ===== Navigation ===== * Accueil * La sécurisation d'un serveur dédié Debian * Utilisation générale de Debian * Automatisation des tâches sur un serveur Debian * Disques, répertoires et fichiers * Les log serveurs dédiés Debian * Gestion des utilisateurs et des groupes sur Debian * Apache2 / PHP sur Debian * Serveur de mails avec Postfix sur Debian * Serveur MySQL / mariaDB sur Debian * Divers et les inclassables

  • serveur-debian-securite/nikto-tester-failles-securites-site-web.1532168586.txt.gz
  • Dernière modification : 08/10/2019 16:40
  • (modification externe)