Ihr Spezialist für komplexe IT-Systeme
 

This chapter introduces Nessus [Nessus]. Nessus is a very popular open source security scanner. Which allows us to perform automatic scanning of vulnerabilities on remote computer systems. To make Nessus more effective in terms of vulnerability scanning of Oracle products, we will also have a short look on how to write new plugins or customize exiting plugins. Because it may be necessary to reflect some Oracle specific issues. Like uncommon port numbers like 1810, 7777 or things like that.

The installation of nessus is quite simple and will be done in a few minutes. First download the nessus installer (a shell script) from the download page. And execute it:

[frank@w0001 frank]$ bash nessus-installer.sh

The installer will ask you some questions (root password :-), install location etc). Afterwards the nessus server and a GTK client are build (compiled) using the source code and installed on your computer.

To use SSL communication between nessus client and server, we need to generate a certificate:

[frank@w0001 frank]$ su -
Password:
[root@w0001 root]# nessus-mkcert
[root@w0001 root]#

And to login, it is nice to have an user :-), I did not define any access rules for the user.

[root@w0001 root]# nessus-adduser
[root@w0001 root]#

And now it is time to start the server:

[root@w0001 root]# nessusd -D
[root@w0001 root]# ps xa | grep nessusd
26933 ?        S      0:00 nessusd: waiting for incoming connections
26935 pts/5    S      0:00 grep nessusd
[root@w0001 root]#

Security is a dynamic business, so it is always a good idea to update the nessus plugin database :-)

[root@w0001 sbin]# nessus-update-plugins
[root@w0001 sbin]#

If you need further information about installation or configuration please consult the nessus homepage.

Currently there are only a few nessus plugins that perform tests on Oracle products. That is may be related to the fact that not many nessus hackers have running Oracle installations. But that also means that we have to write our own plugins.

Anyway, writing plugins for nessus is most of the time very simple business (depending most of the time on the underlying protocols used). My example will test if one of the Oracle Demos is accessible. This demo may allow SQL injection so it is worse checking for it.

Nessus plugins are normally structured in two parts:

  • information and dependencies stuff, that is for instance the description of the vulnerability, some text how to resolve the problem and also some code to define other nessus plugins we depend on, or which TCP/IP ports or services our code would like to test
  • the code to test for the vulnerability

To start with writing a new plugin I am normally searching for similar plugins that already exist. So you just have to copy the existing one and use it as an template for the new one :-).

So lets start with coding, we want to check if we can request an URL to /pls/portal/PORTAL_DEMO.ORG_CHART.SHOW. And that is the NASL code for this one:

if(description) {
  script_id(11918);
  script_version("$Revision$");
  name["english"] = "Oracle 9iAS PORTAL_DEMO ORG_CHART";
  script_name(english:name["english"]);
  desc["english"] = "your description of the plugin";
  script_description(english:desc["english"]);
  summary["english"] = "Tests for presence of Oracle9iAS PORTAL_DEMO.ORG_CHART";
  script_summary(english:summary["english"]);
  script_category(ACT_GATHER_INFO);
  family["english"] = "CGI abuses";
  script_family(english:family["english"]);
  script_dependencie("find_service.nes", "http_version.nasl");
  script_require_ports("Services/www", 80, 7777, 7778, 7779);
  script_require_keys("www/OracleApache");
  exit(0);
}

include("http_func.inc");

port = get_kb_item("Services/www");
if(!port)port = 80;
if(get_port_state(port)) {
  req = http_get(item:"/pls/portal/PORTAL_DEMO.ORG_CHART.SHOW", port:port);
  soc = http_open_socket(port);
  if(soc) {
    send(socket:soc, data:req);
    r = http_recv(socket:soc);
    http_close_socket(soc);
    if("Organization Chart" >< r)
      security_hole(port);
  }
}

I marked the really important parts of the code in red, even if you don't know C or other programming languages very well, it shouldn't be very difficult to read the code. We send our URL and check if the response includes the string "Organization Chart" which is the title of that demo page. That's all folks :-). If you want to learn more about NASL, just visit the Nessus Homepage and read the NASL reference.

For your reference you can also download the plugin from my homepage. Normally you should get the latest version during a normal nessus plugin update.