How to Perform Website Penetration Testing Using Nikto

Imagine this: your website is live, customers are visiting, and everything seems perfect. But behind the scenes, a silent vulnerability sits unnoticed, waiting to be exploited. One day, a hacker finds it, and your data, reputation, and trust are gone in minutes. This isn’t a horror story. It’s a reality for thousands of websites every year. The good news? You can prevent it. Penetration testing, often called pen testing, is the practice of simulating real-world attacks to find and fix security weaknesses before attackers do. And when it comes to testing web servers quickly and effectively, few tools are as trusted, accessible, and powerful as Nikto. In this comprehensive guide, we’ll walk you step by step through performing website penetration testing using Nikto. No prior hacking experience needed. Whether you’re a website owner, developer, or aspiring security professional, you’ll learn how to scan your site, interpret results, and take action. Let’s secure your digital world, one scan at a time.

Nov 6, 2025 - 10:44
Nov 6, 2025 - 15:05
 17
How to Perform Website Penetration Testing Using Nikto

Table of Contents

What Is Penetration Testing?

Penetration testing is a controlled, authorized attempt to breach a system’s security. Think of it as hiring a professional locksmith to test your home’s locks by trying to pick them, not to steal, but to show you where you’re weak.

For websites, pen testing focuses on:

  • Web server configuration
  • Outdated software
  • Misplaced sensitive files
  • Weak encryption
  • Exposed administrative panels

Nikto specializes in the first layer: the web server itself (Apache, Nginx, IIS, etc.). It doesn’t log in as a user or test your application logic. It checks the foundation.

Introduction to Nikto

Nikto is an open-source web server scanner written in Perl. First released in 2001, it has become a staple in security toolkits worldwide. It works by sending thousands of HTTP requests to a target server and analyzing responses for signs of weakness.

Key features:

  • Over 6,700 vulnerability checks
  • Detects outdated server versions
  • Finds dangerous files and scripts
  • Supports SSL, authentication, and proxies
  • Outputs reports in HTML, XML, or plain text

Warning: Never scan a website you don’t own or don’t have explicit written permission to test. Unauthorized scanning is illegal in most countries and can lead to criminal charges.

Always:

  • Get written permission (email or contract)
  • Test only on systems you control (your own sites, lab environments)
  • Avoid scanning during peak business hours
  • Inform IT teams before testing

Setting Up Your Testing Environment

Before scanning, prepare a safe environment:

  • Use a virtual machine: Install Kali Linux or Ubuntu in VirtualBox/VMware.
  • Isolate your network: Avoid scanning from your personal computer.
  • Use a test server: Set up a local web server (e.g., Apache on localhost) to practice.
  • Backup everything: Never test on live production without backups.

Installing Nikto

Nikto is easy to install. Here are the most common methods:

  • Kali Linux (pre-installed): Just open terminal and type nikto
  • Ubuntu/Debian:
    sudo apt update
    sudo apt install nikto
  • Fedora:
    sudo dnf install nikto
  • Windows (via WSL):
    wsl --install -d Ubuntu
    # Then follow Ubuntu steps
  • From GitHub (latest version):
    git clone https://github.com/sullo/nikto.git
    cd nikto/program
    perl nikto.pl -h http://example.com

After installation, update the database:

nikto -update

Running Your First Nikto Scan

Let’s scan a test server. Replace http://yoursite.com with your target (only if you own it).

nikto -h http://yoursite.com

Sample output:

+ Server: Apache/2.4.41
+ The anti-clickjacking X-Frame-Options header is not present.
+ OSVDB-630: The /icons/README file is exposed.
+ Over 30 requests made. Scan took 45 seconds.

Congratulations! You just performed your first penetration test.

Understanding Nikto Output

Nikto reports include:

  • Server banner: Reveals software and version (often a risk).
  • OSVDB/CVE IDs: Links to known vulnerabilities.
  • Risk level: High, medium, low (not always shown, but implied).
  • File/directory findings: Exposed config files, backups, etc.

Example finding:

+ /admin/: Admin login page found. Check for weak passwords.

This doesn’t mean it’s hacked. It means a login page exists and should be secured.

Advanced Scanning Techniques

Go beyond basics with these commands:

  • Scan SSL sites:
    nikto -h https://yoursite.com
  • Save HTML report:
    nikto -h http://yoursite.com -o report.html -Format html
  • Scan specific port:
    nikto -h 192.168.1.100 -p 8080
  • Use basic auth:
    nikto -h http://yoursite.com -id admin:password123
  • Avoid detection (evasion):
    nikto -h http://yoursite.com -evasion 1
  • Scan multiple hosts:
    nikto -h hosts.txt

