Finding and Fixing Vulnerabilities in Microsoft SQL Server Allows Code Execution (MS09-004, KB959420), a High Risk Vulnerability

With Notes on Remediation, Penetration Testing, Disclosures, Patching and Exploits

Vulnerabilities in Microsoft SQL Server Allows Code Execution (MS09-004, KB959420) is a high risk vulnerability that is one of the most frequently found on networks around the world. This issue has been around since at least 1990 but has proven either difficult to detect, difficult to resolve or prone to being overlooked entirely. 

Vulnerability Name:Microsoft SQL Server Allows Code Execution (MS09-004, KB959420)
Test ID:11515
Risk:High
Category:SQL servers
Type:Attack
Summary: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."
Solution:http://www.microsoft.com/technet/security/bulletin/ms09-004.mspx
CVE:CVE-2008-5416
Nist NVD (CVSS):AV:N/AC:L/Au:S/C:C/I:C/A:C
CVSS Score:9.0
Microsoft Security Bulletin:ms09-004

SQL Server Vulnerability Test

Use of Vulnerability Management tools are standard practice for the discovery of this vulnerability. The primary failure of VA in finding this vulnerability is related to setting the proper scope and frequency of network scans. It is vital that the broadest range of hosts (active IPs) possible are scanned and that scanning is done frequently. We recommend weekly. Your existing scanning solution or set of test tools should make this not just possible, but easy and affordable. 

Penetration Testing (pentest) for SQL Server

The Vulnerabilities in Microsoft SQL Server Allows Code Execution (MS09-004, KB959420) is prone to false positive reports by most vulnerability assessment solutions. Fortra VM uses behavior based testing that eliminates this issue. For all other VA tools security consultants will recommend confirmation by direct observation. In any case Penetration testing procedures for discovery of Vulnerabilities in Microsoft SQL Server Allows Code Execution (MS09-004, KB959420) produces the highest discovery accuracy rate, but the infrequency of this expensive form of testing degrades its value. The ideal would be to have pentesting accuracy and the frequency and scope possibilities of VA solution.

Security Updates on Vulnerabilities in Microsoft SQL Server Allows Code Execution (MS09-004, KB959420)

Given that this is one of the most frequently found vulnerabilities, there is ample information regarding mitigation online and very good reason to get it fixed. Hackers are also aware that this is a frequently found vulnerability and so its discovery and repair is that much more important. It is so well known and common that any network that has it present and unmitigated indicates "low hanging fruit" to attackers

Patching/Repairing this Vulnerability

https://technet.microsoft.com/library/security/ms09-004

Vulnerabilities in Microsoft SQL Server Allows Code Execution (MS09-004, KB959420) is a high risk vulnerability that is also high frequency and high visibility. This is the most severe combination of security factors that exists and it is extremely important to find it on your network and fix it as soon as possible.

See how vulnerability scanning can help your online security.