-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

                               ESB-2012.1008
Security Bulletin: Buffer Overflow Vulnerability in IBM DB2 SQL/PSM Stored
                 Procedure Infrastructure (CVE-2012-4826).
                              19 October 2012

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

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

Product:           IBM DB2
Publisher:         IBM
Operating System:  Linux variants
                   AIX
                   HP-UX
                   Solaris
                   Windows
Impact/Access:     Execute Arbitrary Code/Commands -- Existing Account
Resolution:        Patch/Upgrade
CVE Names:         CVE-2012-4826  

Reference:         ESB-2012.1005

Original Bulletin: 
   http://www-01.ibm.com/support/docview.wss?uid=swg21614536

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

Security Bulletin: Buffer Overflow Vulnerability in IBM DB2 SQL/PSM Stored 
Procedure Infrastructure (CVE-2012-4826). 

Flash (Alert)

Document information
DB2 for Linux, UNIX and Windows

Application Programming - SQL Routines (SQL stored procedures)

Software version:
9.1, 9.5, 9.7, 9.8, 10.1

Operating system(s):
AIX, HP-UX, Linux, Linux iSeries, Linux pSeries, Linux zSeries, Solaris,
Windows

Software edition:
Advanced Enterprise Server, Enterprise Server, Express, Express-C, Personal, 
Workgroup Server

Reference #:
1614536

Modified date:
2012-10-18

Abstract

Vulnerability in IBM DB2 could allow an authenticated user to cause a 
stack-based buffer overflow and possibly attain remote code execution. 

Content

VULNERABILITY DETAILS

CVE ID: CVE-2012-4826

DESCRIPTION:

The IBM DB2 products listed below contain a security vulnerability that could
allow an authenticated user to exploit a vulnerability in DB2's SQL/Persistent
Stored Module (PSM) Stored Procedure (SP) infrastructure to cause a 
stack-based buffer overflow and possibly attain remote code execution.

To exploit the vulnerability the malicious user would need: 
1. A valid credential to connect to database 
2. CONNECT privilege on database 
3. Privileges to debug an SQL/PSM.

The vulnerability is in the DB2's SQL/PSM debugging infrastructure and as such
requires that the attacker have the privilege to debug a debuggable SQL/PSM 
stored procedure.

By default, a general user has all the privileges required to create and 
deploy a debuggable SQL/PSM SP. Revoking EXECUTE privilege on 
SYSPROC.PSMD_SET_COMPILEMODE from PUBLIC will prevent a general user from 
deploying a debuggable SQL/PSM SP. If there already exists debuggable SQL/PSM
Stored Procedures then the only prevention is to drop and recreate them 
without debug mode enabled.

CVSS: 
CVSS Base Score: 8.5 
CVSS Temporal Score: See http://xforce.iss.net/xforce/xfdb/78817 for the 
current score 
CVSS Environmental Score*: Undefined 
CVSS String: (AV:N/AC:M/Au:S/C:C/I:C/A:C)

AFFECTED PLATFORMS:

The following IBM DB2 V9.1, V9.5, V9.7 and V10.1 editions running on AIX, 
Linux, HP, Solaris and Windows:

IBM DB2 10.1 Express Edition
IBM DB2 10.1 Workgroup Server Edition
IBM DB2 10.1 Enterprise Server Edition
IBM DB2 10.1 Advanced Enterprise Server Edition
IBM DB2 Connect 10.1 Application Server Edition
IBM DB2 Connect 10.1 Enterprise Edition
IBM DB2 Connect 10.1 Unlimited Edition for System i
IBM DB2 Connect 10.1 Unlimited Edition for System z

IBM DB2 9.7 Express Edition
IBM DB2 9.7 Workgroup Server Edition
IBM DB2 9.7 Enterprise Server Edition
IBM DB2 9.7 Advanced Enterprise Server Edition
IBM DB2 Connect 9.7 Application Server Edition
IBM DB2 Connect 9.7 Enterprise Edition
IBM DB2 Connect 9.7 Unlimited Edition for System i
IBM DB2 Connect 9.7 Unlimited Edition for System z

IBM DB2 9.5 Express Edition
IBM DB2 9.5 Workgroup Server Edition
IBM DB2 9.5 Enterprise Server Edition
IBM DB2 9.5 Advanced Enterprise Server Edition
IBM DB2 Connect 9.5 Application Server Edition
IBM DB2 Connect 9.5 Enterprise Edition
IBM DB2 Connect 9.5 Unlimited Edition for System i
IBM DB2 Connect 9.5 Unlimited Edition for System z

IBM DB2 9.1 Express Edition
IBM DB2 9.1 Workgroup Server Edition
IBM DB2 9.1 Enterprise Server Edition
IBM DB2 9.1 Advanced Enterprise Server Edition
IBM DB2 Connect 9.1 Application Server Edition
IBM DB2 Connect 9.1 Enterprise Edition
IBM DB2 Connect 9.1 Unlimited Edition for System i
IBM DB2 Connect 9.1 Unlimited Edition for System z

NOTE: The DB2 Connect products mentioned are affected only if a local database
has been created. NOTE: DB2 V9.1 has reached End-of-Service.

The following IBM V9.8 editions running on AIX and Linux:

IBM DB2 pureScale Feature for Enterprise Server Edition

REMEDIATION: The recommended solution is to apply the appropriate fix for this
vulnerability. Mitigation is also available.

Fix: The fix for this vulnerability for DB2 V9.7 is in Fix Pack 7 and is 
available for download. For DB2 V9.5, V9.8 and V10.1, the fix is planned to be
made available in future fix packs.

