Microsoft Security Bulletin MS09-004 - Important

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.

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.

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.

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.

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

Why was this bulletin revised on March 5, 2009?Microsoft revised this bulletin to announce a detection logic change to the update packages for Microsoft SQL Server 2000 Desktop Engine (WMSDE) on Windows Server 2003 Service Pack 1 and Windows Server 2003 Service Pack 2 (KB960082) and on Windows Server 2003 x64 Edition and Windows Server 2003 x64 Edition Service Pack 2 (KB960082). The detection logic change fixes an installation issue that would result in a failure for the Microsoft SQL Server 2000 Desktop Engine (WMSDE) update on systems with the Active Directory Migration Tool (ADMT) or Automated Deployment Services (ADS) installed. This is a deployment change only that does not affect the files contained in the initial update. Customers who have successfully updated their systems do not need to reinstall this update.

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

Vulnerability Information

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.

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.

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

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:

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:

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.

Finally, security updates can be downloaded from the Microsoft Update Catalog. The Microsoft Update Catalog provides a searchable catalog of content made available through Windows Update and Microsoft Update, including security updates, drivers and service packs. By searching using the security bulletin number (such as, “MS07-036”), you can add all of the applicable updates to your basket (including different languages for an update), and download to the folder of your choosing. For more information about the Microsoft Update Catalog, see the Microsoft Update Catalog FAQ.

Detection and Deployment Guidance

Microsoft has provided detection and deployment guidance for this month’s security updates. This guidance will also help IT professionals understand how they can use various tools to help deploy the security update, such as Windows Update, Microsoft Update, Office Update, the Microsoft Baseline Security Analyzer (MBSA), the Office Detection Tool, Microsoft Systems Management Server (SMS), and the Extended Security Update Inventory Tool. For more information, see Microsoft Knowledge Base Article 910723.

Microsoft Baseline Security Analyzer

Microsoft Baseline Security Analyzer (MBSA) allows administrators to scan local and remote systems for missing security updates as well as common security misconfigurations. For more information about MBSA, visit Microsoft Baseline Security Analyzer.

The following table provides the MBSA detection summary for this security update.

For SMS 2.0 and SMS 2003, the SMS SUS Feature Pack (SUSFP), which includes the Security Update Inventory Tool (SUIT), can be used by SMS to detect security updates. See also Downloads for Systems Management Server 2.0.

Updates often write to the same files and registry settings required for your applications to run. This can trigger incompatibilities and increase the time it takes to deploy security updates. You can streamline testing and validating Windows updates against installed applications with the Update Compatibility Evaluator components included with Application Compatibility Toolkit 5.0.

The Application Compatibility Toolkit (ACT) contains the necessary tools and documentation to evaluate and mitigate application compatibility issues before deploying Microsoft Windows Vista, a Windows Update, a Microsoft Security Update, or a new version of Windows Internet Explorer in your environment.

SQL2000-KB960082-v8.00.2055-x86-<language>.log or SQL2000-KB960083-v8.00.2282-x86-<language>.log

Special instructions

The update will also be offered to SQL Server 2000 instances that are clustered. Updates for SQL Server 2000 clusters will require user interaction.

If your SQL Server 2000 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.

Further information

See the subsection, Detection and Deployment Tools and Guidance

Restart Requirement

Restart required?

A restart is recommended after the update installation to restart any dependent services. For additional information, please see "How can I tell if my update will require a restart?" in the Update FAQ section of this bulletin. If a restart is required, the installer will prompt or return exit code 3010.

Unattended Setup mode. No user interaction is required, but installation status is displayed. If a restart is required at the end of Setup, a dialog box will be presented to the user with a timer warning that the computer will restart in 30 seconds.

/quiet

Quiet mode. This is the same as unattended mode, but no status or error messages are displayed.

Restart Options

/norestart

Does not restart when installation has completed

/forcerestart

Restarts the computer after installation and force other applications to close at shutdown without saving open files first.

/warnrestart[:x]

Presents a dialog box with a timer warning the user that the computer will restart in x seconds. (The default setting is 30 seconds.) Intended for use with the /quiet switch or the /passive switch.

/promptrestart

Display a dialog box prompting the local user to allow a restart

Special Options

/overwriteoem

Overwrites OEM files without prompting

/nobackup

Does not back up files needed for uninstall

/forceappsclose

Forces other programs to close when the computer shuts down

/log:path

Allows the redirection of installation log files

/integrate:path

Integrates the update into the Windows source files. These files are located at the path that is specified in the switch.

/allinstances

Applies update to all instances

/InstanceName={instance}

Applies update to specified instance

Note You can combine these switches into one command. For backward compatibility, the security update also supports many of the setup switches that the earlier version of the Setup program uses. For more information about the supported installation switches, see Microsoft Knowledge Base Article 262841. For more information about the Update.exe installer, visit the Microsoft TechNet Web site.

Removing the Update

This security update supports the following setup switches.

Supported Spuninst.exe Switches

