With The Security Center and Nessus Web Application Security Testing
With The Security Center and Nessus Web Application Security Testing
The detection of Application-layer flaws within HTTP (or web) applications has become a
major source of activity for many enterprise security groups. Source code audits are one
means of finding these security holes. Many of these efforts to detect application bugs
within web applications can be automated by using the Nessus security scanner in
conjunction with the Security Center (formerly Lightning Console). The Security Center
allows the security administrator to schedule and report on scans in an automated and
distributed fashion. This paper will discuss the techniques used by Nessus and the Security
Center to efficiently scan for application layer bugs. This paper assumes that the reader is
familiar with operating a Nessus scan, web basics, SQL basic syntax, and Active scripting (or
CGI) applications.
A Web application bug can be every bit as devastating as a network-level bug. To further
exacerbate the problem, many companies and institutions allow web traffic to/from their
secured network segments (DMZ). An attacker that gains access to a web server may have
the ability to modify or create web content. The attacker may also gain access to business-
critical data (such as business logic, passwords, etc.). Furthermore, the attackers can use
their existing access to “escalate” their privileges on the internal network. While the firewall
may block access from the Internet into the internal network, most firewalls must,
necessarily, allow their web servers to communicate with internal machines and other DMZ
machines.
NOTE: Nessus checks for many web/CGI vulnerabilities (literally, hundreds). The scope of
this paper is the detection of “unknown” or “undocumented” vulnerabilities within a web
application. That is, the methodologies denoted below will find inherent weaknesses
within “homegrown” or “custom” web applications. This is significant in that it is a
departure from “signature based” vulnerability scanning.
Security auditors attempting to identify web application bugs should consider using the
Nessus vulnerability scanner available from http://www.nessus.org. Tenable Network
Security, Inc. is the author and manager of the Nessus Security Scanner which is available
for UNIX, Windows, and OS X operation systems. Nessus performs many security checks
for the hosts it tests and these checks are written predominantly in a language named NASL
(Nessus Attack Scripting Language). The checks are often referred to as “plugins” or
Nessus modules. The first step that Nessus automates during a vulnerability test is the
mirroring of the entire web server. This allows Nessus to find (and save within the
knowledge base) all active scripting (or CGI) directories, and all web forms. The latter is a
very important component in web application testing.
The plugin which mirrors the website is webmirror.nasl with a Plugin ID of 10662.
Webmirror.nasl does more than just “mirror” the website and populate the knowledge base.
Webmirror.nasl also looks for inherent weaknesses within the active scripts (or CGI scripts)
that it finds. Furthermore, as webmirror.nasl runs, it finds all active (or CGI) scripts.
Nessus notes the location of these scripts and ferrets away the information for further
testing. So, for example, if there was a link to a file called /my-secret-cgi/foo.cgi, Nessus
After webmirror.nasl runs, the knowledge base is populated with all known active scripts
and forms (among other things). The following scripts take advantage of this information
and run individual checks.
• apache_dir_listing.nasl
• asp_source_data.nasl
• asp_source_dot.nasl
• asp_source_space.nasl
• bakfiles.nasl
• BEA_weblogic_Reveal_Script_Code_2.nasl
• BEA_weblogic_Reveal_Script_Code_3.nasl
• BEA_weblogic_Reveal_Script_Code.nasl
• db4web_dir_trav.nasl
• DDI_IIS_Compromised.nasl
• domino5_overflows.nasl
• domino6_overflows.nasl
• ibm_server_code.nasl
• iis_asp_overflow.nasl
• iis_codebrws.nasl
• iisprotect_bypass.nasl
• imp_mime_viewer_html_xss.nasl
• iplanet_app_server_detection.nasl
• mailreader.nasl
• mod_auth_any.nasl
• mod_gzip_running.nasl
• mod_ntlm.nasl
• mod_survey_sql_injection.nasl
• ms_index_server.nasl
• multitech_proxy_default_pwd.nasl
• no404.nasl
• office_files.nasl
• oracle9i_globals_dot_jsa.nasl
• oracle9i_jsp_source.nasl
• osX_apache_finder_content.nasl
• osX_apache_finder.nasl
• php_4_2_x_malformed_POST.nasl
• php_split_mime.nasl
• psynch_multiple_vulns.nasl
• servletExec_File_Reading.nasl
• sql_injection.nasl
• tomcat_source_exposure.nasl
• torturecgis.nasl
• webgais.nasl
• webstores_browseitemdetails_sql_injection.nasl
• www_hosting_copyrighted_material.nasl
A description of each of these NASL modules is outside the scope of this paper. We will,
however, go into more detail on DDI_Directory_Scanner.nasl, torturecgis.nasl, and
sql_injection.nasl.
This NASL module will find directories (both visible and “hidden”). It does this by using a
brute-force technique against the web server. So, for example, if the Web Administrator
created a directory named “backup” which he/she uses to store old password files,
DDI_Directory_Scanner.nasl would find this directory and report on it. This NASL module
will find directories which are not “linked” to the actual web server content. As many
Administrators rely on security through obfuscation, this NASL module is a critical piece of
any web application penetration test.
Torturecgis.nasl
This NASL module takes the output from webmirror.nasl and tests each of the active scripts
(or CGI scripts). Torturecgis.nasl includes checks for:
SQL injection is an Application layer (or layer 7) attack. At this time, it is one of the more
popular attack methods employed by professional penetration testers as well as hackers.
SQL injection attacks exploit flaws that are caused by the failure to properly validate input
data by the programmer, and are a common root cause of many of the popular Application
layer attacks.
Within SQL statements, certain characters have a special meaning. For instance, the
semicolon tells the SQL engine to stop processing the statement, and the keyword OR
changes the logic of the SQL statement. When an application fails to strip out one of these
special characters or strings, the logic of the SQL statement can be compromised. This can
lead to unauthorized system or data access. SQL injection attacks commonly use a “front-
end” (or ingress) machine as their attack vector. Typically Web sites are connected to a
back-end SQL server. The attacker typically tests the Web server for CGI scripts or forms
that return error codes regarding SQL. Once an attacker finds a script or form which does
You can test for the SQL injection manually; however, this can be very time consuming. To
manually check for SQL injection flaws (not recommended), you must first identify the
ingress point of the SQL statement (i.e., the Web form, CGI, etc.) and map out each of the
input parameters. For example, www.thisNEwidget.com/orderform.asp is a Web form which
accepts four input variables (text boxes named box, box2, box3, and box4). A typical
browser address bar may look like:
http://www.thisNEwidget.com/orderform.asp?box=Joe%20
Smith&box2=Atlanta%20GA&box3=widget%20order&box4=654333
In this imaginary order, a user named Joe Smith from Atlanta, Georgia, is placing a widget
order for item number 654333. In the browser window, you can tamper with the values of
the four variables. By changing the URL to:
http://www.thisNEwidget.com/orderform.asp?box=Joe%20
Smith&box2=Atlanta%20GA&box3=widget%20order&box4=;
(Note the trailing semicolon.) You may receive a SQL or database error. The site is
probably vulnerable to SQL injection if this occurs. Once a SQL injection flaw is found, it is
typically manually exploited. Common exploit methods include calling a stored procedure
(such as xp_cmdshell, a Microsoft SQL default stored procedure), creating a SQL query
which dumps all table data to an HTML table, and copying a file (like cmd.exe) into the Web
root directory.
Sql_injection.nasl takes the output from webmirror.nasl and queries each form using an
invalid SQL statement. Nessus then looks at the reply from the web server. So, for
example, if the web server returned an error which contained the string “You have an error
in your SQL syntax”, Nessus would flag the application as being vulnerable to SQL injection.
Manual code audits are tedious and time consuming. Nessus can scan every day and find
the obvious flaws within an application. Even after a manual code audit, the programs will
be edited and changed over time. Automated Nessus scanning (a feature within the
Security Center) will detect the application-layer vulnerability at the next scan window.
To conduct a Nessus scan for Web/CGI applications, perform the following steps:
1. Perform an update of the Nessus plugins to make sure you have the latest version of
the plugins denoted above.
For those who are using the Security Center to manage their scans, you would simply create
a “Template” scan with the settings from above. This scan would then be available to
authorized users.
Tenable, located in Columbia, Md., develops enterprise security solutions that provide
compliance monitoring, vulnerability management, intrusion detection, and security event
notifications across entire organizations for effective network security management.
Tenable is uniquely positioned to detect vulnerabilities with active and passive scanning and
analysis, and host-based patch monitoring for enterprise networks. Key product lines
include: Nessus Vulnerability Scanner, the leading global technology utilized for vulnerability
scanning; Passive Vulnerability Scanner for passive vulnerability monitoring; the Security
Center for enterprise security management; and the Log Correlation Engine for secure log
aggregation and analysis. For more information, please visit us at
http://www.tenablesecurity.com.