Running a Basic Nikto Web Scan
Now that Nikto is installed in your Kali Linux container, you will learn how to run a basic web vulnerability scan. This step builds on the environment setup from the previous step and introduces you to using Nikto to identify potential security issues on a web server. Since you are already in the Kali Linux container's shell when you open the terminal in the LabEx VM, there is no need to manually start or enter the container.
Let's understand what a basic Nikto scan does. Nikto scans a target web server for common vulnerabilities, such as outdated software versions or misconfigurations that could be exploited. For this lab, we will use a publicly accessible test server, testphp.vulnweb.com, which is designed for learning and practicing vulnerability scanning. This ensures that we are scanning in an ethical and safe manner.
To start, run a basic scan on the test server using Nikto. Enter the following command in the terminal:
nikto -h testphp.vulnweb.com
The -h option specifies the host to scan, in this case, testphp.vulnweb.com. This scan may take a few minutes to complete, depending on network conditions and the target's configuration. During the scan, you will see output in the terminal showing the progress. A sample output might look like this:
- Nikto v2.5.0
---------------------------------------------------------------------------
+ Target IP: 44.228.249.3
+ Target Hostname: testphp.vulnweb.com
+ Target Port: 80
+ Start Time: 2025-04-21 07:29:12 (GMT0)
---------------------------------------------------------------------------
+ Server: nginx/1.19.0
+ /: Retrieved x-powered-by header: PHP/5.6.40-38+ubuntu20.04.1+deb.sury.org+1.
...
---------------------------------------------------------------------------
+ 1 host(s) tested
When scanning testphp.vulnweb.com with nikto, you may encounter error messages. This is expected; please focus on the key information.
This output provides initial information about the target, such as its IP address, hostname, and port. It also lists potential issues, like missing security headers or outdated components. Don't worry if the output seems detailed; the focus here is to run the scan and observe the process. In the next steps, we will analyze these results more closely.
If the scan does not start or no output appears, ensure your internet connection is active within the LabEx VM. You can test connectivity to the target by running:
ping -c 4 testphp.vulnweb.com
This command sends a few packets to the target to check if it is reachable. If you see responses, the server is accessible; if not, retry the scan or check your network settings in the LabEx VM.
PING testphp.vulnweb.com (44.228.249.3) 56(84) bytes of data.
64 bytes from ec2-44-228-249-3.us-west-2.compute.amazonaws.com (44.228.249.3): icmp_seq=1 ttl=55 time=21.4 ms
64 bytes from ec2-44-228-249-3.us-west-2.compute.amazonaws.com (44.228.249.3): icmp_seq=2 ttl=55 time=21.7 ms
64 bytes from ec2-44-228-249-3.us-west-2.compute.amazonaws.com (44.228.249.3): icmp_seq=3 ttl=55 time=21.5 ms
64 bytes from ec2-44-228-249-3.us-west-2.compute.amazonaws.com (44.228.249.3): icmp_seq=4 ttl=55 time=21.5 ms
--- testphp.vulnweb.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 21.435/21.523/21.699/0.103 ms
This step has introduced you to running a basic Nikto scan, setting the foundation for more specific scanning and analysis in the following steps. You have executed the scan command and observed the initial output directly in the Kali Linux container's terminal.