Nikto – Web Application Vulnerability Scanner

Overview

Nikto is an open-source command-line web application vulnerability scanner that scans for 6700 potentially dangerous files/programs. It also looks for misconfigurations, checks for outdated versions of over 1250 servers, and find version-specific problems on over 270 servers. Nikto is a loud tool so it will get logged and flagged by IDS/IPS. Note that not every “problem” found is a security issue. You will need to confirm the vulnerability manually.

Nikto has features such as:

  • Easily updatable CSV-format checks database
  • Output reports in plain text or HTML
  • Available HTTP versions automatic switching
  • Generic as well as specific server software checks
  • SSL support (through libnet-ssleay-perl)
  • Proxy support (with authentication)
  • Cookies support

Nikto Installation

Linux Installation

If you are using Kali Linux, it comes preinstalled. If it is not installed you can use the command

sudo apt install nikto

Windows Installation

The Windows installation is slightly more complicated.

First, you have to install the Perl interpreter. You will have to create an account with Activestate and create a new project. Select the Perl language and the recommended version and create the project.

A command will be generated. Run this command on windows CMD. This completes the installation for the Perl interpreter. 

To check that Perl is installed you can use the command. This shows the version installed for perl

perl -v

Next is to install Nikto. You can download it from the Nikto Github Page. Download the zip file and extract it. Navigate to the nikto.pl script. It should be at ~\nikto-master\program\nikto.pl.
To run Nikto on windows, use the command:

perl nikto.pl [options]

How to use Nikto

The following guide will execute Nikto from Kali Linux.

the command format to run Nikto is:

nikto -h <URL> [options]

The command used in the example is

nikto -h https://tastyfix.com/ -ssl -Tuning x -o /home/kali/Desktop/nikto/Tastyscan.txt -Format txt

To elaborate on the arguments:

-h <URL or IP addr> (to specify the target web application)

-ssl (scan using the SSL port, which is port 443)

-o <filename> (output results to a file)

-Format <format> (file type to save the file)

Type of formats available:

  • csv
  • json
  • htm
  • nbe
  • sql
  • txt
  • xml

An alternative to the -ssl argument is to use the -p command

-p <port number> (to specify the ports to scan)

-Tuning <options> (specify attacks to be used, by default this is disabled. Details found in the Nikto help menu)

Thus, the command used is to scan tastyfix.com from port 433 with all possible attacks. We also save the file to Tastyscan.txt as a text file. From the results, we get the Target IP, Target Port scanned, and the vulnerabilities found on the web application. Do note that the scan may take a long time. For the scan on tastyfix.com, it took 2h13mins to complete.

Sometimes Nikto may not recognize your target as a web server. For example, if we target reconbee.com, Nikto will not recognise any web servers on it. This result is the same despite using other ports like 80, 8080 and 8443.

To solve this issue, you can use the -evasion argument. This may allow Nikto to recognise the web application as a web server. Not all options of the -evasion argument will work so you may have to test each evasion option.

Nikto Help Menu

──(kali㉿kali)-[~]
└─$ nikto -H

   Options:
       -ask+               Whether to ask about submitting updates
                               yes   Ask about each (default)
                               no    Don't ask, don't send
                               auto  Don't ask, just send
       -Cgidirs+           Scan these CGI dirs: "none", "all", or values like "/cgi/ /cgi-a/"
       -config+            Use this config file
       -Display+           Turn on/off display outputs:
                               1     Show redirects
                               2     Show cookies received
                               3     Show all 200/OK responses
                               4     Show URLs which require authentication
                               D     Debug output
                               E     Display all HTTP errors
                               P     Print progress to STDOUT
                               S     Scrub output of IPs and hostnames
                               V     Verbose output
       -dbcheck           Check database and other key files for syntax errors
       -evasion+          Encoding technique:
                               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 (\)
                               A     Use a carriage return (0x0d) as a request spacer
                               B     Use binary value 0x0b as a request spacer
        -Format+           Save file (-o) format:
                               csv   Comma-separated-value
                               json  JSON Format
                               htm   HTML Format
                               nbe   Nessus NBE format
                               sql   Generic SQL (see docs for schema)
                               txt   Plain text
                               xml   XML Format
                               (if not specified the format will be taken from the file extension passed to -output)
       -Help              Extended help information
       -host+             Target host/URL
       -404code           Ignore these HTTP codes as negative responses (always). Format is "302,301".
       -404string         Ignore this string in response body content as negative response (always). Can be a regular expression.
       -id+               Host authentication to use, format is id:pass or id:pass:realm
       -key+              Client certificate key file
       -list-plugins      List all available plugins, perform no testing
       -maxtime+          Maximum testing time per host (e.g., 1h, 60m, 3600s)
       -mutate+           Guess additional file names:
                               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 information for mutates
       -nointeractive     Disables interactive features
       -nolookup          Disables DNS lookups
       -nossl             Disables the use of SSL
       -no404             Disables nikto attempting to guess a 404 page
       -Option            Over-ride an option in nikto.conf, can be issued multiple times
       -output+           Write output to this file ('.' for auto-name)
       -Pause+            Pause between tests (seconds, integer or float)
       -Plugins+          List of plugins to run (default: ALL)
       -port+             Port to use (default 80)
       -RSAcert+          Client certificate file
       -root+             Prepend root value to all requests, format is /directory
       -Save              Save positive responses to this directory ('.' for auto-name)
       -ssl               Force ssl mode on port
       -Tuning+           Scan tuning:
                               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
                               0     File Upload
                               a     Authentication Bypass
                               b     Software Identification
                               c     Remote Source Inclusion
                               d     WebService
                               e     Administrative Console
                               x     Reverse Tuning Options (i.e., include all except specified)
       -timeout+          Timeout for requests (default 10 seconds)
       -Userdbs           Load only user databases, not the standard databases
                               all   Disable standard dbs and load only user dbs
                               tests Disable only db_tests and load udb_tests
       -useragent         Over-rides the default useragent
       -until             Run until the specified time or duration
       -update            Update databases and plugins from CIRT.net
       -url+              Target host/URL (alias of -host)
       -useproxy          Use the proxy defined in nikto.conf, or argument http://server:port
       -Version           Print plugin and database versions
       -vhost+            Virtual host (for Host header)
                + requires a value

Conclusion

Nikto is a great open-source command line web application vulnerability scanner. Although the scans may take a long time to run, it scans for quite a number of vulnerabilities and misconfiguration. When compared to the OWASP ZAP, another great vulnerability scanner, Nikto will still catch some vulnerabilities that ZAP does not. Thus, I recommend using both tools for a thorough scan of your target web application.

Nikto Resources

Home page for Nikto: https://cirt.net/Nikto2

Source Repository for Nikto: https://github.com/sullo/nikto

Kali Linux Page for Nikto: https://www.kali.org/tools/nikto/

Related Articles

5 Popular Open Source Tools for Reconnaissance

How to use OWASP ZAP – Open Source Vulnerability Scanner 

Whois – Server Reconnaissance

DNSenum – DNS Information Gathering

Ffuf – URL Directory Finder/Fuzzer

Leave a Reply

Your email address will not be published. Required fields are marked *