Switch

Description

/help

Displays the command-line options

Setup Modes

/passive

Unattended Setup mode. No user interaction is required, but installation status is displayed. If a restart is required at the end of Setup, a dialog box will be presented to the user with a timer warning that the computer will restart in 30 seconds.

/quiet

Quiet mode. This is the same as unattended mode, but no status or error messages are displayed.

Restart Options

/norestart

Does not restart when installation has completed

/forcerestart

Restarts the computer after installation and force other applications to close at shutdown without saving open files first.

/warnrestart[:x]

Presents a dialog box with a timer warning the user that the computer will restart in x seconds. (The default setting is 30 seconds.) Intended for use with the /quiet switch or the /passive switch.

/promptrestart

Display a dialog box prompting the local user to allow a restart

Special Options

/forceappsclose

Forces other programs to close when the computer shuts down

/log:path

Allows the redirection of installation log files

/allinstances

Applies update to all instances

/InstanceName={instance}

Applies update to specified instance

Verifying that the Update Has Been Applied

Microsoft Baseline Security Analyzer

To verify that a security update has been applied to an affected system, you may be able to use the Microsoft Baseline Security Analyzer (MBSA) tool. See the section, Detection and Deployment Tools and Guidance, earlier in this bulletin for more information.

File Version Verification

Because there are several versions of Microsoft Windows, the following steps may be different on your computer. If they are, see your product documentation to complete these steps.

Click Start, and then click Search.

In the Search Results pane, click All files and folders under Search Companion.

In the All or part of the file name box, type a file name from the appropriate file information table, and then click Search.

In the list of files, right-click a file name from the appropriate file information table, and then click Properties.

Note Depending on the version of the operating system or programs installed, some of the files that are listed in the file information table may not be installed.

On the Version tab, determine the version of the file that is installed on your computer by comparing it to the version that is documented in the appropriate file information table.

Note Attributes other than the file version may change during installation. Comparing other file attributes to the information in the file information table is not a supported method of verifying that the update has been applied. Also, in certain cases, files may be renamed during installation. If the file or version information is not present, use one of the other available methods to verify update installation.

SQL Server 2005 (all editions)

Reference Table

The following table contains the security update information for this software. You can find additional information in the subsection, Deployment Information, in this section.

The update will also be offered to SQL Server 2005 instances that are clustered. Updates for SQL Server 2005 clusters will require user interaction.

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

Further information

See the subsection, Detection and Deployment Tools and Guidance

Restart Requirement

Restart required?

If a restart is required, the installer will prompt or return exit code 3010.

Prevents the Reporting Services database from being upgraded when the parameter equals 0

/allinstances

Applies update to all instances

/InstanceName={instance}

Applies update to specified instance

Note You can combine these switches into one command. For backward compatibility, the security update also supports many of the setup switches that the earlier version of the Setup program uses. For more information about the supported installation switches, see Microsoft Knowledge Base Article 262841. For more information about the Update.exe installer, visit the Microsoft TechNet Web site.

To verify that a security update has been applied to an affected system, you may be able to use the Microsoft Baseline Security Analyzer (MBSA) tool. See the section, Detection and Deployment Tools and Guidance, earlier in this bulletin for more information.

File Version Verification

Because there are several versions of Microsoft Windows, the following steps may be different on your computer. If they are, see your product documentation to complete these steps.

Click Start, and then click Search.

In the Search Results pane, click All files and folders under Search Companion.

In the All or part of the file name box, type a file name from the appropriate file information table, and then click Search.

In the list of files, right-click a file name from the appropriate file information table, and then click Properties.

Note Depending on the version of the operating system or programs installed, some of the files that are listed in the file information table may not be installed.

On the Version tab, determine the version of the file that is installed on your computer by comparing it to the version that is documented in the appropriate file information table.

Note Attributes other than the file version may change during installation. Comparing other file attributes to the information in the file information table is not a supported method of verifying that the update has been applied. Also, in certain cases, files may be renamed during installation. If the file or version information is not present, use one of the other available methods to verify update installation.

Microsoft SQL Server 2000 Desktop Engine (WMSDE) (all editions)

Reference Table

The following table contains the security update information for this software. You can find additional information in the subsection, Deployment Information, in this section.

Restarts the computer after installation and force other applications to close at shutdown without saving open files first.

/warnrestart[:x]

Presents a dialog box with a timer warning the user that the computer will restart in x seconds. (The default setting is 30 seconds.) Intended for use with the /quiet switch or the /passive switch.

/promptrestart

Display a dialog box prompting the local user to allow a restart

Special Options

/overwriteoem

Overwrites OEM files without prompting

/nobackup

Does not back up files needed for uninstall

/forceappsclose

Forces other programs to close when the computer shuts down

/log:path

Allows the redirection of installation log files

/integrate:path

Integrates the update into the Windows source files. These files are located at the path that is specified in the switch.

/extract[:path]

Extracts files without starting the Setup program

/ER

