Scanning Multiple Apache VirtualHosts With Nessus
Web sites have a way of evading vulnerability scanners in the form of virtual hosting. It is a common practice to host multiple web-sites (and associated applications) on a single web server using only one IP addresses. This causes problems for vulnerability scanners, including Nessus, as they look for vulnerabilities on the single IP or hostname provided. The remote server directs this traffic to a specific virtual host or web application, leaving a considerable amount of virtual real-estate untouched. The problem is that Nessus has no easy way to enumerate the domain names or additional IP addresses associated with a given system. Scanning every hostname, domain name and IP address associated with the server could reveal additional vulnerabilities in the web applications or hosts associated with the given server. For example, when scanning just a single IP address in the lab, I received the following result:
In the plugin output above, we can see that the host is running PHPMyAdmin, a popular PHP application to manage MySQL databases. Few vulnerabilities are revealed until we expand our testing to include the domain names of the target associated with each virtual host in our scan as follows:
There are several ways to enumerate the virtual hosts running on a given IP address. A fast and easy way to find the hostnames on an Internet accessible site is to use Microsoft's Live service. For example, if we take the IP address of www.nessus.org (184.108.40.206), create a Microsoft Live! query and prepend it with "ip:", such as ip:220.127.116.11, virtual hosts associated with the IP address are displayed.
By including the virtual host names, we find more information about the associated hosts, installed web applications and their vulnerabilities:
The plugin above detects if there are fields in the web application that accept a password and send it to the remote server without the protection of SSL encryption. If it finds any occurrences of this behavior, Nessus flags these as a vulnerability.
The CGI scanner found several scripts that it did not detect in the previous scan. In addition to PHPMyAdmin, it found "index.php" and a directory called "passwords" that warrants further investigation and manual inspection. By giving Nessus a little more information about the environment to be tested, we can greatly expand the results and find additional vulnerabilities. Be certain to enumerate the domain names and virtual hosts when performing vulnerability scans of web servers. This can be a simple task such as asking the customer or systems administrator for a list, or using various information gathering techniques.