-----BEGIN PGP SIGNED MESSAGE-----

===========================================================================
             AUSCERT External Security Bulletin Redistribution

      ESB-2003.0100 -- NGSSoftware Insight Security Research Advisory
                               NISR16022003d
          Oracle9i Application Server Format String Vulnerability
                             19 February 2003

===========================================================================

        AusCERT Security Bulletin Summary
        ---------------------------------

Product:                Oracle9i Application Server Release 9.0.2
Vendor:                 Oracle
Impact:                 Execute Arbitrary Code/Commands
Access Required:        Remote

Comment: Information from Oracle on this vulnerability is available at:

         http://otn.oracle.com/deploy/security/pdf/2003alert52.pdf

- --------------------------BEGIN INCLUDED TEXT--------------------

NGSSoftware Insight Security Research Advisory

Name:    Oracle9i Application Server Format String Vulnerability
Systems Affected:  All platforms; Oracle9i Application Server Release 9.0.2
Severity:  Critical Risk
Category:               Format String Vulnerability
Vendor URL:   http://www.oracle.com
Author:   David Litchfield (david@ngssoftware) and Mark Litchfield
(mark@ngssoftware.com)
Date:   16th February 2003
Advisory number: #NISR16022003d


Description
***********
Oracle's 9i Application Server offers a highly functional web server
designed to seamlessly integrate with an Oracle backend database server.
Based on Apache the server offers many environments for web based
applications such as Java/JSP, PL/SQL, Perl and FastCGI. With their latest
release of the Application Server, 9.0.2, Oracle has added support for
WebDAV, Web Distributed Authoring and Versioning, that turns the Web into a
file sharing system.


Details
*******
DAV is turned on by default. Whilst this is bad in and of itself, as
attackers can anonymously upload files to the server, an attacker can
exploit a format string bug in the one of the logging functions. If an
attacker uses the COPY method and supplies a destination URI that uses a
different scheme or port then a 502 Bad Gateway response is returned. This
is logged and in doing so the format string can be exploited. Although the
Apache mod dav module is not vulnerable itself the vulnerable code is
there - it is just not ever executed. Oracle has modified the moddav module
and changed it so bad gateway responses are logged - and thus they are
vulnerable. Looking at the moddav source

>From mod_dav.c revision 1.157

..
..
lookup = dav_lookup_uri(dest, r);
if (lookup.rnew == NULL)
{
      if (lookup.err.status == HTTP_BAD_REQUEST)
      {
            ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO,
r,lookup.err.desc);
            return HTTP_BAD_REQUEST;
      }
      return dav_error_response(r, lookup.err.status, lookup.err.desc);
}
..
..

This code calls the dav_lookup_uri() function in dav_util.c. From dav_util.c
revision 1.84

..
dav_lookup_result dav_lookup_uri(const char *uri, request_rec * r)
{
..
..
if (strcasecmp(comp.scheme, scheme) != 0 || comp.port != port)
{
      result.err.status = HTTP_BAD_GATEWAY;
      result.err.desc = ap_psprintf(r->pool,
      "Destination URI refers to different "
      "scheme or port (%s://hostname:%d)\n"
      "(want: %s://hostname:%d)",
      comp.scheme ? comp.scheme : scheme,
      comp.port ? comp.port : port,
      scheme, port);

      return result;

..
..
}

When dav_lookup_uri() returns to mod_dav.c the format strings occurs

..
lookup = dav_lookup_uri(dest, r);
if (lookup.rnew == NULL)
{
      if (lookup.err.status == HTTP_BAD_REQUEST)
      {
      // THIS IS THE FIRST FORMAT STRING VULNERABILITY
      ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO,
r,lookup.err.desc);
..
..
}


Of course the code should have read

ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO,
r,"%s",lookup.err.desc);

to not be vulnerable.

By crafting a specially formed format string and sending to the server an
attacker can overwrite arbitrary address with arbitrary values which can
allow an attacker to gain control of the web server. To do this they could
overwrite a saved return address on the stack, an exception handler or
pointer to a function with an address that points to a buffer that contains
the arbitrary code to execute.

Fix Information
***************
NGSSoftware alerted Oracle to this vulnerability on 24th September 2002.
Oracle has developed a patch which is available from

http://otn.oracle.com/deploy/security/pdf/2003alert52.pdf

A check for these issues has been added to OraScan, a comprehensive
automated vulnerability assessment tool for Oracle Application Servers of
which more information is available from the NGSSite

http://www.nextgenss.com/software/orascan.html

About NGSSoftware
*****************
NGSSoftware design, research and develop intelligent, advanced application
security assessment scanners. Based in the United Kingdom, NGSSoftware have
offices in the South of London and the East Coast of Scotland. NGSSoftware's
sister company NGSConsulting, offers best of breed security consulting
services, specialising in application, host and network security
assessments.

http://www.ngssoftware.com/
http://www.ngsconsulting.com/

Telephone +44 208 401 0070
Fax +44 208 401 0076

enquiries@ngssoftware.com

- --------------------------END INCLUDED TEXT--------------------

You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.

This security bulletin is provided as a service to AusCERT's members.  As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content.  The decision to use any or all of this information is
the responsibility of each user or organisation, and should be done so in
accordance with site policies and procedures.

NOTE: This is only the original release of the security bulletin.  It may
not be updated when updates to the original are made.  If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.

Contact information for the authors of the original document is included
in the Security Bulletin above.  If you have any questions or need further
information, please contact them directly.

Previous advisories and external security bulletins can be retrieved from:

        http://www.auscert.org.au/render.html?cid=1980

If you believe that your system has been compromised, contact AusCERT or
your representative in FIRST (Forum of Incident Response and Security
Teams).

Internet Email: auscert@auscert.org.au
Facsimile:      (07) 3365 7031
Telephone:      (07) 3365 4417 (International: +61 7 3365 4417)
                AusCERT personnel answer during Queensland business 
                hours which are GMT+10:00 (AEST).  On call after hours 
                for member emergencies only.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBPlNUiyh9+71yA2DNAQFsGgP/Z+oQivbnSvNnmNVVsAMUZ9douxCHD/KY
iwQuhVcCPv7UAGgf9jfuZtnfrW3+26MHFttPdntniSoTcFB0DZgf+IgMnR+Fli+0
Vm2umbosdzAAWcdMl81zFBl9fB5uicU6Fhl3vGobHej/SlQEzsNAEI6pFdzghJRN
A6QpMMjWmDQ=
=R2F8
-----END PGP SIGNATURE-----