Lucene search

K
securityvulnsSecurityvulnsSECURITYVULNS:DOC:21335
HistoryFeb 11, 2009 - 12:00 a.m.

Microsoft Security Bulletin MS09-004 - Important Vulnerability in Microsoft SQL Server Could Allow Remote Code Execution (959420) Published: February 10, 2009

2009-02-1100:00:00
vulners.com
60

Microsoft Security Bulletin MS09-004 - Important
Vulnerability in Microsoft SQL Server Could Allow Remote Code Execution (959420)
Published: February 10, 2009

Version: 1.0
General Information
Executive Summary

This security update resolves a privately reported vulnerability in Microsoft SQL Server. The vulnerability could allow remote code execution if untrusted users access an affected system or if a SQL injection attack occurs to an affected system. Systems with SQL Server 7.0 Service Pack 4, SQL Server 2005 Service Pack 3, and SQL Server 2008 are not affected by this issue.

This security update is rated Important for supported releases of SQL Server 2000, SQL Server 2005 Service Pack 2, Microsoft SQL Server 2000 Desktop Engine (MSDE 2000), SQL Server 2005 Express Edition, Microsoft SQL Server 2000 Desktop Engine (WMSDE), and Windows Internal Database (WYukon). For more information, see the subsection, Affected and Non-Affected Software, in this section.

The security update addresses the vulnerability by validating input parameters passed to an extended stored procedure. For more information about the vulnerability, see the Frequently Asked Questions (FAQ) subsection for the specific vulnerability entry under the next section, Vulnerability Information.

This security update also addresses the vulnerability first described in Microsoft Security Advisory 961040.

Recommendation. Microsoft recommends that customers apply the update at the earliest opportunity.

Known Issues. Microsoft Knowledge Base Article 959420 documents the currently known issues that customers may experience when installing this security update. The article also documents recommended solutions for these issues.
Top of sectionTop of section
Affected and Non-Affected Software

The following software have been tested to determine which versions or editions are affected. Other versions or editions are either past their support life cycle or are not affected. To determine the support life cycle for your software version or edition, visit Microsoft Support Lifecycle.

SQL Server
GDR Software Updates QFE Software Updates Maximum Security Impact Aggregate Severity Rating Bulletins Replaced by this Update

SQL Server 2000 Service Pack 4
(KB960082)

SQL Server 2000 Service Pack 4
(KB960083)

Remote Code Execution

Important

MS08-040

SQL Server 2000 Itanium-based Edition Service Pack 4
(KB960082)

SQL Server 2000 Itanium-based Edition Service Pack 4
(KB960083)

Remote Code Execution

Important

MS08-040

SQL Server 2005 Service Pack 2
(KB960089)

SQL Server 2005 Service Pack 2
(KB960090)

Remote Code Execution

Important

MS08-052

SQL Server 2005 x64 Edition Service Pack 2
(KB960089)

SQL Server 2005 x64 Edition Service Pack 2
(KB960090)

Remote Code Execution

Important

MS08-052

SQL Server 2005 with SP2 for Itanium-based Systems
(KB960089)

SQL Server 2005 with SP2 for Itanium-based Systems
(KB960090)

Remote Code Execution

Important

MS08-052

Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) Service Pack 4
(KB960082)

Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) Service Pack 4
(KB960083)

Remote Code Execution

Important

MS08-040

SQL Server 2005 Express Edition Service Pack 2
(KB960089)

SQL Server 2005 Express Edition Service Pack 2
(KB960090)

Remote Code Execution

Important

MS08-052

SQL Server 2005 Express Edition with Advanced Services Service Pack 2
(KB960089)

SQL Server 2005 Express Edition with Advanced Services Service Pack 2
(KB960090)

Remote Code Execution

Important

MS08-052

Windows Components
Operating System Component Maximum Security Impact Aggregate Severity Rating Bulletins Replaced by this Update

Windows Server 2003 Service Pack 1 and Windows Server 2003 Service Pack 2

