DebianDebian Based

How To Install Nikto on Debian 12

Install Nikto on Debian 12

Nikto is a powerful open-source web server scanner designed to identify potential vulnerabilities, security issues, and misconfigurations in web servers. For system administrators and security professionals using Debian 12, Nikto offers an essential toolset for enhancing web application security through comprehensive scanning capabilities. This guide provides detailed instructions for installing, configuring, and using Nikto on Debian 12, covering everything you need to know to start conducting effective security assessments.

What is Nikto?

Nikto is a pluggable web server and CGI scanner written in Perl that uses LibWhisker to perform fast security and informational checks on web servers. As a robust vulnerability assessment tool, Nikto can detect over 6,400 potentially dangerous files and scripts, check for outdated server software, and identify nearly 300 version-specific problems on web applications.

Nikto stands out from other scanning tools due to its:

  • Extensive database of vulnerability checks
  • Ability to identify installed software through headers, favicons, and files
  • Enhanced false positive reduction through multiple verification methods
  • Support for scanning multiple ports and servers simultaneously
  • Comprehensive reporting capabilities in various formats

The scanner operates by sending requests to the target web server and analyzing responses to identify potential security issues, outdated components, and misconfigured settings that might expose your system to attacks.

Prerequisites for Installing Nikto on Debian 12

Before proceeding with the installation, ensure your system meets the following requirements:

  • A running Debian 12 system with internet access
  • Administrative (sudo) privileges on your system
  • Updated package repositories
  • Basic command-line knowledge

To prepare your system, run the following commands to update your package lists:

sudo apt update
sudo apt upgrade -y

These commands ensure your system packages are current before installing new software, which helps prevent potential dependency issues during installation.

Method 1: Installing Nikto Using apt-get

The simplest and most straightforward way to install Nikto on Debian 12 is through the official repositories using apt-get. This method ensures you get a stable version that works well with your system.

First, update your package lists if you haven’t already:

sudo apt-get update

Then install Nikto using the following command:

sudo apt-get -y install nikto

The -y flag automatically confirms the installation without requiring manual confirmation. Once the installation completes, you can verify it was successful by checking the version:

nikto -Version

This command should display the installed version of Nikto along with the database version information, confirming that the installation was successful.

If you encounter any errors during installation, ensure your system is up-to-date and that you have administrative privileges. Common issues include permission problems or network connectivity issues when downloading packages.

Method 2: Installing Nikto Using apt

The apt package manager is a more modern alternative to apt-get with a similar syntax but improved usability features. To install Nikto using apt:

Update your package lists:

sudo apt update

Install Nikto:

sudo apt -y install nikto

This method offers the same end result as using apt-get but with a slightly more user-friendly interface. The apt command provides cleaner output and progress indicators, making it easier to track the installation process.

Verify the installation by running:

nikto -h

This command displays the help information for Nikto, confirming that the program is properly installed and accessible from the command line.

Method 3: Installing Nikto Using aptitude

Aptitude is an alternative package manager with more advanced dependency resolution capabilities. If you prefer using aptitude, you may need to install it first since it’s not included by default in many Debian installations.

First, install aptitude if it’s not already available:

sudo apt install aptitude

Then update the package databases:

sudo aptitude update

Finally, install Nikto:

sudo aptitude -y install nikto

Aptitude can sometimes resolve complex dependency issues more effectively than apt or apt-get, making it useful for systems with unusual configurations. Like the other methods, you can verify the installation by running a basic Nikto command:

nikto --help

Method 4: Installing Nikto from GitHub Source

Installing Nikto directly from its GitHub repository provides access to the latest features and updates before they’re available in the Debian repositories. This method is recommended for users who need the most recent version or specific features not yet packaged for Debian.

First, install the required dependencies:

sudo apt install git perl libnet-ssleay-perl libwhisker2-perl

Then clone the Nikto repository:

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

Navigate to the program directory:

cd nikto/program

You can run Nikto directly from this directory:

perl nikto.pl -h

For easier access, create a symbolic link to make Nikto available system-wide:

sudo ln -s $(pwd)/nikto.pl /usr/local/bin/nikto

Set appropriate permissions:

sudo chmod +x nikto.pl

The advantage of this installation method is that you can easily update Nikto to the latest version by pulling changes from the GitHub repository:

cd ~/nikto
git pull

Note that when installed from GitHub, the -update option is deprecated, and you should use git pull instead to update your installation.

Configuring Nikto on Debian 12

After installation, you may want to configure Nikto to suit your specific needs. The main configuration file, nikto.conf, controls various aspects of Nikto’s behavior.

For installations from the Debian repositories, the configuration file is typically located at /etc/nikto.conf. For GitHub installations, it’s in the program directory where you cloned the repository.

Important configuration parameters include:

  • CGIDIRS: Directories to search for CGI scripts
  • PORTS: Ports to check when not specified
  • HTTPVER: HTTP version to use
  • USERAGENT: User agent string for requests
  • DBDIR: Location of Nikto databases

