> For the complete documentation index, see [llms.txt](https://cajac.gitbook.io/ctf-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cajac.gitbook.io/ctf-notes/web/vulnerability-scanning/nikto.md).

# Nikto

**Nikto** is a pluggable web server and CGI scanner written in Perl, using rfp’s LibWhisker to perform fast security or informational checks.

Features:

* 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

## Scan examples

### Scan a single port

```bash
nikto -url http://10.10.236.92:1234
```

or

```bash
nikto -url http://10.10.236.92 -p 1234
```

### Scan multiple ports

```bash
nikto -url http://$TARGET_IP -p 80,8000,8080
```

### Scan with authentication (-id)

```bash
nikto -url http://10.10.236.92:1234/manager/html -id bob:bubbles
```

## Scan tuning

Test types can be controlled at an individual level by specifying their identifier to the `-T` (`-Tuning`) option. In the default mode, if `-T` is invoked only the test type(s) specified will be executed. For example, only the tests for "Remote file retrieval" and "Command execution" can performed against the target:

```bash
nikto -h 192.168.0.1 -T 58
```

If an "x" is passed to `-T` then this will negate all tests of types following the x. This is useful where a test may check several different types of exploit. For example:

```bash
nikto -h 192.168.0.1 -T 58xb
```

The valid tuning options are:

* 0 - **File Upload**. Exploits which allow a file to be uploaded to the target server.
* 1 - **Interesting File / Seen in logs**. An unknown but suspicious file or attack that has been seen in web server logs (note: if you have information regarding any of these attacks, please contact CIRT, Inc.).
* 2 - **Misconfiguration / Default File**. Default files or files which have been misconfigured in some manner. This could be documentation, or a resource which should be password protected.
* 3 - **Information Disclosure**. A resource which reveals information about the target. This could be a file system path or account name.
* 4 - **Injection (XSS/Script/HTML)**. Any manner of injection, including cross site scripting (XSS) or content (HTML). This does not include command injection.
* 5 - **Remote File Retrieval** - Inside Web Root. Resource allows remote users to retrieve unauthorized files from within the web server's root directory.
* 6 - **Denial of Service**. Resource allows a denial of service against the target application, web server or host (note: no intentional DoS attacks are attempted).
* 7 - **Remote File Retrieval** - Server Wide. Resource allows remote users to retrieve unauthorized files from anywhere on the target.
* 8 - **Command Execution / Remote Shell**. Resource allows the user to execute a system command or spawn a remote shell.
* 9 - **SQL Injection**. Any type of attack which allows SQL to be executed against a database.
* a - **Authentication Bypass**. Allows client to access a resource it should not be allowed to access.
* b - **Software Identification**. Installed software or program could be positively identified.
* c - **Remote source inclusion**. Software allows remote inclusion of source code.
* d - **WebService**. Web service endpoints or related functionality.
* e - **Administrative Console**. Administrative interfaces or consoles.
* f - **XML Injection**. XML-related injection vulnerabilities.
* x - **Reverse Tuning Options**. Perform exclusion of the specified tuning type instead of inclusion of the specified tuning type.

## Usage information

<details>

<summary>nikto -Help</summary>

```
┌──(kali㉿kali)-[/mnt/…/TryHackMe/CTFs/Easy/ToolsRus]
└─$ nikto -Help

   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
       -check6             Check if IPv6 is working (connects to ipv6.google.com or value set in nikto.conf)
       -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
        -followredirects   Follow 3xx redirects to new location
        -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              This help information
       -host+             Target host/URL
       -id+               Host authentication to use, format is id:pass or id:pass:realm
       -ipv4                 IPv4 Only
       -ipv6                 IPv6 Only
       -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
       -noslash           Strip trailing slash from URL (e.g., '/admin/' to '/admin')
       -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)
       -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
       -url+              Target host/URL (alias of -host)
       -usecookies        Use cookies from responses in future requests
       -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)
       -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.
                + requires a value


```

</details>

## Resources

Nikto - Documentation: <https://github.com/sullo/nikto/wiki>

Nikto - Github: <https://github.com/sullo/nikto>

Nikto - Homepage: <https://cirt.net/Nikto2>

Nikto - Kali Tools: <https://www.kali.org/tools/nikto/>
