Nessus: An Automated Network-Based Security ScannerBy Amy RichCrackers constantly probe machines looking for both old and new vulnerabilities. The script kiddies download an automated tool from the Net and bang away at any network they can reach, breaking into machines just to claim bragging rights in the cracker community. Often these cracked machines are used as platforms to launch new attacks against other internal and external machines. In order to avoid becoming a casualty of a casual cracker, savvy sysadmins audit their own machines before they're probed by hostile outsiders (or even hostile insiders). As such, an automated network-based security scanner is a vital part of a site's security measures. Dan Farmer and Wietse Venema's SATAN, released in 1995, was the first such well known tool, but technology has come a long way since then. Today's slick tools still have the same automation and modularity that SATAN first boasted, but with much improved front-end interfaces. Today's better tools provide an easy point-and-click GUI, charts and graphs, and the ability to share data across sessions. This article takes a look at what I consider one of the best such GPL tools out there, Nessus. Nessus follows a client server model. The server, Once the scan completes, the data appears on the client and can then be discarded or saved in a variety of formats. Some formats include Nessus's own internal format (which can be loaded back into the client at a later date), plain text for easy script parsing, and HTML with graphs and pie charts for web viewing and presentations. InstallationNessus installation occurs in one of three ways:
I prefer building and packaging most of my own software, so I'll cover my experience building Nessus from scratch. To start, there were a few prerequisite software packages. The machine where Nessus is built requires a compiler, lexical parser and analyzer, and GNU m4. OpenSSL and the GTK were highly recommended. I started with a full install of Solaris 9 OS, which included the important GTK packages and GNU zip and tar: system SUNWGtkr GTK - The GIMP Toolkit (Root) system SUNWGtku GTK - The GIMP Toolkit (Usr) system SUNWgzip The GNU Zip (gzip) compression utility system SUNWgtar gtar - GNU tar Next I grabbed Sunfreeware packages for gcc-3.3, m4-1.4, flex-2.5.4a, and bison-1.875 and installed them:
ncftpget
ftp://ftp.sunfreeware.com/pub/freeware/sparc/9/gcc-3.3-sol9-sparc-local.gz
gunzip gcc-3.3-sol9-sparc-local.gz
pkgadd -d gcc-3.3-sol9-sparc-local
ncftpget
ftp://ftp.sunfreeware.com/pub/freeware/sparc/9/m4-1.4-sol9-sparc-local.gzgunzip \
m4-1.4-sol9-sparc-local.gz
pkgadd -d m4-1.4-sol9-sparc-local
ncftpget
ftp://ftp.sunfreeware.com/pub/freeware/sparc/9/flex-2.5.4a-sol9-sparc-local.gz
gunzip flex-2.5.4a-sol9-sparc-local.gz
pkgadd -d flex-2.5.4a-sol9-sparc-local
ncftpget
ftp://ftp.sunfreeware.com/pub/freeware/sparc/9/bison-1.875-sol9-sparc-local.gz
gunzip bison-1.875-sol9-sparc-local.gz
pkgadd -d bison-1.875-sol9-sparc-local
I also downloaded and compiled OpenSSL from source. If installing OpenSSL on Solaris OS versions prior to 9, be sure to install the /dev/random patch first so OpenSSL uses a good source of entropy. Also, using -fPIC creates an installation that is optimized for the hardware OpenSSL is compiled on. You may wish to compile without this flag for better portability. ncftpget http://www.openssl.org/source/openssl-0.9.7b.tar.gz gtar zxf openssl-0.9.7b.tar.gz cd openssl-0.9.7b ./config -fPIC make make install With the prerequisites installed, I downloaded and installed each of the four components that compose the Nessus installation. I made certain that /usr/local/bin appeared in my path before any other directory that contained an m4 binary, otherwise the build of nessus-libraries failed making grammar.y. When installing, these components must be built in the correct order or they will fail:
Server ConfigurationNessus protects the communication between the client and the server by using SSL. So, after the installation completed, the next task was to create SSL certificates. Nessus comes with the
/usr/local/var/nessus/CA created
/usr/local/com/nessus/CA created
-------------------------------------------------------------------------------
Creation of the Nessus SSL Certificate
-------------------------------------------------------------------------------
This script will now ask you the relevant information to create the SSL
certificate of Nessus. Note that this information will *NOT* be sent to
anybody (everything stays local), but anyone with the ability to connect to
your Nessus daemon will be able to retrieve this information.
CA certificate life time in days [1460]: 3650
Server certificate life time in days [365]: 3650
Your country (two letter code) [FR]: US
Your state or province name [none]: California
Your location (e.g. town) [Paris]: Palo Alto
Your organization [Nessus Users United]: My Organization
-------------------------------------------------------------------------------
Creation of the Nessus SSL Certificate
-------------------------------------------------------------------------------
Congratulations. Your server certificate was properly created.
/usr/local/etc/nessus/nessusd.conf updated
The following files were created :
. Certification authority :
Certificate = /usr/local/com/nessus/CA/cacert.pem
Private key = /usr/local/var/nessus/CA/cakey.pem
. Nessus Server :
Certificate = /usr/local/com/nessus/CA/servercert.pem
Private key = /usr/local/var/nessus/CA/serverkey.pem
Press [ENTER] to exit
Next, I added a user to the Nessus database. Nessus keeps its own user database so that multiple people can be authorized to use the same nessus server for disparate portions of the network. Individual users have associated rules that restrict what hosts and networks they may probe. The rules are of the form:
accept|deny IP/CIDR default accept|deny The program Add a new nessusd user ----------------------- Login : arr Authentication (pass/cert) [pass] : pass Login password : testpass User rules ----------- nessusd has a rules system which allows you to restrict the hosts that arr has the right to test. For instance, you may want the user to be able to only scan his desktop or lab of machines. Please see the nessus-adduser(8) man page for the rules syntax. Enter the rules for this user, and hit ctrl-D once you are done: (the user can have an empty rules set) accept 192.168.1.0/24 default deny Any final server configuration can be accomplished by editing Client ConfigurationFor simplicity's sake, I used the
nessus &
First, I need to log in to the Nessus server using the username and password I created above. Since I ran the Nessus client from the server itself, I specified localhost as the
The next screen, which only appears during the first login, required me to set my level of SSL paranoia. Since I just created the junk CA and the server certificate, I chose the third option, to verify the server certificate and remember it for later use.
Now having logged into the Nessus server, I was presented with the plugin configuration tab. From this screen I chose which plugins to enable for this scan. This tab lists all of the classes of scanning plugins provided to the nessus server. Clicking on a category of plugins shows each individual plugin in the area below. Clicking on an actual plugin name will launch another window explaining what the plugin does, showing dependencies, and allowing the plugin timeout to be set.
Any plugins that could crash services or machines, denoted by the image of
an exclamation point inside a yellow triangle, are disabled by default. These
can be enabled individually or all plugins can be enabled by clicking on
By clicking on the The The address, range of addresses, or hostnames to scan are specified in the The format for the
I specified a range of IPs from 192.168.1.2 to 192.168.1.16:
Tweaking the scanning rules happens under the In this example, I wanted to skip testing 192.168.1.5, which happened to fall in the middle of my scanning block of addresses. I entered the following rules to accomplish this: reject 192.168.1.5 default accept
The
The The Scan and its ResultsWith my client configured to my liking, I clicked on In the following screen shot, I only polled one host (it happened to be the server running nessusd), so only one subnet and one host appear in my report. Nessus turned up several security notes, warnings, and even flagged a couple of holes.
The two ports it marked as having holes were the SMTP port and the submission port. Each port listed the same four vulnerabilities for sendmail and included a listing of URLs for sites (like CERT) that announced this bug and the workaround/fix back when it was first discovered. Nessus noted that it judged the sendmail version solely by the SMTP banner, and there was also a note specifically about Sun Microsystems, which informed me that Sun doesn't update the SMTP version number with patches, so this hole might be a false positive. This machine was recently patched (and I know that the sendmail patch had been applied by using showrev -p) so this was a false positive, just as Nessus warned. There was also a warning about ssh. However, this machine runs the set of ssh packages shipped with the Solaris 9 OS, and not OpenSSH; as a result, the version numbering is different and, again, the warning didn't apply. The one valid warning that nessus found for this host is XDMCP. Nessus informed me that people can sniff the XDMCP session and capture keystrokes. Nessus listed the risk factor for XDMCP as medium and suggested turning it off as a workaround. As is evident by scanning this one machine, each note, warning, and hole that Nessus flags could potentially be a false positive. It's best to read through the information Nessus provides and cross check with installed patches, modified banners, and other custom changes made to the system. Plugins and Keeping Up With the JonesesA vulnerability scanner is only as good as the scripts it runs. New vulnerabilities appear all the time, so keeping the scripts up to date requires diligence. Nessus installs a script called While keeping up-to-date with the scripts on the Nessus web site is good practice, users can also create their own scripts. Documentation exists for writing a test in C, and about NASL, the Nessus Attack Scripting Language (PDF). Both allow users to create custom tests tailored specifically to their environment. ReferencesAll of the Nessus documentation, source, scripts, and so on, can be found by following a link off of the main Nessus page. The documentation page also includes additional information that might prove useful for the advanced user.
Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License. |
|