Microsoft SQL Server fails to properly validate parameters to the sp_replwritetovarbin extended stored procedure

2008-12-24T00:00:00
ID VU:696644
Type cert
Reporter CERT
Modified 2009-02-11T03:09:00

Description

Overview

A vulnerability in the Microsoft SQL Server sp_replwritetovarbin extended stored procedure could allow an authenticated attacker to execute arbitrary code on an affected server.

Description

Some versions of Microsoft SQL Server contain a vulnerability in the sp_replwritetovarbin stored procedure. The vulnerability could allow an attacker to modify heap memory and potentially execute arbitrary code. The vulnerability is described in SEC Consult Security Advisory < 20081209-0 >. Microsoft Security Bulletin MS09-004 provides further details, including affected database versions and workarounds.

In order to access sp_replwritetovarbin, an attacker would need to authenticate to the database first. A separate SQL injection vulnerability in a web application could allow a remote, unauthenticated attacker to exploit the sp_replwritetovarbin vulnerability with the user credentials of the web application. Microsoft Security Advisory (954462) provides detection and mitigation advice for SQL injection vulnerabilities.

Exploit code is publicly available for this vulnerability.


Impact

A local or remote authenticated attacker may be able to execute arbitrary code with the privileges of the SQL Server on the affected system. In the case of a SQL injection vulnerability in a web application that uses a vulnerable database, a remote attacker may be able to exploit the sp_replwritetovarbin vulnerability with credentials of the web application.


Solution

Apply an update
This issue is addressed in Microsoft Security Bulletin MS09-004.


Workarounds

Deny execute permissions on sp_replwritetovarbin as described in Microsoft Security Bulletin MS09-004.

Alternatively, remove sp_replwritetovarbin using sp_dropextendedproc as described in SEC Consult Security Advisory < 20081209-0 > and "Removing an Extended Stored Procedure from SQL Server."

Removing execute permissions or removing sp_replwritetovarbin may impact application functionality.


Vendor Information

696644

Filter by status: All Affected Not Affected Unknown

Filter by content: __ Vendor has issued information

__ Sort by: Status Alphabetical

Expand all

Affected Unknown __ Unaffected

Javascript is disabled. Click here to view vendors.

Microsoft Corporation

Notified: December 19, 2008 Updated: February 10, 2009

Status

__ Vulnerable

Vendor Statement

No statement is currently available from the vendor regarding this vulnerability.

Vendor Information

This issue is addressed in Microsoft Security Bulletin MS09-004.

Note that MS09-004 supercedes Microsoft Security Advisory (961040) that was initially published in response to this issue.

CVSS Metrics

Group | Score | Vector
---|---|---
Base | N/A | N/A
Temporal | N/A | N/A
Environmental | | N/A

References

  • <http://www.sec-consult.com/files/20081209_mssql-sp_replwritetovarbin_memwrite.txt>
  • <http://www.milw0rm.com/exploits/7501>
  • <http://www.microsoft.com/technet/security/advisory/961040.mspx>
  • <http://msdn.microsoft.com/en-us/library/aa215995(SQL.80).aspx>
  • <http://msdn.microsoft.com/en-us/library/aa933290(SQL.80).aspx>
  • <http://www.microsoft.com/technet/security/advisory/954462.mspx>
  • <http://www.microsoft.com/technet/security/bulletin/ms09-004.mspx>

Acknowledgements

This vulnerability was reported by Bernhard Mueller of SEC Consult Vulnerability Lab.

This document was written by Chad R Dougherty and Art Manion.

Other Information

CVE IDs: | CVE-2008-5416
---|---
Severity Metric:** | 4.46
Date Public:
| 2008-12-09
Date First Published: | 2008-12-24
Date Last Updated: | 2009-02-11 03:09 UTC
Document Revision: | 18