Security Bulletin

Microsoft Security Bulletin MS02-040 - Critical

Unchecked Buffer in MDAC Function Could Enable System Compromise (Q326573)

Published: July 31, 2002 | Updated: August 20, 2003

Version: 2.0

Originally posted: July 31, 2002

Updated: August 20, 2003

Summary

Who should read this bulletin: Customers using Microsoft® Windows®.

Impact of vulnerability: Run code of the attacker's choice.

Maximum Severity Rating: Critical

Recommendation: Users should install the security patch immediately.

Affected Software:

  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7

General Information

Technical details

Technical description:

Subsequent to the release of this bulletin, it was determined that the vulnerability addressed is not with the OpenRowSet command (which is a Microsoft SQL Server command) but rather that the vulnerability is with the underlying MDAC component Open Database Connectivity (ODBC), which is present in all versions of Windows. Additionally, the original patch released with this did not install correctly on some systems because of a flaw in the way that Microsoft Windows Installer updated the System File Protection cache. The bulletin has been updated to include this additional information and to direct users to an updated patch.

Note: The patch for this security bulletin has been superceded by the patch in MS03-033. Customers who are seeking the patch for MS02-040 should instead install the patch for MS03-033.

MDAC is a collection of components that are used to provide database connectivity on Windows platforms. MDAC is a ubiquitous technology, and it is likely to be present on most Windows systems:

  • By default, MDAC is included as part of Microsoft Windows XP, Windows 2000, and Windows Millennium Edition.
  • MDAC is available for download as a stand-alone technology.
  • MDAC is either included in or installed by a number of other products and technologies. For example, MDAC is included in the Microsoft Windows NT® 4.0 Option Pack, as part of Microsoft Access, and as part of SQL Server. Some MDAC components are also present as part of Microsoft Internet Explorer even if MDAC itself is not installed.

MDAC provides the underlying functionality for a number of database operations, such as connecting to remote databases and returning data to a client. Specifically, it is the MDAC component known as Open Database Connectivity (ODBC) that provides this functionality.

A security vulnerability results because one of the ODBC functions in MDAC that is used to connect to data sources contains an unchecked buffer. An attacker could seek to exploit the vulnerability by constructing a Web page that, when visited by the user, could execute code of the attacker's choice with the user's privileges. The Web page could be hosted on a Web site or sent directly to the user in an e-mail message.

In the case of a system that is running SQL Server, an attacker could seek to exploit this vulnerability by using the Transact-SQL OpenRowSet command. An attacker who submits a database query that contains a specially-malformed parameter within a call to OpenRowSet could overrun the buffer, either to cause the computer that is running SQL Server to fail or to cause the computer that is running SQL Server to take actions that are dictated by the attacker.

Mitigating factors:

  • Users who read e-mail messages as plain text would have to take an action before an attacker could exploit the vulnerability to be exploited.
  • Systems that are configured to disable active scripting in Internet Explorer are not affected by this vulnerability.
  • In the Web-based attack scenario, a user would need to visit a malicious web site under the control of an attacker. An attacker would have no way to force users to visit a malicious Web site outside the HTML e-mail vector. Instead, an attacker would need to lure them there, typically by getting the user to click a link that took them to the attacker's site.
  • The privileges that are gained through a successful attack would be equal to those of the application under which ODBC is running. In most cases, an attacker would gain only the same level of privileges as the logged on user.
  • By default, Outlook Express 6.0 and Outlook 2002 open HTML mail in the Restricted Sites Zone. In addition, Outlook 98 and 2000 open HTML mail in the Restricted Sites Zone if the Outlook Email Security Update has been installed. Customers who use any of these products would be at no risk from an e-mail borne attack that attempted to exploit this vulnerability unless the user clicked a malicious link in the email.

Severity Rating:

MDAC 2.5 Critical
MDAC 2.6 Critical
MDAC 2.7 Critical

The above assessment is based on the types of systems that are affected by the vulnerability, their typical deployment patterns, and the effect that exploiting the vulnerability would have on them.

