Nikto is an open-source web scanner that helps to identify potential vulnerabilities and security issues in web servers and applications. In this tutorial, we will walk through the steps to install Nikto web scanner on Ubuntu 22.04.
Prerequisites
Before we begin, make sure that you have the following:
- A server running Ubuntu 22.04.
- A non-root user with sudo privileges.
Step 1: Update the System
To begin, log in to your Ubuntu 22.04 server and update the system packages to their latest versions. You can do this by running the following command:
sudo apt-get update && sudo apt-get upgrade
Step 2: Install Perl
Nikto is written in Perl, so we need to install Perl on our system. You can install Perl by running the following command:
sudo apt-get install perl
Step 3: Install Nikto
You can install Nikto on your Ubuntu 22.04 server by running the following commands:
sudo apt-get install nikto
This will install Nikto on your system along with its dependencies.
Check the Nikto installation and also its version, you can run the following command:
nikto
Step 4: Run Nikto
To run Nikto, open a terminal and run the following command:
nikto -h <target URL or IP address>
Replace <target URL or IP address>
with the URL or IP address of the web server that you want to scan. For example, if you want to scan a web server with IP address 192.168.1.100, you would run the following command:
nikto -h 192.168.1.
6
To specify the target by its URL we will use a command:
nikto -h http:// www.your-domain.com
For example
nikto -h http:// unixcop.com
Nikto will start scanning the target web server and report any vulnerabilities or security issues that it finds.
You can also use Nikto with various options to customize the scan. For example, you can use the -ssl
option to scan an SSL-enabled website, or the -plugins
option to load additional plugins for the scan. You can find more information about Nikto options and usage by running the following command:
nikto -H
This will display all options with nikto as shown below in help page output:
qadry@unixcop:~$ 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
htm HTML Format
msf+ Log to Metasploit
nbe Nessus NBE format
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
-IgnoreCode Ignore Codes--treat as negative responses
-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
-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
-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
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
-until Run until the specified time or duration
-update Update databases and plugins from CIRT.net
-useproxy Use the proxy defined in nikto.conf
-Version Print plugin and database versions
-vhost+ Virtual host (for Host header)
+ requires a value
qadry@unixcop:~$
Conclusion
In this tutorial, we learned how to install Nikto web scanner on Ubuntu 22.04 and how to use it to scan web servers for vulnerabilities and security issues. Nikto is a powerful tool that can help to identify potential security risks in web applications, and it is an essential tool for any web server administrator or security professional.