Microsoft SQL Server 2000 Desktop Engine (WMSDE)
(KB960082)

Remote Code Execution

Important

MS08-040

Windows Server 2003 Service Pack 1 and Windows Server 2003 Service Pack 2

Windows Internal Database (WYukon) Service Pack 2
(KB960089)

Remote Code Execution

Important

MS08-040

Windows Server 2003 x64 Edition and Windows Server 2003 x64 Edition Service Pack 2

Microsoft SQL Server 2000 Desktop Engine (WMSDE)
(KB960082)

Remote Code Execution

Important

MS08-040

Windows Server 2003 x64 Edition and Windows Server 2003 x64 Edition Service Pack 2

Windows Internal Database (WYukon) x64 Edition Service Pack 2
(KB960089)

Remote Code Execution

Important

MS08-040

Windows Server 2008 for 32-bit Systems*

Windows Internal Database (WYukon) Service Pack 2
(KB960089)

Remote Code Execution

Important

MS08-040

Windows Server 2008 for x64-based Systems*

Windows Internal Database (WYukon) x64 Edition Service Pack 2
(KB960089)

Remote Code Execution

Important

MS08-040

*Windows Server 2008 server core installation affected. For supported editions of Windows Server 2008, this update applies, with the same severity rating, whether or not Windows Server 2008 was installed using the Server Core installation option. For more information on this installation option, see Server Core. Note that the Server Core installation option does not apply to certain editions of Windows Server 2008; see Compare Server Core Installation Options.

Non-Affected Software
Software Component

SQL Server 7.0 Service Pack 4

Not applicable

Microsoft Data Engine (MSDE) 1.0 Service Pack 4

Not applicable

SQL Server 2005 Service Pack 3

Not applicable

Application Center 2000 Service Pack 2

Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) Service Pack 3a

SQL Server 2005 x64 Edition Service Pack 3

Not applicable

SQL Server 2005 with SP3 for Itanium-based Systems

Not applicable

SQL Server 2008 (32-bit editions)

Not applicable

SQL Server 2008 (x64-based editions)

Not applicable

SQL Server 2008 (Itanium-based editions)

Not applicable
Top of sectionTop of section

Frequently Asked Questions (FAQ) Related to This Security Update

Where are the file information details?
The file information details can be found in Microsoft Knowledge Base Article 959420.

There are both GDR and QFE updates offered for my version of SQL. How do I know which update to use?
First, determine your SQL Server version number. For more information on determining your SQL Server version number, see Microsoft Knowledge Base Article 321185.

Second, in the table below, locate the version range that your SQL Server version number falls within. The corresponding update is the update you need to install.

Note If your SQL Server version number does not fall within any of the ranges in the table below, your SQL Server version is no longer supported. Please upgrade to the latest Service Pack or SQL Server product in order to apply this and future security updates.
SQL Server Version Range

8.00.2039-8.00.2054

8.00.2148-8.00.2281

9.00.3042-9.00.3076

9.00.3150-9.00.3310
SQL Server

SQL Server 2000 GDR and MSDE 2000
(KB960082)

SQL Server 2000 QFE and MSDE 2000
(KB960083)

SQL Server 2005 GDR
(KB960089)

SQL Server 2005 QFE
(KB960090)

For additional installation instructions, see the Security Update Information subsection for your SQL Server edition in the Update Information section.

Will the update be offered to SQL Server clusters?
Yes. The update will also be offered to SQL Server 2000 and SQL Server 2005 instances that are clustered. Updates for SQL Server clusters will require user interaction.

If your SQL Server 2000 or SQL Server 2005 cluster has a passive node, Microsoft recommends that you scan and apply the update to the active node first, and then scan and apply to the passive node. When all components have been updated on the passive node, the update will no longer be offered.

The reference tables for SQL Server 2000 and MSDE 2000 in the Security Update Information section show that some updates may require a restart. How can I tell if my update will require a restart?
For SQL Server 2000 and MSDE 2000, it is possible to have dependent services. Dependent services are not restarted after the service they are dependent on is stopped and restarted. For this reason, a restart should be performed after a successful install to ensure that dependent services are started. For more information on determining whether you are running dependent services, see Microsoft Knowledge Base Article 953741.