Nikto Command Reference Table

Command Purpose Example
-h Target host or file nikto -h http://site.com
-p Port number nikto -p 8080
-ssl Force HTTPS nikto -ssl -h site.com
-id Basic authentication nikto -id user:pass
-o Output file nikto -o scan.html
-Format Output format nikto -Format html
-Tuning Run specific tests nikto -Tuning 1 9
-evasion Bypass IDS/IPS nikto -evasion 3
-update Update database nikto -update
-list-plugins Show plugins nikto -list-plugins

Interpreting Common Findings

Here are real Nikto outputs and what they mean:

  • Server: Apache/2.2.3 → Old version. Upgrade immediately.
  • /phpinfo.php: Found → Delete this file. It leaks server details.
  • Directory indexing found → Disable in server config.
  • OSVDB-877: CGI found → Remove or secure old scripts.
  • Allowed HTTP methods: PUT → Disable if not needed.

How to Fix the Vulnerabilities Nikto Finds

Action plan:

  • Update software: Always run latest stable versions.
  • Remove test files: Delete phpinfo.php, test.php, etc.
  • Hide server banners: Use ServerTokens Prod in Apache.
  • Disable directory listing: Set Options -Indexes.
  • Secure headers: Add X-Frame-Options, CSP, HSTS.
  • Restrict HTTP methods: Allow only GET, POST, HEAD.

Best Practices for Nikto Penetration Testing

  • Scan regularly (weekly or after changes)
  • Review every finding manually
  • Combine with other tools (Nmap, OWASP ZAP)
  • Document all tests and fixes
  • Retest after applying patches
  • Train your team on security basics

Limitations of Nikto

Nikto is excellent, but not perfect:

  • Doesn’t test logged-in areas
  • Cannot find logic flaws (e.g., broken access control)
  • May trigger false positives
  • Loud scans can be detected/blocked
  • No zero-day vulnerability detection

Conclusion

Penetration testing with Nikto is one of the simplest yet most effective ways to improve your website’s security. In under an hour, you can uncover critical flaws that attackers exploit daily. Start with a single scan, fix one issue at a time, and build a culture of proactive security.

Remember: tools like Nikto don’t replace knowledge. They empower it. Use Nikto as your early warning system, but always follow up with understanding, action, and continuous improvement. Your website, your users, and your peace of mind deserve nothing less.

Now go scan your server. The first step to security is knowing where you stand.

What is Nikto used for?

Nikto is used to scan web servers for misconfigurations, outdated software, and potentially dangerous files.

Is Nikto illegal to use?

No, if you have permission. Scanning without authorization is illegal.

Can Nikto hack a website?

No. It only identifies issues. It does not exploit them.

Do I need Kali Linux to use Nikto?

No. It works on Ubuntu, Fedora, macOS, and Windows via WSL.

How long does a Nikto scan take?

Typically 1 to 5 minutes for a standard site.

Can Nikto scan HTTPS websites?

Yes. Use -h https://yoursite.com or -ssl.

What does OSVDB mean in Nikto?

It refers to the Open Source Vulnerability Database, now largely replaced by CVE.

Will Nikto slow down my server?

Possibly. Run during low-traffic hours.

How do I save Nikto results?

Use -o filename.html -Format html.

Can Nikto find login pages?

Yes, it often flags /admin/, /login.php, etc.

Does Nikto detect SQL injection?

It flags vulnerable scripts, but doesn’t test injection directly.

What are false positives in Nikto?

Alerts for issues that aren’t actually exploitable in your setup.

Can I scan localhost with Nikto?

Yes: nikto -h http://127.0.0.1.

How do I update Nikto?

Run nikto -update or pull latest from GitHub.

Is Nikto part of OWASP?

Yes, it’s an official OWASP project.

Can Nikto bypass login pages?

Only with basic authentication via -id user:pass.

What HTTP methods should I allow?

Only GET, POST, and HEAD for most sites.

Should I remove phpinfo.php?

Yes, immediately. It exposes sensitive server information.

Can I automate Nikto scans?

Yes, using cron jobs or shell scripts.

Where can I learn more about Nikto?

Visit the official GitHub: https://github.com/sullo/nikto

What's Your Reaction?

like

dislike

love

funny

angry

sad

wow

Ishwar Singh Sisodiya I am focused on making a positive difference and helping businesses and people grow. I believe in the power of hard work, continuous learning, and finding creative ways to solve problems. My goal is to lead projects that help others succeed, while always staying up to date with the latest trends. I am dedicated to creating opportunities for growth and helping others reach their full potential.