To ensure proper configuration, edit the nikto.conf file with your preferred text editor:

sudo nano /etc/nikto.conf

If you installed from GitHub and want to use a system-wide configuration file, create a symbolic link:

sudo cp ~/nikto/program/nikto.conf /etc/nikto.conf
sudo chmod 644 /etc/nikto.conf

This gives you the flexibility to customize Nikto’s behavior while maintaining easy access to the configuration file.

Basic Usage of Nikto

Once installed and configured, you can start using Nikto to scan web servers for vulnerabilities. The basic syntax for running a scan is:

nikto -h [target host]

Replace [target host] with the IP address or hostname of the server you want to scan.

For example, to scan a web server at 192.168.1.100:

nikto -h 192.168.1.100

To scan a specific website:

nikto -h example.com

By default, Nikto scans port 80 (HTTP). To scan a different port:

nikto -h example.com -p 8080

The output will show information about the scan progress and any vulnerabilities or issues discovered. Nikto categorizes findings using the Open Source Vulnerability Database (OSVDB) references, which provide detailed information about each discovered vulnerability.

To save the scan results to a file, use the -o option:

nikto -h example.com -o scan_results.txt

You can also specify different output formats:

nikto -h example.com -o scan_results.html -Format html

Available formats include txt (plain text), csv, xml, and html.

Advanced Nikto Features

Nikto offers numerous advanced features for more targeted and comprehensive scanning. Here are some useful options:

Scanning Specific Ports

To scan multiple ports on a target:

nikto -h example.com -p 80,443,8080

This command scans ports 80, 443, and 8080 on the target host.

Using SSL for Secure Connections

When scanning websites that use HTTPS:

nikto -h example.com -ssl

This option tells Nikto to use SSL/TLS for the connection.

Authentication Options

For sites requiring authentication:

nikto -h example.com -id username:password

Nikto supports both Basic and NTLM authentication methods.

Tuning Scans for Specific Checks

You can tune your scans to focus on specific types of tests:

nikto -h example.com -Tuning 1,2,3

The tuning options correspond to different test categories:

  • 1: Information disclosure
  • 2: Misconfiguration
  • 3: Information leakage
  • 4: Injection
  • And more

Controlling Scan Intensity

To adjust the aggressiveness of your scan:

nikto -h example.com -evasion 1

Evasion techniques help bypass intrusion detection systems (IDS) and include options like URL encoding, random URL case, and more.

Using a Proxy

To route your scan through a proxy:

nikto -h example.com -useproxy http://proxyserver:port

This is useful for anonymizing your scans or testing through corporate networks.

Updating Nikto

Keeping Nikto updated ensures you have access to the latest vulnerability checks and features. The update process depends on your installation method.

For Repository Installations

If you installed Nikto from the Debian repositories, update it along with your other packages:

sudo apt update
sudo apt upgrade

For GitHub Installations

For installations from GitHub, update by pulling the latest changes:

cd ~/nikto
git pull

Note that the -update option is deprecated in git versions of Nikto, as mentioned in the error message when trying to use this command. Always use git pull to update instead.

It’s recommended to check for updates regularly, especially before conducting important security assessments, to ensure you have the most current vulnerability database.

Troubleshooting Common Issues

Permission Problems

If you encounter permission issues, ensure you’re running Nikto with sufficient privileges:

sudo nikto -h example.com

Or fix permissions on the Nikto files:

sudo chmod -R 755 /usr/share/nikto

SSL Certificate Errors

When scanning HTTPS sites, you might encounter SSL certificate errors. Use the -nocerta option to skip certificate verification:

nikto -h example.com -ssl -nocerta

Network Access Issues

If Nikto can’t connect to the target host, verify your network connection and ensure there are no firewalls blocking the connection:

ping example.com
telnet example.com 80

Database Problems

If you see errors related to the database, try reinstalling Nikto or manually updating the database files:

sudo apt reinstall nikto

Resource Limitations

For large scans that time out or consume too many resources, try limiting the scope:

nikto -h example.com -maxtime 1h

This setting limits the scan duration to one hour.

Uninstalling Nikto

If you need to remove Nikto from your Debian 12 system, the process depends on how you installed it.

For apt or apt-get Installations

To remove just the Nikto package:

sudo apt-get remove nikto

To remove Nikto along with its dependencies that are no longer needed:

sudo apt-get -y autoremove nikto

To remove Nikto configuration and data files:

sudo apt-get -y purge nikto

For a complete removal, including configuration files and dependencies:

sudo apt-get -y autoremove --purge nikto

For GitHub Installations

If you installed from GitHub, remove the cloned repository and any symbolic links:

sudo rm /usr/local/bin/nikto
rm -rf ~/nikto

If you created a configuration file in /etc:

sudo rm /etc/nikto.conf

These commands ensure a clean removal of Nikto from your system.

Congratulations! You have successfully installed Nikto. Thanks for using this tutorial for installing the Nikto open-source web scanner on your Debian 12 “Bookworm” system. For additional help or useful information, we recommend you check the official Nikto website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button