Will the updates be applied to disabled instances of SQL Server 2000, MSDE 2000, and SQL Server 2005?
No. Only those instances of SQL Server 2000, MSDE 2000, and SQL Server 2005 that do not have a Startup type of disabled will be updated by the installer. For more information on disabled services, see Microsoft Knowledge Base Article 953740.

I am using an older version of the software discussed in this security bulletin. What should I do?
The affected software listed in this bulletin have been tested to determine which versions or editions are affected. Other versions or editions are past their support life cycle. To determine the support life cycle for your software version or edition, visit Microsoft Support Lifecycle.

It should be a priority for customers who have older versions or editions of the software to migrate to supported versions or editions to prevent potential exposure to vulnerabilities. For more information about the Windows Product Lifecycle, visit Microsoft Support Lifecycle. For more information about the extended security update support period for these software versions or editions, visit Microsoft Product Support Services.

Customers who require custom support for older software must contact their Microsoft account team representative, their Technical Account Manager, or the appropriate Microsoft partner representative for custom support options. Customers without an Alliance, Premier, or Authorized Contract can contact their local Microsoft sales office. For contact information, visit Microsoft Worldwide Information, select the country, and then click Go to see a list of telephone numbers. When you call, ask to speak with the local Premier Support sales manager. For more information, see the Windows Operating System Product Support Lifecycle FAQ.
Top of sectionTop of section
Vulnerability Information

Severity Ratings and Vulnerability Identifiers

The following severity ratings assume the potential maximum impact of the vulnerability. For information regarding the likelihood, within 30 days of this security bulletin's release, of the exploitability of the vulnerability in relation to its severity rating and security impact, please see the Exploitability Index in the February bulletin summary. For more information, see Microsoft Exploitability Index.
Vulnerability Severity Rating and Maximum Security Impact by Affected Software
Affected Software SQL Server sp_replwritetovarbin Limited Memory Overwrite Vulnerability - CVE-2008-5416 Aggregate Severity Rating
SQL Server

SQL Server 2000 Service Pack 4

Important
Remote Code Execution

Important

SQL Server 2000 Itanium-based Edition Service Pack 4

Important
Remote Code Execution

Important

SQL Server 2005 Service Pack 2

Important
Remote Code Execution

Important

SQL Server 2005 x64 Edition Service Pack 2

Important
Remote Code Execution

Important

SQL Server 2005 with SP2 for Itanium-based Systems

Important
Remote Code Execution

Important

Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) Service Pack 4

Important
Remote Code Execution

Important

SQL Server 2005 Express Edition Service Pack 2

Important
Remote Code Execution

Important

SQL Server 2005 Express Edition with Advanced Services Service Pack 2

Important
Remote Code Execution

Important
Windows Components

Microsoft SQL Server 2000 Desktop Engine (WMSDE)

Important
Remote Code Execution

Important

Windows Internal Database (WYukon) Service Pack 2

Important
Remote Code Execution

Important

Windows Internal Database (WYukon) x64 Edition Service Pack 2

Important
Remote Code Execution

Important
Top of sectionTop of section

SQL Server sp_replwritetovarbin Limited Memory Overwrite Vulnerability - CVE-2008-5416

A remote code execution vulnerability exists in the way that SQL Server checks parameters in the "sp_replwritetovarbin" extended stored procedure. The vulnerability could allow remote code execution if untrusted users have access to an affected system or if a SQL injection vulnerability exists on an affected system. An attacker who successfully exploited this vulnerability could take complete control of an affected system. An attacker could then install programs; view, change, or delete data; or create new accounts.

To view this vulnerability as a standard entry in the Common Vulnerabilities and Exposures list, see CVE-2008-5416.

Mitigating Factors for SQL Server sp_replwritetovarbin Limited Memory Overwrite Vulnerability - CVE-2008-5416