In general, DB2 fix packs can be downloaded from the following site: 
http://www-01.ibm.com/support/docview.wss?uid=swg27007053. You may download 
the specific fix pack you need from the following:

Release 	APAR 		Download URL 
V9.1 FP12 	IC87192 	Please contact technical support.
V9.5 		IC86765 	Not available. Please contact technical 
				support. 
V9.7 FP7 	IC86781		<Alvin will update this with the TBD URL 
				before publishing> 
V9.8 		IC86782 	Not available. Please contact technical 
				support. 
V10.1 		IC86783 	Not available. Please contact technical 
				support.

A special build with the interim fix will be made available for DB2 V9.5 FP10,
V9.8 FP5 and V10.1 FP1. Please contact your service representative to obtain 
the special build and reference the APAR number for the release you want.

A special build with the fix will be made available in DB2 V9.1 FP12 for 
customers with a valid extended support contract. Please contact your service
representative to obtain the special build and reference APAR IC87192.

Contact Technical Support:
In the United States and Canada dial 1-800-IBM-SERV View the support contacts
for other countries outside of the United States. Electronically open a 
Service Request with DB2 Technical Support.

Workaround 
None known.

Mitigation: 
To prevent existing debuggable SQL/PSM stored procedures from 
being exploited, you need to search for debuggable SQL/PSM SP, then drop and 
recreate them without debug mode enabled. You can search for debuggable 
SQL/PSM SP with the following SELECT statement:

SELECT ROUTINESCHEMA, ROUTINENAME FROM SYSCAT.ROUTINES WHERE 
DEBUG_MODE='ALLOW'

To prevent the general user from creating their own debuggable SQL/PSM SP, you
need to execute the following statement to prevent SQL/PSM SP from being 
deployed in debug mode:

REVOKE EXECUTE ON PROCEDURE SYSPROC.PSMD_SET_COMPILEMODE FROM PUBLIC RESTRICT

Grant EXECUTE privilege on SYSPROC.PSMD_SET_COMPILEMODE to only those uses 
that you trust.

REFERENCES:

Complete CVSS Guide 
On-line Calculator V2 
X-Force Vulnerability Database 
CVE-2012-4826

ACKNOWLEDGEMENT: 
This vulnerability was reported to IBM by Martin Rakhmanov of Application 
Security Inc.

CHANGE HISTORY: 
October 17, 2012: Document created.

*The CVSS Environment Score is customer environment specific and will 
ultimately impact the Overall CVSS Score. Customers can evaluate the impact of
this vulnerability in their environments by accessing the links in the 
Reference section of this Flash.

Note: According to the Forum of Incident Response and Security Teams (FIRST),
the Common Vulnerability Scoring System (CVSS) is an "industry open standard 
designed to convey vulnerability severity and help to determine urgency and 
priority of response." IBM PROVIDES THE CVSS SCORES "AS IS" WITHOUT WARRANTY 
OF ANY KIND, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS

Note: IBMs statements regarding its plans, directions, and intent are subject
to change or withdrawal without notice at IBMs sole discretion. Information 
regarding potential future products is intended to outline our general product
direction and it should not be relied on in making a purchasing decision. The
information mentioned regarding potential future products is not a commitment,
promise, or legal obligation to deliver any material, code or functionality. 
Information about potential future products may not be incorporated into any 
contract. The development, release, and timing of any future features or 
functionality described for our products remains at our sole discretion.

Cross reference information Segment Product Component Platform Version Edition
Information Management Data Studio Stored Procedure and UDF Development 
Information Management DB2 Connect

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business 
Machines Corp., registered in many jurisdictions worldwide. Other product and
service names might be trademarks of IBM or other companies. A current list of
IBM trademarks is available on the Web at "Copyright and trademark 
information" at www.ibm.com/legal/copytrade.shtml.

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

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

iQIVAwUBUIDjie4yVqjM2NGpAQLSuw//YPhg4FdX/3yi6klUjE65xvv0JQDDkvhK
gxocW/ZWoHZVJWeGOGCmgyHNj2neeXU6YSy5yWjmWACK8FCbcva9N6iKff1Isy/u
nAKgcIb3UBK3FdRe6umW15f/crwLUUghf8GV28I15/2q3e+0XXfEJP5PN7kXMIt5
MgMxJvUf7UPSnQDi9dQhggGj8KHeJLX1m4a4m9As/MvyPkbhM3kwZC6KHP9zP+qg
QQ9vCgXnfaOSgpv6j6/NRjwcRjo6Lqr7gC4JwI8Z00f6jhpGGYYopgAwTXD/8g9w
EEn3hz5pVYL+eRUNQouCVVvXkOmhq0kD8VR8UYxomVFwQABKBYimT6x6Pd/RQxep
oBqt2oMYH5V9VsbGMFTZY92O+bkdq0F87u6lwnfcgbMDP1RsHARDlZ0ox5KacScD
qWrosQG+XWIncVwX5xJPbA02ZkpfWmhFGnu20UCmR6FvRAQlQilTlaEjDMabqVjS
NBT447wqSDRQfj+/lAWH96vShJAhKHsa4aboXia2iwG7H1fwWVmKLEvM7MKKizbZ
f6dCuKsP0hg7h9ELN6GS0qN15s52FOPnSaYve/muehAXwl48tRN8ioAbmLRMSKdx
lYJnGTizd+qhdkbriFM8hIu2eIZvWvxFSqQG6Mmy13BGt//d4yyyNYQVlitKR2PZ
i8f1RF6yKm8=
=4RgR
-----END PGP SIGNATURE-----