copyright | disclaimer | privacy | contact  
Australia's Leading Computer Emergency Response Team
 
Search this site

 
On this site

 > HOME
 > About AusCERT
 > Membership
 > Contact Us
 > PKI Services
 > Training
 > Publications
 > Sec. Bulletins
 > Conferences
 > News & Media
 > Services
 > Web Log
 > Site Map
 > Site Help
 > Member login





 

ESB-2005.0035 -- NGSSoftware Insight Security Research Advisories -- Two vulnerabilities in IBM DB2

Date: 13 January 2005
References: ESB-2005.0036  

Click here for printable version
Click here for PGP verifiable version
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

     ESB-2005.0035 -- NGSSoftware Insight Security Research Advisories
                      Two vulnerabilities in IBM DB2
                              13 January 2005

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

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

Product:           IBM DB2 8.1 Fixpak 6 and earlier
                   IBM DB2 7.x Fixpak 11 and earlier
Publisher:         NGSSoftware
Operating System:  UNIX variants
                   Linux variants
                   Windows
Impact:            Execute Arbitrary Code/Commands
Access:            Remote/Unauthenticated

Original Bulletin: http://www.nextgenss.com/advisory.htm

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

Researchers at NGSSoftware have discovered multiple critical/high risk 
vulnerabilities in IBM's DB2 Universal Database. Versions affected include

DB2 8.1 Fixpak 6 and earlier
DB2 7.x Fixpak 11 and earlier

Two of the issues, remotely exploitable buffer overflows, have been fixed in 
Fixpak 7 for DB2 8.1 and Fixpak 12 for DB2 7.x. These Fixpaks were released 
last week and they can be downloaded from

http://www-306.ibm.com/software/data/db2/udb/support/downloadv8.html - DB2 
v8.1
http://www-306.ibm.com/software/data/db2/udb/support/downloadv7.html - DB2 
v7.x

The flaws fixed in these Fixpaks equate to NGSS BUGID 98 and 101 from the 
Vendor Notification Alerts - http://www.nextgenss.com/vna.htm

- -------------------------------------------------------------------------------

Name: IBM DB2 generate_distfile buffer overflow
Systems Affected: DB2 8.1/7.x	
Severity: High risk
Vendor URL: http://www.ibm.com/
Author: David Litchfield [ david at ngssoftware.com ]
Relates to: http://www.nextgenss.com/advisories/db2-01.txt
Date of Public Advisory: 23rd December 2004
Advisory number: #NISR2122004L
Advisory URL: http://www.ngssoftware.com/advisories/db223122004L.txt

Description
***********
IBM's DB2 database server contains a procedure, generate_distfile. This
procedure suffers from a stack based buffer overflow vulnerability.

Details
*******
The generate_distfile procedure is vulnerable to a buffer overflow
vulnerability. generate_distfile is implemented as a C function, exported by
db2dbappext.dll. It takes as its third parameter the name of a file. This
parameter can be up to 255 characters long.

One of the sub functions of generate_distfile takes the third parameter, the
user supplied filename, and appends it to the directory where DB2 has been
installed. It does this by creating a 264 byte buffer on the stack. The
subfunction then calls sqloInstancePath() to get the install path for DB2.
This returns C:\PROGRA~1\IBM\SQLLIB\DB2. \tmp\ is then appended to this.
After \tmp\ is appended the user supplied filename is appended using a while
loop that continues to copy data until a NULL terminator is found. Because
the  DB2 install path (C:\PROGRA~1\IBM\SQLLIB\DB2\tmp\) takes up some of the
buffer, if the user has supplied a thrid parameter of 255 bytes the stack
based  buffer is overflowed.

However, once the buffer is overflowed, as well as overwriting the saved
return address, a pointer is also overwritten. This pointer points to a
buffer where  the resulting full path should be copied to. This interupts a
straight return address overwrite exploit; however it can still easily be
exploited in several  ways. Due to the fact that the attacker "owns" the
pointer to where the path is copied to, they can write arbitrary data to an
arbitrary location allowing a  full compromise. Once such method would be to
overwrite the pointer to the Windows UnhandledExceptionFilter function; as
access violations aren't handled,  the UEF kicks in an as the attacker
controls the UEF the flow of execution can be redirected by the attacker to
arbitrary code.

Note - whilst the discussion has used Windows paths *nix versions of DB2 are
also vulnerable.


Fix Information
***************
IBM has written a patch and can be obtained with the latest fixpak.

http://www-306.ibm.com/software/data/db2/udb/support/downloadv8.html - DB2
v8.1
http://www-306.ibm.com/software/data/db2/udb/support/downloadv7.html - DB2
v7.x

NGSSQuirreL for DB2 (http://www.nextgenss.com/db2.htm) can be used to assess
whether your DB2 server is vulnerable to this.

- -------------------------------------------------------------------------------

Name: IBM DB2 rec2xml buffer overflow
Systems Affected: DB2 8.1/7.x	
Severity: High risk
Vendor URL: http://www.ibm.com/
Author: David Litchfield [ mark at ngssoftware.com ]
Relates to: http://www.nextgenss.com/advisories/db2-01.txt
Date of Public Advisory: 23rd December 2004
Advisory number: #NISR2122004J
Advisory URL: http://www.ngssoftware.com/advisories/db223122004K.txt

Description
***********
IBM's DB2 database server contains a function, rec2xml, used to format a
string in XML. This function suffers from a stack based buffer overflow
vulnerability.

Details
*******
By passing an overly long 3rd parameter to the rec2xml function a stack
based buffer can be overflowed, overwriting the saved return address on the
stack. This allows an attacker to control the flow of execution and the
opportunity to execute arbitrary code.

Fix Information
***************
IBM has written a patch and can be obtained with the latest fixpak.

http://www-306.ibm.com/software/data/db2/udb/support/downloadv8.html - DB2
v8.1
http://www-306.ibm.com/software/data/db2/udb/support/downloadv7.html - DB2
v7.x

NGSSQuirreL for DB2 (http://www.nextgenss.com/db2.htm) can be used to assess
whether your DB2 server is vulnerable to this.

- -------------------------------------------------------------------------------


- --------------------------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.

NOTE: Third Party Rights
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 follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.

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 computer system has been compromised or attacked in 
any way, we encourage you to let us know by completing the secure National IT 
Incident Reporting Form at:

        http://www.auscert.org.au/render.html?it=3192

===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072

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-----
Comment: http://www.auscert.org.au/render.html?it=1967

iQCVAwUBQecJTyh9+71yA2DNAQK/eAP+NjA7kbU/Ww+ubvKyfJua59qfXoeiTtCu
RBoJvQIDFs+Z8r+iHbLo6aU1HQA9xBzkD+0Ulz46Zov5fFE9zaFnMgohgKCGOV/k
eceLDm+0cNHz30LZdvoErZXVhbKcC71QO31EewEWWwk4cqZbiHqWBzpI1UXErP8j
wRuglaFJcxo=
=vrEC
-----END PGP SIGNATURE-----