Enables extended error reporting

/verbose

Enables verbose logging. During installation, creates %Windir%\CabBuild.log. This log details the files that are copied. Using this switch may cause the installation to proceed more slowly.

/allinstances

Applies update to all instances

/InstanceName={instance}

Applies update to specified instance

Note You can combine these switches into one command. For backward compatibility, the security update also supports many of the setup switches that the earlier version of the Setup program uses. For more information about the supported installation switches, see Microsoft Knowledge Base Article 262841. For more information about the Update.exe installer, visit the Microsoft TechNet Web site.

Removing the Update

Note Removing this security update for WMSDE will completely remove the WMSDE instance from the system.

To verify that a security update has been applied to an affected system, you may be able to use the Microsoft Baseline Security Analyzer (MBSA) tool. See the section, Detection and Deployment Tools and Guidance, earlier in this bulletin for more information.

File Version Verification

Because there are several versions of Microsoft Windows, the following steps may be different on your computer. If they are, see your product documentation to complete these steps.

Click Start, and then click Search.

In the Search Results pane, click All files and folders under Search Companion.

In the All or part of the file name box, type a file name from the appropriate file information table, and then click Search.

In the list of files, right-click a file name from the appropriate file information table, and then click Properties.

Note Depending on the version of the operating system or programs installed, some of the files that are listed in the file information table may not be installed.

On the Version tab, determine the version of the file that is installed on your computer by comparing it to the version that is documented in the appropriate file information table.

Note Attributes other than the file version may change during installation. Comparing other file attributes to the information in the file information table is not a supported method of verifying that the update has been applied. Also, in certain cases, files may be renamed during installation. If the file or version information is not present, use one of the other available methods to verify update installation.

Windows Internal Database (WYukon) (all editions)

Reference Table

The following table contains the security update information for this software. You can find additional information in the subsection, Deployment Information, in this section.

Restarts the computer after installation and force other applications to close at shutdown without saving open files first.

/warnrestart[:x]

Presents a dialog box with a timer warning the user that the computer will restart in x seconds. (The default setting is 30 seconds.) Intended for use with the /quiet switch or the /passive switch.

/promptrestart

Display a dialog box prompting the local user to allow a restart

Special Options

/overwriteoem

Overwrites OEM files without prompting

/nobackup

Does not back up files needed for uninstall

/forceappsclose

Forces other programs to close when the computer shuts down

/log:path

Allows the redirection of installation log files

/integrate:path

Integrates the update into the Windows source files. These files are located at the path that is specified in the switch.

/extract[:path]

Extracts files without starting the Setup program

/ER

Enables extended error reporting

/verbose

Enables verbose logging. During installation, creates %Windir%\CabBuild.log. This log details the files that are copied. Using this switch may cause the installation to proceed more slowly.

Note You can combine these switches into one command. For backward compatibility, the security update also supports many of the setup switches that the earlier version of the Setup program uses. For more information about the supported installation switches, see Microsoft Knowledge Base Article 262841. For more information about the Update.exe installer, visit the Microsoft TechNet Web site.

Verifying that the Update Has Been Applied

Microsoft Baseline Security Analyzer

To verify that a security update has been applied to an affected system, you may be able to use the Microsoft Baseline Security Analyzer (MBSA) tool. See the section, Detection and Deployment Tools and Guidance, earlier in this bulletin for more information.

File Version Verification

Because there are several versions of Microsoft Windows, the following steps may be different on your computer. If they are, see your product documentation to complete these steps.

Click Start, and then click Search.

In the Search Results pane, click All files and folders under Search Companion.

In the All or part of the file name box, type a file name from the appropriate file information table, and then click Search.

In the list of files, right-click a file name from the appropriate file information table, and then click Properties.

Note Depending on the version of the operating system or programs installed, some of the files that are listed in the file information table may not be installed.

On the Version tab, determine the version of the file that is installed on your computer by comparing it to the version that is documented in the appropriate file information table.

Note Attributes other than the file version may change during installation. Comparing other file attributes to the information in the file information table is not a supported method of verifying that the update has been applied. Also, in certain cases, files may be renamed during installation. If the file or version information is not present, use one of the other available methods to verify update installation.

Other Information

Acknowledgments

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

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.

V1.1 (March 5, 2009): Added entry to section, Frequently Asked Questions (FAQ) Related to This Security Update, announcing a detection logic change to the update packages for Microsoft SQL Server 2000 Desktop Engine (WMSDE) (KB960082). This is a deployment change only that does not affect the files contained in the initial update. Customers who have successfully updated their systems do not need to reinstall this update.

V1.2 (March 18, 2009): Corrected product instance names from "ADMT" and "ADS" to "MS_ADMT" and "MicrosoftADS", respectively. These are instance names referenced in the Security Update Deployment section for the Microsoft SQL Server 2000 Desktop Engine (WMSDE). This is an informational change only that does not affect the files contained in the update. Customers who have successfully updated their systems do not need to reinstall this update.