Executive Summary

Summary
Title Microsoft SQL Server fails to properly validate parameters to the sp_replwritetovarbin extended stored procedure
Informations
Name VU#696644 First vendor Publication 2008-12-24
Vendor VU-CERT Last vendor Modification 2009-02-10
Severity (Vendor) N/A Revision M

Security-Database Scoring CVSS v3

Cvss vector : N/A
Overall CVSS Score NA
Base Score NA Environmental Score NA
impact SubScore NA Temporal Score NA
Exploitabality Sub Score NA
 
Calculate full CVSS 3.0 Vectors scores

Security-Database Scoring CVSS v2

Cvss vector : (AV:N/AC:L/Au:S/C:C/I:C/A:C)
Cvss Base Score 9 Attack Range Network
Cvss Impact Score 10 Attack Complexity Low
Cvss Expoit Score 8 Authentication Requires single instance
Calculate full CVSS 2.0 Vectors scores

Detail

Vulnerability Note VU#696644

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

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.

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

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

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

Systems Affected

VendorStatusDate NotifiedDate Updated
Microsoft CorporationVulnerable2008-12-192009-02-10

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

Credit

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

Date Public:2008-12-09
Date First Published:2008-12-24
Date Last Updated:2009-02-10
CERT Advisory: 
CVE-ID(s):CVE-2008-5416
NVD-ID(s):CVE-2008-5416
US-CERT Technical Alerts:TA09-041A
Metric:4.45
Document Revision:18

Original Source

Url : http://www.kb.cert.org/vuls/id/696644

CWE : Common Weakness Enumeration

% Id Name
100 % CWE-119 Failure to Constrain Operations within the Bounds of a Memory Buffer

OVAL Definitions

Definition Id: oval:org.mitre.oval:def:6217
 
Oval ID: oval:org.mitre.oval:def:6217
Title: SQL Server sp_replwritetovarbin Limited Memory Overwrite Vulnerability
Description: Heap-based buffer overflow in Microsoft SQL Server 2000 SP4, 8.00.2050, 8.00.2039, and earlier; SQL Server 2000 Desktop Engine (MSDE 2000) SP4; SQL Server 2005 SP2 and 9.00.1399.06; SQL Server 2000 Desktop Engine (WMSDE) on Windows Server 2003 SP1 and SP2; and Windows Internal Database (WYukon) SP2 allows remote authenticated users to cause a denial of service (access violation exception) or execute arbitrary code by calling the sp_replwritetovarbin extended stored procedure with a set of invalid parameters that trigger memory overwrite, aka "SQL Server sp_replwritetovarbin Limited Memory Overwrite Vulnerability."
Family: windows Class: vulnerability
Reference(s): CVE-2008-5416
Version: 9
Platform(s): Microsoft Windows 2000
Microsoft Windows Server 2003
Microsoft Windows Server 2008
Product(s): Microsoft SQL Server 2000
Microsoft SQL Server 2005
Microsoft SQL Server 2000 Desktop Engine (WMSDE)
Windows Internal Database (WYukon)
Definition Synopsis:

CPE : Common Platform Enumeration

TypeDescriptionCount
Application 2

SAINT Exploits

Description Link
Microsoft SQL Server spreplwritetovarbin Buffer Overflow More info here

OpenVAS Exploits

Date Description
2012-03-16 Name : VMSA-2011-0003.2 Third party component updates for VMware vCenter Server, vCe...
File : nvt/gb_VMSA-2011-0003.nasl
2008-12-16 Name : Microsoft SQL Server sp_replwritetovarbin() BOF Vulnerability
File : nvt/gb_mssql_sp_replwritetovarbin_bof_vuln.nasl

Open Source Vulnerability Database (OSVDB)

Id Description
50589 Microsoft SQL Server 2000 sp_replwritetovarbin() Stored Procedure Overflow

An overflow exists in Microsoft SQL Server 2000. The sp_replwritetovarbin() stored procedure fails to check invalid parameters, trigger memory overwrite, resulting in a heap overflow. With a specially crafted request, an attacker can cause a denial of service or execute arbitrary code resulting in a loss of integrity and/or availability.

Information Assurance Vulnerability Management (IAVM)

Date Description
2011-05-12 IAVM : 2011-A-0066 - Multiple Vulnerabilities in VMware Products
Severity : Category I - VMSKEY : V0027158
2009-02-12 IAVM : 2009-A-0012 - Microsoft SQL Server Remote Code Execution Vulnerability
Severity : Category I - VMSKEY : V0018387

Snort® IPS/IDS

Date Description
2014-01-10 sp_replwritetovarbin vulnerable function attempt
RuleID : 15144 - Revision : 12 - Type : SERVER-MSSQL
2014-01-10 sp_replwritetovarbin unicode vulnerable function attempt
RuleID : 15143 - Revision : 15 - Type : SERVER-MSSQL
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function unicode attempt
RuleID : 15142 - Revision : 9 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function unicode andx a...
RuleID : 15141 - Revision : 9 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function attempt
RuleID : 15140 - Revision : 9 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function andx attempt
RuleID : 15139 - Revision : 9 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function WriteAndX unic...
RuleID : 15138 - Revision : 9 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function WriteAndX unic...
RuleID : 15137 - Revision : 9 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function WriteAndX attempt
RuleID : 15136 - Revision : 9 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function WriteAndX andx...
RuleID : 15135 - Revision : 9 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function unicode attempt
RuleID : 15134 - Revision : 10 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function unicode andx a...
RuleID : 15133 - Revision : 10 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function attempt
RuleID : 15132 - Revision : 10 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function andx attempt
RuleID : 15131 - Revision : 10 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function WriteAndX unic...
RuleID : 15130 - Revision : 10 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function WriteAndX unic...
RuleID : 15129 - Revision : 10 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function WriteAndX attempt
RuleID : 15128 - Revision : 10 - Type : OS-WINDOWS
2014-01-10 Microsoft Windows SMB sp_replwritetovarbin vulnerable function WriteAndX andx...
RuleID : 15127 - Revision : 10 - Type : OS-WINDOWS

Nessus® Vulnerability Scanner

Date Description
2016-03-04 Name : The remote VMware ESX / ESXi host is missing a security-related patch.
File : vmware_VMSA-2011-0003_remote.nasl - Type : ACT_GATHER_INFO
2011-02-14 Name : The remote VMware ESXi / ESX host is missing one or more security-related pat...
File : vmware_VMSA-2011-0003.nasl - Type : ACT_GATHER_INFO
2009-02-11 Name : A database application installed on the remote host is affected by a remote c...
File : smb_kb959420.nasl - Type : ACT_GATHER_INFO
2009-02-11 Name : Arbitrary code can be executed on the remote host through Microsoft SQL Server.
File : smb_nt_ms09-004.nasl - Type : ACT_GATHER_INFO

Alert History

If you want to see full details history, please login or register.
0
1
2
Date Informations
2015-12-17 13:26:57
  • Multiple Updates
2015-05-08 13:28:07
  • Multiple Updates
2013-05-11 00:57:18
  • Multiple Updates