Cyber Services / All lessons / CEH — Ethical Hacking / Nikto Web Scanning From Zero to Hero

Nikto Web Scanning From Zero to Hero

Module 16 of 130 · 7 min read · Free to read

MODULES ↓ Command blocks have a COPY button
Comprehensive Web Security Assessment Tool
Vulnerability Detection Web Server Scanning Security Testing Practical Activities

What is Nikto?

Nikto is an open-source web server scanner that performs comprehensive tests against web servers for multiple security items. It's designed to find various default files, programs, and configurations that may pose security risks.

Nikto's Core Capabilities

Nikto scans web servers for over 6700 potentially dangerous files and programs, checks for outdated server software versions, identifies configuration issues, and tests for various web server vulnerabilities.

Dangerous File Detection

Identifies potentially dangerous files, programs, and default installations

Server Version Detection

Detects outdated server software and specific version information

Configuration Testing

Tests for common configuration issues and security misconfigurations

Directory Enumeration

Discovers hidden directories and default installation paths

Ethical Usage Notice

Nikto can be noisy and may trigger intrusion detection systems. Always obtain explicit permission before scanning any target. Avoid scanning production systems during peak hours to minimize disruption.

Installation Methods

Option 1: Git Repository (Recommended)

This method ensures you have the latest version with all recent updates and vulnerability checks.

# Clone the latest Nikto repository
git clone https://github.com/sullo/nikto.git
cd nikto/program

The main executable script is nikto.pl located in the program directory.

Option 2: Docker Installation

For containerized environments or when you prefer Docker-based tools.

# Build and run Nikto in Docker
git clone https://github.com/sullo/nikto.git
cd nikto
docker build -t sullo/nikto .

Option 3: Package Managers

Some Linux distributions include Nikto in their package repositories.

# Kali Linux and Debian-based systems
sudo apt update && sudo apt install nikto
# Arch Linux
sudo pacman -S nikto

Basic Usage & First Scan

Your First Nikto Scan

Run a simple scan against a target. Replace http://target.example.com with your authorized target URL.

# Basic scan using Git installation
./nikto.pl -h http://target.example.com
# Using Perl explicitly
perl nikto.pl -h http://target.example.com
# Docker-based scan
docker run --rm sullo/nikto -h http://target.example.com

Understanding Nikto Output

Nikto provides detailed output that helps identify potential security issues:

+ Target IP: 192.168.1.100
+ Target Hostname: target.example.com
+ Server: Apache/2.4.41 (Ubuntu)
+ Retrieved x-powered-by header: PHP/7.4.3
+ Root page / redirects to: /login.php
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS
+ /config.php: PHP config file found
+ /backup.zip: Backup file found
+ /phpinfo.php: Output from the phpinfo() function was found

Key Output Elements:

Element Description Security Implication
Server Headers Web server software and version Identify outdated versions with known vulnerabilities
Interesting Files Config files, backups, info pages Potential information disclosure
CGI Directories Executable script directories Potential command execution vulnerabilities
HTTP Methods Allowed HTTP verbs Identify dangerous methods (PUT, DELETE, etc.)
OSVDB References Vulnerability database IDs Reference for known vulnerabilities

Advanced Options & Configuration

Essential Scanning Options

Nikto offers numerous options to customize scanning behavior for different scenarios.

-Tuning (-T)
Focus scan on specific vulnerability types. Use numeric codes to include or exclude test categories.
# Scan only for information disclosure and injection vulnerabilities
./nikto.pl -h http://target.example.com -Tuning 34
# Exclude denial of service and command execution tests
./nikto.pl -h http://target.example.com -Tuning x68
-Evasion (-e)
Use IDS evasion techniques to avoid detection by security systems.
# Use URI encoding and random string evasion
./nikto.pl -h http://target.example.com -evasion 14
-Mutate
Enable mutation techniques to find more files and directories through guessing.
# Use file/directory and dictionary-based mutation
./nikto.pl -h http://target.example.com -mutate 16

Authentication & Session Options

-id
Provide HTTP authentication credentials for protected areas.
# Basic authentication
./nikto.pl -h http://target.example.com -id username:password
-usecookies
Use cookies found in responses for subsequent requests to maintain session state.
# Enable cookie support for session maintenance
./nikto.pl -h http://target.example.com -usecookies

Output & Reporting Options

-Format
Specify output format for reports and integration with other tools.
# XML output for tool integration
./nikto.pl -h http://target.example.com -Format xml -o scan_report.xml
# CSV format for spreadsheet analysis
./nikto.pl -h http://target.example.com -Format csv -o scan_results.csv
-Save
Save positive responses to a directory for later analysis.
# Save all interesting responses
./nikto.pl -h http://target.example.com -Save ./saved_responses

Advanced Scanning Techniques

Targeted Scanning Strategies