Vulnerability identifier: CVE-CAN-2002-0695

Tested Versions:

Microsoft tested MDAC 2.5, 2.6, and 2.7 to assess whether they are affected by these vulnerabilities. Previous versions are no longer supported and may or may not be affected by these vulnerabilities.

Frequently asked questions

Why is Microsoft reissuing this bulletin?
Subsequent to the release of this bulletin it was determined that the vulnerability is not in the OpenRowSet command, which is a SQL Server command. Rather, the vulnerability is with the underlying MDAC component ODBC, which is present in all versions of Windows. Additionally, the original patch did not install correctly on some systems because of a flaw in the way that Microsoft Windows Installer updated the System File Protection cache. The bulletin has been updated to include this additional information and to direct users to an updated patch.

The updated patch is included with the MS03-033 bulletin, not this bulletin. Why?
The original patch in this bulletin is superceded by the patch in MS03-033. The MS03-033 patch contains the fix for this vulnerability, as well as an additional security vulnerability that is discussed in MS03-033. Customers who are seeking the patch for MS02-040 should instead apply the patch from MS03-033.

What is the scope of this vulnerability?
This is a buffer overrun vulnerability. An attacker who successfully exploited this flaw could gain complete control over the affected process, thereby gaining the ability to take any action at the same level of privilege as the exploited ODBC process under which it is running. This could include creating, modifying, or deleting data on the system, or reconfiguring the system. This could also include reformatting the hard disk or running programs of the attacker's choice.

What causes the vulnerability?
The vulnerability results because a flaw in the Microsoft Data Access Components that provides some of the underlying functionality that is used to load an ODBC driver and to connect to a data source. This function contains an unchecked buffer. An attacker could seek to exploit this by using HTML e-mail or by using an ActiveX control. An attacker might seek to exploit this vulnerability by using this vector because some ActiveX controls provide access to MDAC functionality. Also, it could be possible to exploit this vulnerability on systems that are running SQL Server by using the Transact-SQL OpenRowSet command by submitting a database query that contains a specially malformed parameter within a call to OpenRowSet.

What is Microsoft Data Access Components?
Microsoft Data Access Components (MDAC) is a collection of components that make it easy for programs to access databases and then to manipulate the data within them. Modern databases may take a variety of forms (for example, SQL databases, Microsoft Access databases, and XML files) and may be housed in a variety of locations (for example, on the local system or on a remote database server). MDAC provides a consolidated set of functions for working with different kinds of data sources in a consistent manner. One of the MDAC components is known as ODBC.

What is ODBC?
ODBC (Open Database Connectivity) is a standard application programming interface (API) for accessing a data source. It is a component of MDAC and is an interface that allows applications to access data in any database for which there is an ODBC driver. By using ODBC, you can create database applications with access to any database for which an ODBC driver exists. Windows contains drivers for Microsoft Excel, Access, and SQL Server, for example.

What could an attacker do by exploiting the vulnerability?
It would depend on the specific way that the attacker overran the buffer. If the attacker provided input data that overran the buffer with random data, it could cause the attacker's application to fail, which would not pose a security risk to the user. On the other hand, if the attacker carefully selected the data, it would be possible to modify the functionality of MDAC to perform any task that the attacker specified.

  • An attacker could seek to exploit the vulnerability by constructing a Web page that, when visited by the user, would execute code of the attacker's choice with the logged on user's privileges. The Web page could be hosted on a Web site or sent directly to the user in an e-mail message.
  • It could also be possible to exploit this vulnerability using the Transact-SQL OpenRowSet command. An attacker could submit a database query that contains a specially malformed parameter within a call to OpenRowSet that could overrun the buffer, either to cause the server that is running SQL Server to fail or to cause the SQL Server service to take actions that are dictated by the attacker.

How do I know which version of the patch I need?
There is a patch for each supported version of MDAC. The following table shows which version of MDAC was supplied with various Microsoft products:

