Public Vulnerability Reports

Microsoft SQL Server Restore Integer Underflow Vulnerability



SQL Server is Microsoft's database server product. It supports the restoration and inspection of backups via SQL statements. For more information see the vendor's website found at the following URL.


Remote exploitation of an integer underflow vulnerability within Microsoft Corp.'s SQL Server could allow a remote attacker to execute arbitrary code with the privileges of the SQL Server.

The vulnerability exists within the code responsible for parsing a stored backup file. A 32-bit integer value, representing the size of a record, is taken from the file and used to calculate the number of bytes to read into a heap buffer. This calculation can underflow, which leads to insufficient memory being allocated. The buffer is subsequently overfilled leading to an exploitable condition.


Exploitation of this vulnerability results in the execution of arbitrary code with the privileges of the SQL Server. SQL Server 2005 runs under the "NETWORK SERVICE" account, which is similar to an unprivileged user account.

The target function can be run by any user with access to query the database. This attack could also be conducted anonymously through a Web application if it contained an SQL Injection vulnerability.

For the server to load the corrupted backup file, an attacker would have to supply a path to a remote file using either SMB or WebDAV.


iDefense confirmed the existence of this vulnerability in Microsoft SQL Server 2005 Service Pack 2 Hot Fix 4. Additional tests against SQL Server 2005 without any updates suggest it is also vulnerable. Previous versions are also suspected to be vulnerable.


iDefense is currently unaware of any direct workaround for this issue. Administrators can disable SMB and WebDAV support on affected SQL Servers to prevent access to remote files.


Microsoft has officially addressed this vulnerability with Security Bulletin MS08-040. For more information, consult their bulletin at the following URL.


The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2008-0107 to this issue. This is a candidate for inclusion in the CVE list (, which standardizes names for security problems.


12/06/2007 Initial vendor notification
12/06/2007 Initial vendor response
07/08/2008 Coordinated public disclosure


This vulnerability was reported to iDefense by Brett Moore, from Insomnia Security,

Get paid for vulnerability research

Free tools, research and upcoming events


Copyright © 2008 Verisign, Inc.

Permission is granted for the redistribution of this alert electronically. It may not be edited in any way without the express written consent of iDefense. If you wish to reprint the whole or any part of this alert in any other medium other than electronically, please e-mail customer service for permission.

Disclaimer: The information in the advisory is believed to be accurate at the time of publishing based on currently available information. Use of the information constitutes acceptance for use in an AS IS condition. There are no warranties with regard to this information. Neither the author nor the publisher accepts any liability for any direct, indirect, or consequential loss or damage arising from use of, or reliance on, this information.