Mitigation refers to a setting, common configuration, or general best-practice, existing in a default state, that could reduce the severity of exploitation of a vulnerability. The following mitigating factors may be helpful in your situation:
ā€¢

This issue does not affect supported editions of Microsoft SQL Server 7.0 Service Pack 4, Microsoft SQL Server 2005 Service Pack 3, and Microsoft SQL Server 2008.
ā€¢

This vulnerability is not exposed anonymously. An attacker would need to either authenticate to exploit the vulnerability or take advantage of a SQL injection vulnerability in a Web application that is able to authenticate.
ā€¢

By default, MSDE 2000 and SQL Server 2005 Express do not allow remote connections. An authenticated attacker would need to initiate the attack locally to exploit the vulnerability.
Top of sectionTop of section

Workarounds for SQL Server sp_replwritetovarbin Limited Memory Overwrite Vulnerability - CVE-2008-5416

Workaround refers to a setting or configuration change that does not correct the underlying vulnerability but would help block known attack vectors before you apply the update. Microsoft has tested the following workarounds and states in the discussion whether a workaround reduces functionality:
ā€¢

Deny permissions on the sp_replwritetovarbin extended stored procedure

Use one of the following procedures:
ā€¢

To deny access to the stored procedure, connect to SQL Server as a sysadmin using osql.exe or sqlcmd.exe or through SQL Server Management Studio and execute the following T-SQL script:

use master
deny execute on sp_replwritetovarbin to public

ā€¢

To deny access to the stored procedure using SQL Server administration:
ā€¢

For SQL Server 2000:

Connect to SQL Server using Enterprise Manager as a sysadmin

From the SQL Server Enterprise Manager window, select the desired server

Expand the databases

Expand Master

Click Extended Stored Procedures. A list of stored procedures appears.

From the list of stored procedures, right-click sp_replwritetovarbin and select Properties

In the Properties window, click Permissions

Under Users/Database Roles/Public, find Public, then click the box in the EXEC column. The box turns into a red X.

Click OK twice
ā€¢

For SQL Server 2005:

Connect to SQL Server using SQL Server Management Studio as a sysadmin

From the Object Explorer window, select the desired server

Expand the databases and the system databases

Expand Master

Expand Programmability

Click Extended Stored Procedures. A list of stored procedures appears.

From the list of stored procedures, right-click sp_replwritetovarbin and select Properties

In the Properties window, click Permissions

Click Deny execution beside the desired user IDs and click OK
ā€¢

To apply the workaround to all running instances of SQL Server on a local computer, a VB script is available and has been previously provided in Microsoft Security Advisory 961040.

Impact of Workaround: Disabling the sp_replwritetovarbin extended stored procedure prevents updates to subscription tables by all users. The impact of this workaround only affects customers that use transactional replication with updatable subscriptions. Customers using transactional replication with read-only subscriptions, bi-directional transactional replication, or peer-to-peer transactional replication are not impacted. For more information on transactional replication with updatable subscriptions, see MSDN.

How to undo the workaround
ā€¢

Connect to SQL Server as a sysadmin using osql.exe or sqlcmd.exe or through SQL Server Management Studio and execute the following T-SQL script:

use master
grant execute on sp_replwritetovarbin to public

ā€¢

To restore access to the stored procedure via SQL Server administration:
ā€¢

For SQL Server 2000:

Connect to SQL Server using Enterprise Manager as a sysadmin

From the SQL Server Enterprise Manager window, select the desired server

Expand the databases

Expand Master

Click Extended Stored Procedures. A list of stored procedures appears.

From the list of stored procedures, right-click sp_replwritetovarbin and select Properties

In the Properties window, click Permissions

Under Users/Database Roles/Public, find Public, then click the box in the EXEC column. The box turns into a green checkmark.

Click OK twice
ā€¢

For SQL Server 2005:

Connect to SQL Server using SQL Server Management Studio as a sysadmin

From the Object Explorer window, select the desired server

Expand the databases and the system databases