Version of MDAC Shipped in...
MDAC 2.5 Windows 2000, Office 2000 SR1 and later, SQL Server 7.0 Service Packs 2 and later
MDAC 2.6 SQL Server 2000
MDAC 2.7 Windows XP, Visual Studio .Net

A second way to determine the version of MDAC that you are using is to consult the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DataAccess registry key. The FullInstallVer key provides a value of the form x.xx.yyyy.y, where x.xx is the version number (for example, if the FullInstallVer value is 2.70.7713.0, MDAC 2.7 is installed on the system). A third way to determine the version of MDAC is to right-click the C:\Program Files\Common Files\System\Ado\Msado15.dll file, click Properties, click the Version tab, and then see the version information. The version information has the same format as that of the FullInstallVer value, x.xx.yyyy.y, where x.xx is the version number.

I see that MDAC was included with various versions of Windows and Office. Does this mean that anyone who is using these versions of Windows or Office needs the patch?
Yes. Because many different applications use the MDAC component ODBC, anyone who is using a product that included MDAC should apply the patch. MDAC is a ubiquitous technology that is included with many Microsoft products:

  • By default, MDAC is included as part of Microsoft Windows XP, Windows 2000, and Windows Millennium Edition.
  • MDAC is available for download as a stand-alone technology.
  • MDAC is either included in or installed by a number of other products and technologies. For example, MDAC is included in the Microsoft Windows NT® 4.0 Option Pack, as part of Microsoft Access, and as part of SQL Server. Some MDAC components are also present as part of Microsoft Internet Explorer even if MDAC itself is not installed.

A tool is also available that can help you determine what version of MDAC is running on your system. Microsoft Knowledge Base Article 307255 describes this tool and how to use it.

How does the patch eliminate the vulnerability?
The patch institutes proper buffer handling in the vulnerable function.

Patch availability

Download locations for this patch

This patch has been superceded by the patch in MS03-033. Users should apply MS03-033, which also contains a fix for an additional security vulnerability. Please refer to the "Patch Availability" section of MS03-033 for the download location of that patch.

Additional information about this patch

Installation platforms:

Please refer to the "Additional Information" section of MS03-033 for installation platform information for this patch.

Inclusion in future service packs:

The fix for this issue will be included in MDAC 2.5 Service Pack 5 and in MDAC 2.7 Service Pack 2. The fix is included in MDAC 2.8.

Reboot needed: Yes

Patch can be uninstalled: No

Superseded patches: None

Verifying patch installation:

Microsoft Knowledge Base article 326573 provides a file manifest that can be used to verify the patch installation.

Caveats:

This patch is superseded by the security patch for MS03-033. Users should apply the patch that is included in MS03-033.

Localization:

Localized versions of this patch are available at the locations that are discussed in the "Patch Availability" section of this bulletin.

Obtaining other security patches:

Patches for other security issues are available from the following locations:

  • Security patches are available from the Microsoft Download Center, and can be most easily found by doing a keyword search for "security_patch".
  • Patches for consumer platforms are available from the WindowsUpdate web site

Other information:

Acknowledgments

Microsoft thanks David Litchfield of Next Generation Security Software Ltd. for reporting this issue to us and working with us to protect customers.

Support:

  • Microsoft Knowledge Base article 326573 discusses this issue and will be available approximately 24 hours after the release of this bulletin. Knowledge Base articles can be found on the Microsoft Online Support web site.
  • Technical support is available from Microsoft Product Support Services. There is no charge for support calls associated with security patches.

Security Resources: The Microsoft TechNet Security Web Site provides additional information about security in Microsoft products.

Disclaimer:

The information provided in the Microsoft Knowledge Base is provided "as is" without warranty of any kind. Microsoft disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Microsoft Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Microsoft Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.

Revisions:

  • V1.0 (July 31, 2002): Bulletin Created.
  • V2.0 (August 20, 2003): Updated to reflect bulletin affects all versions of Windows and not just Microsoft SQL Server.

Built at 2014-04-18T13:49:36Z-07:00