Home   |   Asp.Net 2.0   |   .Net Framework 2.0   |   IIS 6.0   |   Sql Server 2005   |   Visual Basic 2005   |   c# 2005   |   VS 2005   |   Visual Source Safe 2005

MS Dynamics CRM 3.0

SharePoint Portal Server 2003
SharePoint Server 2007
Dynamics NAV
Dynamics CRM
SharePoint Designer 2007
SharePoint Portal Server 2001
Windows SharePoint Services
Windows SharePoint Services 3.0
Project Server 2003
Project Server 2007
Dynamics – Point of Sale
Dynamics AX
Dynamics GP
Dynamics Retail Management System (RMS)
Dynamics SL
SQL Server 2000
Visual Basic .NET 2003
Visual C# .NET 2003
Visual C++ .NET 2003
Visual C++ 2005
Visual SourceSafe 6.0
Windows Server 2003
Windows Server 2003
Outlook 2003
ADO.NET 1.1
ASP.NET 1.0
Visual Studio Team Foundation Server
Visual Studio 2005 Team Edition
Windows Internet Explorer 7
BizTalk Server 2000
BizTalk Server 2002
BizTalk Server 2004
BizTalk Server 2006
Visual Studio 6.0
Access 2000
Access 2002
Access 2003
Access 2007
Access 97
Collaboration Data Objects 2.0
Commerce Server 2002
Content Management Server 2001
Commerce Server 2007
Content Management Server 2002
Data Access Components 2.7
Data Access Components 2.8
DirectX 9.0b
Office Small Business Accounting 2006
Accounting 2007
ActiveSync 4.1
Class Server 2.0
Groove 2007
Windows Vista
Outlook 2007
OneNote 2003
OneNote 2007
Office X for Mac
Zune software
Zune Live
Zoo Tycoon 2
Flight Simulator 2002
Dungeon Siege II

Cervo Technologies
The Right Source to Outsource

Oracle Database FAQS

Sharepoint Portal Server KB

Outlook 2007 Knowledge Base Articles

SQL Server 2005 Knowledge Base Articles

All conditional and branching statements are ignored when you try to execute a batch of Transact-SQL statements that have the FTMONLY option set to ON in SQL Server 2005


When you try to execute a batch of Transact-SQL statements that have the FMTONLY option set to ON in Microsoft SQL Server 2005, all conditional and branching statements are ignored.

MORE INFORMATION

When you execute a batch of Transact-SQL statements, conditional and branching statements such as IF, WHILE, and GOTO statements are ignored. The rest of the statements are executed only as necessary to obtain the metadata of the output and to send the metadata back to the client application. If the batch of statements contains the SET FMTONLY OFF option statement, the statement is executed, and the FMTONLY option is set to OFF. Therefore, the following pattern of Transact-SQL statements contains a security threat:
IF <trusted user>
BEGIN
-- Transact-SQL code that is inserted here is not validated for injection purposes, because the code is executed by 
-- only a trusted user.
END
ELSE
BEGIN
-- Transact-SQL code that is inserted here is validated for injection purposes.
END
In the following Transact-SQL statements, client drivers such as the OLEDB, ODBC, and ADO.NET drivers frequently execute a batch of statements when the FMTONLY option is set to ON. The drivers do this to discover metadata before the driver continues regular statement execution. Therefore, a non-trusted user can insert a SET FMTONLY OFF statement into the first part of the IF/ELSE construct. Then, the user can execute an inserted statement in that block. The following code example illustrates this scenario.
IF <trusted user>
BEGIN
....
SET FMTONLY OFF
-- Any statement here may potentially do harm.
....
END
ELSE
BEGIN
-- Transact-SQL code that is inserted here is validated for injection purposes.
END 
When the driver executes these statements together with the FMTONLY option set to ON, the trusted user check is ignored, and the flow control reaches the SET FMTONLY OFF statement. This action switches the Transact-SQL code execution into regular mode, and this action enables the rest of the inserted code to execute.

Because of this threat, make sure that you always use SQL injection mitigation, even in code paths that usually can be executed only by trusted users.


APPLIES TO
Microsoft SQL Server 2005 Developer Edition
Microsoft SQL Server 2005 Enterprise Edition
Microsoft SQL Server 2005 Enterprise Edition for Itanium-based Systems
Microsoft SQL Server 2005 Enterprise X64 Edition
Microsoft SQL Server 2005 Standard Edition
Microsoft SQL Server 2005 Standard X64 Edition

Keywords: 
kbtshoot kbinfo kbprb KB933248
Copyright © 2004 - 2007 Gridview.org, Inc. All rights reserved. Powered by Smart Web Content Management System