Combine multiple options for powerful, targeted security assessments.

# Comprehensive scan with output and rate limiting
./nikto.pl -h http://target.example.com -Tuning 1234567890abc -Format xml -o full_scan.xml -Pause 2

Performs a thorough scan with all tuning options, outputs to XML, and pauses 2 seconds between requests to avoid detection.

# Specific CGI directory scan with authentication
./nikto.pl -h http://target.example.com -Cgidirs /cgi-bin/ -id user:password -Display E

Focuses on CGI directories, uses authentication, and shows only HTTP errors for cleaner output.

# Virtual host scanning with SSL
./nikto.pl -h 192.168.1.100 -vhost app.example.com -port 443 -ssl

Scans a specific virtual host on HTTPS port with proper host header.

Maintenance & Updates

Keep Nikto updated and maintain database integrity for optimal performance.

# Update Nikto databases and plugins
./nikto.pl -update

Downloads the latest vulnerability databases and plugin updates from CIRT.net.

# Verify database integrity
./nikto.pl -dbcheck

Validates the syntax and integrity of Nikto's databases.

# List available plugins
./nikto.pl -list-plugins

Displays all available plugins that Nikto can use for specialized tests.

Pro Tip: Regular Updates

Always update Nikto before starting a new assessment. The web security landscape changes rapidly, and new vulnerabilities are discovered constantly. Regular updates ensure you're testing for the latest security issues.

Practical Activities & Scenarios

Activity 1: Basic Web Server Assessment
Objective: Perform a comprehensive security assessment of a web server
  1. Identify the target web server and obtain proper authorization
  2. Run a basic Nikto scan to gather initial information
  3. Analyze the output for server version and configuration details
  4. Identify potentially dangerous files and directories
  5. Document all findings with severity ratings
  6. Generate a comprehensive report in XML format
# Complete assessment command
./nikto.pl -h http://target.example.com -Tuning 1234567890abc -Format xml -o assessment_report.xml -Pause 1
Activity 2: Stealthy Security Assessment
Objective: Perform a security scan while minimizing detection
  1. Use evasion techniques to avoid IDS/IPS detection
  2. Implement rate limiting to reduce scan noise
  3. Focus on high-value targets using tuning options
  4. Use mutation to discover hidden resources
  5. Save all positive responses for offline analysis
# Stealth assessment command
./nikto.pl -h http://target.example.com -evasion 1234 -Tuning 2349 -mutate 1 -Pause 3 -Save ./stealth_responses
Activity 3: Authentication Testing
Objective: Test web applications with authentication mechanisms
  1. Identify authentication-protected areas
  2. Use valid credentials to scan protected sections
  3. Test for session management issues
  4. Check for authentication bypass vulnerabilities
  5. Document access control issues
# Authenticated scanning command
./nikto.pl -h http://target.example.com -id user:password -usecookies -Tuning 489a

Troubleshooting & Common Issues

Common Problems and Solutions

Connection and Network Issues

Issue Cause Solution
"Target not supplied" Missing -h parameter or target URL Ensure you include -h http://target in your command
"Connection refused" Server is down or wrong port/URL Verify server connectivity and check port specification
SSL/TLS errors Certificate issues or wrong port Use -ssl for HTTPS ports or -nossl to force HTTP

Performance and Output Issues

Issue Cause Solution
Slow scans Network latency or server response time Use -Tuning to focus scans, increase -timeout
False positives Generic checks matching non-issues Use -IgnoreCode for known false positives
No output file Wrong path or permissions Check directory permissions and use absolute paths
Important Security Considerations

Nikto is a powerful scanning tool that can generate significant network traffic and trigger security alerts. Always:

  • Obtain explicit written permission before scanning
  • Schedule scans during off-peak hours for production systems
  • Use rate limiting (-Pause) to minimize impact
  • Inform relevant stakeholders about scanning activities
  • Have a rollback plan for critical systems

Conclusion

Nikto remains one of the most comprehensive and reliable web server scanners available. Its extensive database of vulnerability checks, flexible configuration options, and powerful reporting capabilities make it an essential tool for any web security assessment.

Key Takeaways
  • Nikto provides comprehensive web server security testing with minimal configuration
  • Advanced options allow for targeted, stealthy, and authenticated scanning
  • Regular updates ensure coverage of the latest vulnerabilities
  • Multiple output formats enable integration with other security tools
  • Proper tuning and mutation can significantly improve scan results
  • Always operate within authorized scopes and follow ethical guidelines
Final Ethical Reminder

Web security scanning tools like Nikto are powerful instruments that must be used responsibly. Always ensure you have explicit, written permission before scanning any systems. Unauthorized scanning is not only unethical but also illegal in many jurisdictions. Use these skills to improve security posture, not to compromise systems.

Modules (130) ← CEH — Ethical Hacking