Expand Master

Expand Programmability

Click Extended Stored Procedures. A list of stored procedures appears.

From the list of stored procedures, right-click sp_replwritetovarbin and select Properties

In the Properties window, click Permissions

Click Grant execution beside the desired user IDs and click OK
Top of sectionTop of section

FAQ for SQL Server sp_replwritetovarbin Limited Memory Overwrite Vulnerability - CVE-2008-5416

What is the scope of the vulnerability?
This is a remote code execution vulnerability. An attacker who successfully exploited this vulnerability could take complete control of an affected system. An attacker could then install programs; view, change, or delete data; or create new accounts with full user rights.

What causes the vulnerability?
An authenticated remote code execution vulnerability exists in the MSSQL extended stored procedure, "sp_replwritetovarbin," due to an invalid parameter check.

What is the sp_replwritetovarbin extended stored procedure used for?
The sp_replwritetovarbin extended stored procedure is used by transactional replication with updatable subscribers and only when the subscription is created with @update_mode = 'failover' or 'queued tran'.

What might an attacker use the vulnerability to do?
An attacker who successfully exploited this vulnerability could run arbitrary code. An attacker could then install programs; view, change, or delete data; or create new accounts with full user rights.

How could an attacker exploit the vulnerability?
An attacker could create a query that calls the vulnerable extended stored procedure with an invalid parameter, causing the heap to overflow, allowing code execution.

What systems are primarily at risk from the vulnerability?
Servers configured to allow untrusted users to load and execute queries are at most risk from exploitation of this vulnerability.

Clients and applications that utilize MSDE 2000 or SQL Server 2005 Express are at risk of remote attack if they have modified the default installation to accept remote connections, if they allow untrusted users access to MSDE 2000 or SQL Server 2005 Express, or if an application that uses MSDE 2000 or SQL Server 2005 Express has a SQL Injection vulnerability.

All systems running one of the affected versions of Microsoft SQL Server software where a malicious user is allowed to log on are at risk of exploitation of this vulnerability. In addition, Web applications with a SQL Server back-end database are at risk if a SQL Injection vulnerability exists. For more information on SQL Injection, see Microsoft Security Advisory 954462.

What does the update do?
The update eliminates the vulnerability by correctly validating the input parameters passed to the extended stored procedure.

When this security bulletin was issued, had this vulnerability been publicly disclosed?
Yes. This vulnerability has been publicly disclosed. It has been assigned Common Vulnerability and Exposure number CVE-2008-5416. This vulnerability was first described in Microsoft Security Advisory 961040.

When this security bulletin was issued, had Microsoft received any reports that this vulnerability was being exploited?
No. Microsoft had seen examples of proof of concept code published publicly but had not received any information to indicate that this vulnerability had been publicly used to attack customers when this security bulletin was originally issued.

Other Information
Acknowledgments

Microsoft thanks the following for working with us to help protect customers:
ā€¢

Bernhard Mueller of SEC Consult Vulnerability Lab for reporting the SQL Server sp_replwritetovarbin Limited Memory Overwrite Vulnerability (CVE-2008-5416)
Top of sectionTop of section
Microsoft Active Protections Program (MAPP)

To improve security protections for customers, Microsoft provides vulnerability information to major security software providers in advance of each monthly security update release. Security software providers can then use this vulnerability information to provide updated protections to customers via their security software or devices, such as antivirus, network-based intrusion detection systems, or host-based intrusion prevention systems. To determine whether active protections are available from security software providers, please visit the active protections Web sites provided by program partners, listed in Microsoft Active Protections Program (MAPP) Partners.

Support
ā€¢

Customers in the U.S. and Canada can receive technical support from Microsoft Product Support Services at 1-866-PCSAFETY. There is no charge for support calls that are associated with security updates.
ā€¢

International customers can receive support from their local Microsoft subsidiaries. There is no charge for support that is associated with security updates. For more information about how to contact Microsoft for support issues, visit the International Support Web site.

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 (February 10, 2009): Bulletin published.