My latest ventures with BackTrack have brought me to play around with Nexpose from Rapid 7. I had been looking for low cost vulnerability scanning solution to use at work. I am familiar with Nessus, and like it a lot, but wasn’t sure if the bean counters would fork up $1500 a year for a Professional Feed license. This brought me to Nexpose Community Edition from Rapid 7. It’s just as capable as Nessus and the Community edition lets you scan up to 32 ip addresses at a time for free….you just can’t beat that. Now to be fair, Nessus doesn’t have a comparable dumbed down version, the Nessus PF is comparable in features to the Nexpose Express edition which carries a $3000 price tag. My budget was close to nothing so I went with Nexpose.
Now, justy to get some of the differences and caveats between the Community version and the “Pay for” version out there. In the community version:
- Host discovery is limited at best, we need to use Nmap
- Policy or security template checking is disabled
- Unable to modify the existing scan templates (there are a handful of real useful preconfigured tempaltes included though)
- Allowed report types are Audit and Executive Summary (export to PDF/HTML) and Simple XML format…more on this later.
Anyways, I’m going to run through how to use it and how soem of the scans work. I’ll also touch on the API and how to extend some of the included reporting. First of all installation onto BackTrack 5 is a breeze, just follow the directions from the quick-start guide for a Ubuntu installation and you’ll be up and running no time. Once it’s installed, you can start it by:
root@bt:# cd /opt/rapid7/nexpose/nsc
root@bt:/opt/rapid7/nexpose/nsc# ./nsc.sh
Now when it starts for the first time, it will take a while to initialize. After that it will start quickly. After it’s gone through the initialization phase, log into http://127.0.0.1:3780. Log in with user nxadmin and the password you created during installation. just a tip, don’t forget that password…if you do you’ll have to reinstall! The next step will be to get an activation code from Rapid7, just follow the directions on the screen. It’s pretty painless.
The process for getting a scan going is pretty straight forward: Host discovery, create a site, add ip’s to scan to that site, set a scan template, and scan. I’ll walk you through it with some screen shots below.
Host Discovery
Now before we get to adding the site you need to figure out what hosts you want to scan. I suggest using nmap to do the host discovery, due to the 32 ip address limitation with the Community version of Nexpose it won’t do any discovery by passing it a subnet. Take the nmap output and parse out the ip’s splitting them up if you have more than 32.
Creating a Site and Adding Assets
After logging in and setting activating the software you will be at the Home page. From here just add the “New Site” button.
Give your site a name on the General tab and click “Next”. Enter or paste in your list of IP addresses in the Devices tab, alternatively you could upload a text file with a list of IP addresses. If you gerpped and piped nmap out put to a file that is :)
Click “Next” and select the scan template you want in the Scan Setup tab. There are quite a few scan templates to pick from, an the Nexpose Administrator’s Guide has a wealth of information on how the scans work and what each scan type actually does. One feature to note is the use of Scan optimizer ports for some of the templates that don’t default to a SYN scan for port/service discovery. These are basically ports that the scan engine uses to determine the optimal scan method for each host. Pretty cool…Anyways, there are a few scans that I end up using the most and you probably will too. Here’s a brief run-down of these:
Exhaustive:
This thorough network scan of all systems and services uses only safe checks, including patch/hotfix inspections, policy
compliance assessments, and application-layer auditing. This scan could take several hours, or even days, to complete, depending on
the number of target assets.The scan includes all ports, uses optimizer ports to determine scan type, all safe checks, and no check types disabled
Full Audit:
This full network audit of all systems uses only safe checks, including network-based vulnerabilities, patch/hotfix checking, and application-layer auditing. NeXpose scans only default ports and disables policy checking, which makes scans faster than with the Exhaustive scan. Also, NeXpose does not check for potential vulnerabilities with this template. Includes ports 1 – 1040, no tcp optimizer ports – uses syn scan , disables policy check types.
Microsoft HotFix:
This scan verifies proper installation of hotfixes and service packs on Microsoft Windows systems. For optimum success, use administrative credentials. Includes ports 139,135, 445, 1433, 2400 , no tcp optimizer ports – uses syn scan, only checks for microsoft hot-fixviolations
Now, just a quick note. In testing the different scan and doing some comparisons the Exhaustive and Full Audit scans returned the same number of vulns (349) while the Pentest Scan only returned 6. The Microsoft Hot-Fix scan was very accurate.
Click ”Next” and enter credentials if you have them. Set up the Windows/Samba credentials at the least. These will give you teh ability to check for windows patches as well as various configuration checks on windows machines. I have been prodominately scanning Windows machines on my network for vulnerability assessments so I used Domain Admin credentials. If your’re conducting a pentest you probably dont have thoise credentials…..yet :) Here’s a screen shot of how to set it up.
Click “Next” and add some information for the reports like organization, primary contact, title, etc. When your done, just click “Save” and you’re done the site setup.
Starting a Scan
After you have created a site and added hosts/targets to it, which are refernced as Assets, you will be back at the Home tab and should see your new site under the Site Listing section. To start a scan, click the little green arrow next to you newly createrd site and specify which of the Assets from that site you want to scan. You have the aptions to scan all Assets or just select the teh ones you want.
Click “Start Now” and you will see the scan start and Nexpose will begin reporting the status of that scan back to you. Depending on the scan template and the number of host, the scan could take some time. This screen will show you the Assets discovered and teh number of vulnmerabilities found against each one.
The scan log shows a good deal of detail and can be real helpful in determining how a specific installed application was identified and what chekcs were being done. Great tool for troubleshooting. I found it particularly useful when the scan identified a flash vulnerability on one of my machines. I did not have flah installed, but had the flash plugin for internet explorere installed. A quick gerep of teh log helped me identify where it was installed and what registry was indicating so. To Acces teh scan log, click the “View Scan Log” button.
Once the scan is complete, the Nexpose web interface shows a wealth on information about the assets grouped by site. From the Assets tab, just select your site and you will see a Site Summary, Scan Listing, and Asset Listing. The Asset listing shows each asset, the vulns discovered, and the number of exploitable vulns. I love that feature. It uses exploits from Metasploit and ExploitDB for it’s exploit identification.
If you click on a specific asset, it Brings you to an Asset Summary. This shows sepcific informatyion about the Asset(ip, hosts name, MAC, OS, etc.), vulnerability details, exploit details, installed software, service/port, and shares. Good wealth of information. I love the exploit details, easily gives you the information to fire up Metasploit and demonstrate how exploitable said vulnerability really is. Cool stuff. See the screenshots below:
Reporting
The community version of Nexpose does inlcude a few reporting options and they are definately adequate…although the one that you get in the “Pay For” version seem quite attractive as well. So, in you get the option to use Full Audit, Executive Summary, and Nexpose Simple XML format. These reports can be exported to PDF and HTML (except the simple XML format of course).
The Full Audit is exactly that. You get: an executive summary, a listing of the assets discovered, vulnerabilities (grouped by severity with affected assets for each vuln), software listing (grouped by software showing instances installed across site), service listing (grouped same as software). The vulnerability section as a description and a detailed resolution. The way the report is structured, it is great for remediation of these issues. You just walk through the Hih, medium, and low vulnerability by vulnerability addressing the affected assets.
The executive Summary if just the executive summary section of the Full Audit report. The Simple XMl is an xml output listing the device and the vulnerabilities found for each device. The details for the vulnerabilities are slim to none, a real basic xml dump.
You run and access the report from the Report tab. To create a report, just click the “New Report” button and follow the wizard to select the report type, output format, the assets to include, and the vulns to include (all or just critical and high). See the 2 screenshots below for reference.
Vulnerabilities Tab
The Vulnerabilities tab shows all of teh vulnerabilities across the site(s) with exploitability, CVSS score, risk factor, and the ability to exclude them from reporting. I guess this is useful if you have a vulnerability you cannot address beacuse of soem 3rd party application requirements or something. No need to keep reminding you how that legacy app is screwing your security posture or anything…..I digress. Anyways, heres a screen shot for you.
Nexpose API and Extending the Simple XML Format
Another cool thing that Rapid7 has done is expose and API for automating many tasks associated with Nexpose. They have functions/methods that allow you to create sites, add assets, run scans, query vulnerability details, create reports, and delete assets/sites all from an external application. They are very well documented and some very handy samples in ruby are out there as well. The Nexpose Community Forums are a great resource for this stuff, and include the detailed documentation as well.
Armed with the API, I went about my task. I liked the Full Audit report, but wanted a report that was grouped and sorted by asset or host as well. Since nothing came out of the box I decided to enhance the Simple XML format by replacing the limited vulnerability nodes in the XML format with the full vulnerability details retireved with a call to the API to query the vuln by identifier. That combined with an xsl formatting document resulted in a xml file that could easily be displayed in most browsers and show all the information I wanted in a nice format. The report lists each host/asset and a table of vulnerabilities for that host with title, severity, PCI severity, CVSS score, port, service, and service description. If you click on the vulnerability title, a window will pop up with all the details for that vulnerability. Note: the pop-up doesn’t work right in IE, but I don’t care b/c I don’t use it. Here is an example of the finished product.
Here is a screenshot of the orginal XML output in the Nexpose Simple XM format:
Here is the modified XML:
Here is ruby script (inside the zip) and the xsl stylesheet I worte to make this happen. Note: the xslstyle sheet needs to be in the same diectory as the xml file to work right.
nexpose.xsl
ns_updatexml.zip
That’s it, in my next post I’ll cover how to use Nexpose from within Metasploit…yep you can scan right from msfconsole and log the results to the db. Great integration, it also automates the process of scanning more than 32 ip addresses at once. Have fun scanning….