STARTING NIKTO

Web server are a constant in our lifes now, and we need to be able to deal with them. And a useful first step is the ability to do a simple check against the web server in question to check for known 'bad things'. Now Nikto (see here) is a great tool, command line based, scriptable, no funny dependencies and does what it says on the tin. It has some useful options for IDS avoidance and can 'talk' SSL.

But at the simplest, you download the archive, unextract it and just point it at web server port and away you go. Here is an example..
# ./nikto.pl -h http://192.168.2.107:8080
- Nikto v2.1.1
---------------------------------------------------------------------------
+ Target IP:          192.168.2.107
+ Target Hostname:    192.168.2.107
+ Target Port:        8080
+ Start Time:         2010-06-13 22:13:31
---------------------------------------------------------------------------
+ Server: Apache-Coyote/1.1
- Root page / redirects to: http://dojo-vm.local:8080/index.html
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ ETag header found on server, fields: 0xW/261 0x1114607402000
+ Allowed HTTP Methods: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS
+ OSVDB-397: HTTP method ('Allow' Header): 'PUT' method could allow clients to save files on the web server.
+ OSVDB-5646: HTTP method ('Allow' Header): 'DELETE' may allow clients to remove files on the web server.
+ OSVDB-6659: /mjFX8brYX4XqE9G2BdzkDGJGyvcDzMQTShU3z5Cpdi4y8tcyQtA3CVVEfNrQQ9nhMJHe3xfEPehXTbNf2cWkbs
7JuVDsWBEbRlYkevS2iXw3BzH4oLs55NpPJP8bbmCUgcGWDkfaT60KyK1NU5Fo2RMBr6tGlptILvA3Lkh9441aY94UWxyDoXlTN
AaHYGkGUgepwTILhLWFGky2lVOGiOzlMR8zr2Y<font%20size=50>DEFACED<!--//--: MyWebServer 1.0.2 is vulnerable to
HTML injection. Upgrade to a later version.
+ ERROR: /phpinfo.php?cx[]=0wPWh8x1RITF6DMjETySQtsFqXJi0dHkZMlKCklXAfZuiuw9mVwUypCpsXIkOs0GxIgwBsQO8hcPRV0ior0q0Ui5
z8Mg5mAABeonchsulTrOMq2fnOj1U3LVFa6XjWS3yCiJty2K2oqWM0WzMDYnn7BxnH9t8giKw8SrF8TznhOesT3OWgDdBejRCx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Z4wQjzg4kOW3SFgGmEeBgV9x9rRyAOxZbq9TC8jZj5nmgFftEZPPoSVZhW
wAouAIiNZS5uYeHuPc5lvxX2R8z1ABcPC5HEQ482ng3VzvDfPhloo80YlIsHV3xbJywUck1lJue7INrEpehgkPVarhfqGeq16KIEO6Ja7PMOiVZJAbt
voLIgnOgkrrgZdcQ1ruE7NvFzA0ZSiMvjeuVCYpq6dLOd2FQu977tx7is8eVk2GNpPI6sJeXXFV3jd1bK7l0G0ox1NB8vHteOsCqjGrYj3owsLYS31d
DiPiLduTmlfUIhE72bJ9erYYoMKlXbyFF3EbBu3DzoBLCtgDG4GzGJwD0GvdQGkrsn2HtPVhhZfScJzM08Z1p7tQ7xRt6D6kv0jwU5WpV4cVRKs
D0jUaiVS6CgOl6Rj0dY5GG6NaVayenHG0quxbRXz1ZighaJRdJP06FhNDP1upWnc266h273ayfxeNx5pG98WsAR9z0nT3iGsYgs3IvO0Ryx7NK3G
dRfxiqDDXrlfgxbZmRk7KGNoalMmK3Vpxfk9vHmNVe0j634O9OhtrGZ1rd7dj3LjuhC82uFrB2x51d55rhiTtHBFYalYQnmHLR8zZhEMhbGpc4SD3
OcJhiaPKGZctMCZ6LliUyWHoXBVITn<script>alert(foo)</script> returned an error: error reading HTTP response
+ 3818 items checked: 5 item(s) reported on remote host
+ End Time:           2010-06-13 22:14:53 (82 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested


..and lets try it against something else..
# ./nikto.pl -h http://192.168.2.107:3000
- Nikto v2.1.1
---------------------------------------------------------------------------
+ Target IP:          192.168.2.107
+ Target Hostname:    dojo-vm.local
+ Target Port:        3000
+ Start Time:         2010-06-13 22:22:44
---------------------------------------------------------------------------
+ Server: WEBrick/1.3.1 (Ruby/1.8.7/2009-06-12)
+ robots.txt retrieved but it does not contain any 'disallow' entries (which is odd).
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ ETag header found on server, inode: 187690, size: 99, mtime: 0x461bf506
+ Number of sections in the version string differ from those in the database, the server reports: webrick/1.3.1(ruby/1.8.7/2009-06-12)
while the database has: 1.3.1. This may cause false positives.
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS
+ /search.php?searchfor=\"><script>alert('Vulnerable');</script>: Siteframe 2.2.4 is vulnerable to Cross Site Scripting
(XSS). http://www.cert.org/advisories/CA-2000-02.html.
+ /members.asp?SF=%22;}alert('Vulnerable');function%20x(){v%20=%22: Web Wiz Forums ver. 7.01 and below is vulnerable to
Cross Site Scripting (XSS). http://www.cert.org/advisories/CA-2000-02.html.
+ /forum_members.asp?find=%22;}alert('Vulnerable');function%20x(){v%20=%22: Web Wiz Forums ver. 7.01 and below is vulnerable
to Cross Site Scripting (XSS). http://www.cert.org/advisories/CA-2000-02.html.
+ OSVDB-3268: /docs/: Directory indexing is enabled: /docs
+ OSVDB-6659: /lQXd3Xte8ytxtKwsZl5HZEsNVjrcrGg2Tuh8iyrbE3Wr1Hg7WLpzu6Y7BQTexRmBYz5spzE2WKqTiT4tzP3LUPwDwj0yHANw7
e5wYw8Y9sBEVCPt3o0VCrzSUqfwVG2SD3NWHjP0sAeAw84tDUMrbWeGkx40UJFfGPohCSKdznThS0p3gnaA5NBFnoLurmXDA9CssltWwCa
7J0AwHeuF11UNJwNDtdE<font%20size=50>DEFACED<!--//--: MyWebServer 1.0.2 is vulnerable to HTML injection. Upgrade to a later version.
Nested quantifiers in regex; marked by <-- HERE in m/^//pls/portal/owa_util.cellsprint?p_theQuery=select+* <-- HERE +from+sys.dba_users\??/ at /admin/tools/web/nikto-2.1.1/plugins/nikto_core.plugin line 332, <IN> line 451.


Now bear in mind, this is not exactly a stealthy tool, anyone who even vaguely watches the logs will see these scans without too much trouble. But for the purposes of checking whether there is a glaring problem on your site, it does exactly what you want it to.

Final Words
Another great feature about nikto is that it is able to be scripted, and as such you can set it up in cron and let it check at regular intervals. The trick is, as with all such things, to run it yourself before someone else does it for you. It also goes without saying that when it does find something, you should check it out. As always, have fun and learn.