{"id":1213,"date":"2018-11-01T22:08:42","date_gmt":"2018-11-01T19:08:42","guid":{"rendered":"http:\/\/kifarunix.com\/?p=1213"},"modified":"2024-03-11T21:40:17","modified_gmt":"2024-03-11T18:40:17","slug":"how-to-install-and-use-nikto-web-scanner-on-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/how-to-install-and-use-nikto-web-scanner-on-ubuntu-18-04\/","title":{"rendered":"Install and Use Nikto Web Scanner on Ubuntu 18.04"},"content":{"rendered":"\n<p>Hello folks, today we are going to learn how to install and use Nikto web scanner on Ubuntu 18.04 server.<\/p>\n\n\n\n<p>Nikto is a<strong class=\"userinput\"> <code>Perl<\/code><\/strong> based open-source web vulnerability scanner that can unearth every other potential threat on your web server including but not limited to;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Insecure files and programs<\/li>\n\n\n\n<li>Outdated servers and programs<\/li>\n\n\n\n<li>Server and software misconfigurations<\/li>\n\n\n\n<li>Default files and programs<\/li>\n<\/ul>\n\n\n\n<p>Nikto can run on almost any Operating system with Perl interpreter installed. It supports SSL, proxies, host authentication, attack encoding, IDS evation etc.<\/p>\n\n\n\n<p>You may also want to check our previous tutorials on <a href=\"https:\/\/kifarunix.com\/security\/how-to-install-configure-and-use-nessus-vulnerability-scanner-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noopener\">Nessus<\/a>, <a href=\"https:\/\/kifarunix.com\/security\/how-to-install-and-setup-openvas-9-vulnerability-scanner-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noopener\">OpenVAS<\/a>, <a href=\"https:\/\/kifarunix.com\/security\/how-to-install-and-use-clamav-antivirus-on-ubuntu-18-04\/\" target=\"_blank\" rel=\"noopener\">ClamAV<\/a>.<\/p>\n\n\n\n<p>Without much theory, let us quickly have a look at how to install and use Nikto.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing Nikto Web Scanner on Ubuntu 18.04<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Install Nikto on Ubuntu 18.04<\/h3>\n\n\n\n<p>Installation of nikto on Ubuntu 18.04 is pretty straight forward as the package is available on the default repositories. Thus, run the commands below to install nikto.<\/p>\n\n\n\n<p>Update your package repos and upgrade your server;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt update<\/code><\/pre>\n\n\n\n<pre id=\"block-3e05eacc-8feb-48c0-a00e-7bd38f06fba6\" class=\"wp-block-preformatted\">apt upgrade<\/code><\/pre>\n\n\n\n<p>Install nikto.<\/p>\n\n\n\n<p>Perl is already installed on Ubuntu 18.04. Therefore, the command below will install nikto and all the required dependencies.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install nikto -y<\/code><\/pre>\n\n\n\n<p>Once the installation is done, nikto is ready perform its magics. Wait and see.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Usage of Nikto<\/h3>\n\n\n\n<p>The basic nikto command line syntax is:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code><strong class=\"userinput\">nikto [options...]<\/strong><\/code><\/pre>\n\n\n\n<p>When run without any command line options, it shows basic description of various command options;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nnikto \n- Nikto v2.1.5\n---------------------------------------------------------------------------\n+ ERROR: No host specified\n\n       -config+            Use this config file\n       -Display+           Turn on\/off display outputs\n       -dbcheck            check database and other key files for syntax errors\n       -Format+            save file (-o) format\n       -Help               Extended help information\n       -host+              target host\n       -id+                Host authentication to use, format is id:pass or id:pass:realm\n       -list-plugins       List all available plugins\n       -output+            Write output to this file\n       -nossl              Disables using SSL\n       -no404              Disables 404 checks\n       -Plugins+           List of plugins to run (default: ALL)\n       -port+              Port to use (default 80)\n       -root+              Prepend root value to all requests, format is \/directory \n       -ssl                Force ssl mode on port\n       -Tuning+            Scan tuning\n       -timeout+           Timeout for requests (default 10 seconds)\n       -update             Update databases and plugins from CIRT.net\n       -Version            Print plugin and database versions\n       -vhost+             Virtual host (for Host header)\n   \t\t+ requires a value\n\n\tNote: This is the short help output. Use -H for full help text.\n<\/code><\/pre>\n\n\n\n<p>If you want to see more details about the options above, run the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -H<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Launching Nikto Web Scan<\/h3>\n\n\n\n<p>In this section, we are going to see how Nikto is used with various command line options shown above to perform web scanning.<\/p>\n\n\n\n<p>In its basic functionality, Nikto requires just an host an to scan. The target host can be specified with the <strong>-h <\/strong>or <strong>-host <\/strong>option e.g to scan a web server whose IP address is <strong>192.168.43.154<\/strong>, run Nikto as follows;<\/p>\n\n\n\n<pre id=\"block-cae429f2-6593-4f7f-8e0a-8a89513c9ad8\" class=\"wp-block-preformatted\">nikto -host 192.168.43.154<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n- Nikto v2.1.5\n---------------------------------------------------------------------------\n+ Target IP:          192.168.43.154\n+ Target Hostname:    test.com\n+ Target Port:        80\n+ Start Time:         2018-11-01 18:01:35 (GMT3)\n---------------------------------------------------------------------------\n+ Server: Apache\/2.4.29 (Ubuntu)\n+ The anti-clickjacking X-Frame-Options header is not present.\n+ Cookie PHPSESSID created without the httponly flag\n+ Root page \/ redirects to: login.php\n+ Server leaks inodes via ETags, header found with file \/robots.txt, fields: 0x1a 0x5797709ba2009 \n+ File\/dir '\/' in robots.txt returned a non-forbidden or redirect HTTP code (302)\n+ \"robots.txt\" contains 1 entry which should be manually viewed.\n+ OSVDB-3268: \/config\/: Directory indexing found.\n+ \/config\/: Configuration information may be available remotely.\n+ OSVDB-3268: \/docs\/: Directory indexing found.\n+ OSVDB-3233: \/icons\/README: Apache default file found.\n+ \/login.php: Admin login page\/section found.\n+ OSVDB-3092: \/.git\/index: Git Index file may contain directory listing information.\n+ 6545 items checked: 0 error(s) and 11 item(s) reported on remote host\n+ End Time:           2018-11-01 18:01:48 (GMT3) (13 seconds)\n---------------------------------------------------------------------------\n+ 1 host(s) tested\n<\/code><\/pre>\n\n\n\n<p>As you can see from the output, when the target host is specified without a port, nikto scans port <strong>80<\/strong> by default. However, if your web server is running on a different port, you have to specify the port using the <strong>-p<\/strong> or <strong>-port<\/strong> option. See example below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h 192.168.43.154 -p 8080<\/code><\/pre>\n\n\n\n<p>If you have multiple virtualhosts on the same host server listening on different ports, you can specify multiple ports by separating them with comma.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h 192.168.43.154 -p 8080,8888<\/code><\/pre>\n\n\n\n<p>You can also specify a range of ports in the format <strong>port1-portN<\/strong> for example,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h 192.168.43.154 -p 8080-8888<\/code><\/pre>\n\n\n\n<p>Instead of using the IP address to specify the target host, URLs can also be used for example;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h mydvwa.example.com\nnikto -h https:\/\/mydvwa.example.com<\/code><\/pre>\n\n\n\n<p>You can also specify the port when you use URL;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h mydvwa.example.com -p 8080\nnikto -h https:\/\/mydvwa.example.com -p 8443<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h mydvwa.example.com:8080\nnikto -h https:\/\/mydvwa.example.com:8443\/<\/code><\/pre>\n\n\n\n<p>As much as target hosts can be specified using the <strong>-p<\/strong> option, it is also possible to specify a file containing a list of target hosts one per line. For instance, you file should should contains the targets in the format;<\/p>\n\n\n\n<pre id=\"block-afb2d06a-68f6-4a27-aef6-143ed1223ba6\" class=\"wp-block-preformatted\">less scan-targets<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>https:\/\/mydvwa.example.com:443\/\n192.168.43.154:8888\n192.168.43.101<\/code><\/pre>\n\n\n\n<p>To scan these hosts at the same time, run the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h scan-targets<\/code><\/pre>\n\n\n\n<p>It is also possible to scan the hosts in a network listening on web server ports using Nmap and pass the output to nikto. For example to scan for open port 80 in a network, 192.168.43.0\/24,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nmap -p80 192.168.43.0\/24 -oG - | nikto -h -<\/code><\/pre>\n\n\n\n<p>If you are going through a proxy server, you can ask nikto to use proxy by using the <strong>-useproxy<\/strong> option. You can set the proxy details on the nikto configuration file, <strong>\/etc\/nikto\/config.txt <\/strong>or you can it on the command line as shown below;<\/p>\n\n\n\n<p>To define the proxy server details in the \/etc\/nikto\/config.txt file, use the format;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>PROXYHOST=192.168.70.45\nPROXYPORT=3128\nPROXYUSER=username\nPROXYPASS=password<\/code><\/pre>\n\n\n\n<p>When you have defined the proxy details as shown above, then run nikto as follows;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h 192.168.70.128 -useproxy<\/code><\/pre>\n\n\n\n<p>To specify the proxy connection details on the command line;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h 192.168.70.128 -useproxy http:\/\/id:password@192.168.70.23:3128\/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h 192.168.70.128 -useproxy http:\/\/@192.168.70.23:3128\/<\/code><\/pre>\n\n\n\n<p>Nikto can export scan results in different formats; CSV, HTML, XML, NBE, text. To save the results in a specific output format, you need to specify the <strong>-o\/-output<\/strong> option as well as the <strong>-Format<\/strong> option to define the output format. See examples below to save the scan results in html format.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h 192.168.43.154 -o test.html -F html<\/code><\/pre>\n\n\n\n<p>You can therefore access the report via web browser. See screenshot below;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1321\" height=\"791\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/sample_nikto-html-report.png\" alt=\"Install and Use Nikto Web Scanner on Ubuntu 18.04\" class=\"wp-image-9648\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/sample_nikto-html-report.png?v=1626080829 1321w, https:\/\/kifarunix.com\/wp-content\/uploads\/2021\/07\/sample_nikto-html-report-768x460.png?v=1626080829 768w\" sizes=\"(max-width: 1321px) 100vw, 1321px\" \/><\/figure>\n\n\n\n<p>Nikto can also be fine tuned to perform specific scans. Below is a description of the tuning options that can be used to achieve this functionality.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n1 - Interesting File \/ Seen in logs\n2 - Misconfiguration \/ Default File\n3 - Information Disclosure\n4 - Injection (XSS\/Script\/HTML)\n5 - Remote File Retrieval - Inside Web Root\n6 - Denial of Service\n7 - Remote File Retrieval - Server Wide\n8 - Command Execution \/ Remote Shell\n9 - SQL Injection\n0 - File Upload\na - Authentication Bypass\nb - Software Identification\nc - Remote Source Inclusion\nx - Reverse Tuning Options (i.e., include all except specified)\n<\/code><\/pre>\n\n\n\n<p>For example, to test for SQL Injection and Remote File Retrieval &#8211; Server Wide, you would use nikto like;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>nikto -h 192.168.43.154 -Tuning 79 -o test.html -F html<\/code><\/pre>\n\n\n\n<p>Feel free to explore the basic usage of other command line options from <a href=\"https:\/\/cirt.net\/nikto2-docs\/usage.html\" target=\"_blank\" rel=\"noopener\">Nikto Documentation<\/a> page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello folks, today we are going to learn how to install and use Nikto web scanner on Ubuntu 18.04 server. Nikto is a Perl based<\/p>\n","protected":false},"author":1,"featured_media":9649,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[34,121,150],"tags":[3832,223,67,224],"class_list":["post-1213","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-howtos","category-vulnerability-scanners","tag-install-nikto-ubuntu-18-04","tag-nikto","tag-ubuntu-18-04","tag-web-scanners","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1213"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=1213"}],"version-history":[{"count":10,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1213\/revisions"}],"predecessor-version":[{"id":21072,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/1213\/revisions\/21072"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9649"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=1213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=1213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=1213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}