MS SQL Agd Add 1.05
MS SQL Agd Add 1.05
Abstract
This document is the Guidance Addendum for the Common Criteria certification of the
database engine of Microsoft® SQL Server® 2008 R2.
Keywords
CC, SQL, Common Criteria, Guidance Addendum
Guidance Addendum Page 2/79
Table of Contents
Page
1 INTRODUCTION ....................................................................................................................................... 7
2 SCOPE OF THE EVALUATION ............................................................................................................. 7
2.1 ASSUMPTIONS OF THE OPERATIONAL ENVIRONMENT........................................................................ 8
2.1.1 Trained administrator ................................................................................................................... 8
2.1.2 General purpose computing capabilities ................................................................................... 9
2.1.3 Physical Protection ....................................................................................................................... 9
8 APPENDIX ............................................................................................................................................... 75
8.1 STORED PROCEDURES ..................................................................................................................... 75
8.1.1 sp_MSgetversion ........................................................................................................................ 75
8.1.2 xp_dirtree ..................................................................................................................................... 75
8.1.3 xp_fileexist ................................................................................................................................... 75
8.1.4 xp_fixeddrives ............................................................................................................................. 76
8.1.5 xp_getnetname ........................................................................................................................... 76
8.1.6 xp_MSADEnabled ...................................................................................................................... 76
8.1.7 xp_qv ............................................................................................................................................ 77
8.1.8 xp_instance_regread ................................................................................................................. 77
8.1.9 xp_regread .................................................................................................................................. 77
8.1.10 sp_enable_sql_debug ........................................................................................................... 78
8.2 REFERENCES .................................................................................................................................... 79
Guidance Addendum Page 5/79
List of Tables
Page
List of Figures
Page
1 Introduction
This document has been created as part of the Common Criteria (CC) Evaluation of
Database Engine of Microsoft SQL Server 2008 R2. It covers the specific aspects that shall
be considered when operating SQL Server 2008 R2 in its certified version and extends the
general guidance of the product given in Books Online. The document follows the following
structure:
Chapter 2 of this document gives more details about the scope of the certification for SQL
Server 2008 R2 and the assumptions, which have been made about the environment of the
TOE.
Chapter 3 of this document describes the steps for the installation process of the database
engine of SQL Server 2008 R2 in its certified version.
Chapter 4 introduces the concept of the SQL Server Books Online and provides the
administrator and users with entry points for important aspects.
Chapter 5 contains the important aspects of the guidance, which are specific to the certified
version of SQL Server 2008 R2.
Chapter 6 introduces the concept and the important aspects of the trace mechanism of
SQL Server 2008 R2
Finally chapter 7 gives requirements and recommendations for the secure operation of the
TOE.
1
Please note that the version number 10.50.2500.0 refers to SQL Server 2008 R2 plus an installed SP1.
Guidance Addendum Page 8/79
Session Handling
Additional information about the certification process and related documents can be
obtained via [WEB].
The following chapter describes the assumptions, which have been made about the
environment of the TOE during evaluation, and which therefore have to be addressed
during the start-up and operation of the TOE. It further explains how these assumptions can
be addressed.
Assumption Description
A.NO_EVIL Administrators are non-hostile, appropriately trained, and
follow all administrator guidance.
A.NO_GENERAL_PURPOSE There are no general-purpose computing capabilities
(e.g., compilers or user applications) available on DBMS
servers, other than those services necessary for the
operation, administration and support of the DBMS.
A.PHYSICAL It is assumed that appropriate physical security is
provided within the domain for the value of the IT assets
protected by the TOE and the value of the stored,
processed, and transmitted information.
3.1 Prerequisites
3.1.1 Hardware Prerequisites
According to [ST] a machine that meets at least following criteria has to be available:
AMD Opteron, AMD Athlon 64, Intel Xeon with Intel EM64T support, Intel Pentium IV
with EM64T support at 1.4 GHz or faster (Please note that IA64 CPUs are not
supported for the certified version of the database engine of SQL Server 2008 R2)
1 gigabyte (GB) of RAM or more
Approximately 1500 MB of available hard-disk space for the recommended
installation
DVD-ROM drive
SVGA (1,024x768) or higher-resolution video adapter and monitor
Microsoft Mouse or compatible pointing device
keyboard
Please note that additional disc space will be required for the recommended trace
processes (Up to 10 GB in its default configuration).
2
This will also be automatically installed by the installer of SQL Server if not already on the machine.
Guidance Addendum Page 11/79
3. Put the DVD of SQL Server 2008 R2 Enterprise or Datacenter Edition into the local
DVD drive and extract integritycheck_SQL2008R2.zip to the folder that contains the
FCIV tool.
4. Open a command prompt and change to the directory to which the
integritycheck_SQL2008R2.zip has been extracted.
5. Execute “integritycheck_sqlserver2008R2.cmd” and verify that the feedback
matches the following picture:
Guidance Addendum Page 12/79
The description in this chapter focuses on a typical way of installing the database engine of
SQL Server 2008 R2. For a more general overview over all options for the SQL Server
setup please refer to [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10sq_GetStart/html/6ad23de1-2bab-4933-
9122-c09f5565028d.htm].
Please note that the installation procedure presented in this chapter belongs to the
Enterprise Version of SQL Server 2008 R2. The installation procedure for the Datacenter
Edition follows the same structure.
The SQL Server Installation Wizard is Windows Installer-based. It provides a single feature
tree for installation of all SQL Server components.
To install SQL Server 2008 R2 one has to insert the SQL Server installation media and
double-click setup.exe in the root folder. This installer will by default install the version of
SQL Server that fits to the installed Operating System (x64).
For local installations, Setup has to run as an administrator.
For the case that the .NET Framework or the Windows installer (also referred to as “Hotfix
for Windows (KB942288)”) that are required (See also chapter 3.2) are not installed, SQL
Server setup will offer their installation.
When the prerequisites are installed, the Installation Wizard will run the SQL Server
Installation Center as seen in the following figure. To create a new installation of SQL
Server 2008 R2, click New SQL Server stand-alone installation or add features to an
existing installation”.
Guidance Addendum Page 13/79
Next, the System Configuration Checker will run one more set of rules to validate your
computer configuration with the SQL Server features that have been selected.
ms-help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10sq_GetStart/html/641a10a1-ae52-4d26-
8f1c-a032a4aeff02.htm]
The Ready to Install page (see Figure 16) shows a tree view of installation options that were
specified during Setup.
Guidance Addendum Page 26/79
The installation process for SP1is self explaining and does not require any settings specific
to the evaluated version of the Database Engine of Microsoft SQL Server 2008 R2.
SELECT @@VERSION
go
Using this command the TOE will return the name of the product platform (of which the TOE
is the central part), the version number of the TOE and information about the Operating
System.
For the certified version (which does not include the IA64 edition) the string that is returned
in response to this command shall start with
Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64)
These strings include information on the concrete version of the SQL Server that has been
installed (10.50.2500.0) and also show that the x64 edition has been installed.
it still has the year as it’s first part. To retain backward compatibility with the software that
uses these, the File Version Number format was not changed.
For that reason, also the „.100.“ in the File Version Number is equivalent to ‚.10.0.’ in the
Product Version Number. Note also that leading and trailing zeroes in the Product Version
Number are sometimes displayed.
allowed to logon at this time. EXECUTE permission for this function is granted to
everyone.
The logon trigger
trig_deny_access_A54E382458CA11DB8373B622A1EF5492
This trigger is executed on every LOGON attempt. It checks whether the login is
allowed to logon at this time (based on the time of the day and the day of the week)
and if NOT rejects the connection by raising an exception.
trig_max_connections_A54E382458CA11DB8373B622A1EF5492
This trigger is executed on every LOGON attempt. It checks whether the login is
allows to logon at this time (based on the maximum number of concurrent session
per user) and if NOT rejects the connection by raising an exception.
The Stored Procedures
dbo.sp_deny_logon_internal_A54E382458CA11DB8373B622A1EF5492
This is an utility stored procedure and it is not supposed to be called directly
dbo.sp_deny_logon (see chapter 5.4.1.8.1)
dbo.sp_revoke_logon_denies (see chapter 5.4.1.8.2)
dbo.sp_set_maximum_number_of_connections_per_login (see chapter 5.4.1.8.3)
dbo.sp_remove_maximum_number_of_connections_limit (see chapter 5.4.1.8.4)
sp_trace_setcategory (see chapter 5.4.1.6.1)
sp_trace_setcategory_all (see chapter 5.4.1.6.2)
After unpacking the script locally (i.e. on the machine where the TOE is installed) it can be
started by executing the file Verification_Scripts.bat. This file will execute a set of easy test
cases to verify the operation of the Security Functions and print the results to the screen.
The following screenshot shows the output of the script for the case that all test cases
passed.
5 GUIDANCE ADDENDUM
This chapter contains the guidance addendum for the secure administration and usage of
the TOE. It only covers the aspects of guidance, which are specific to the certified version of
the database engine of SQL Server 2008 R2. It should be seen as a supplement to [AGD].
Option Description
-c Shortens startup time when starting SQL Server from the command prompt.
Typically, the SQL Server Database Engine starts as a service by calling the
Service Control Manager. Because the SQL Server Database Engine does
not start as a service when starting from the command prompt, use -c to skip
this step.
-f Starts an instance of SQL Server with minimal configuration. This is useful if
the setting of a configuration value (for example, over-committing memory)
has prevented the server from starting.
-g Specifies an integer number of megabytes (MB) of memory that SQL Server
will leave available for memory allocations within the SQL Server process,
but outside the SQL Server memory pool. The memory outside of the
memory pool is the area used by SQL Server for loading items such as
extended procedure .dll files, the OLE DB providers referenced by distributed
queries, and automation objects referenced in Transact-SQL statements. The
default is 256 MB.
-h Reserves virtual address space for Hot Add memory metadata when AWE
(Address Windowing Extension) is enabled with 32-bit SQL Server 2008.
Required for Hot-Add memory with 32-bit AWE, but consumes about 500 MB
of virtual address space and makes memory tuning more difficult. Not
required for 64-bit SQL Server. Hot Add Memory is only available for
Windows Server 2003, Enterprise and Datacenter editions. It also requires
special hardware support from the hardware vendor.
-m Starts an instance of SQL Server in single-user mode. When you start an
Guidance Addendum Page 35/79
Option Description
instance of SQL Server in single-user mode, only a single user can connect,
and the CHECKPOINT process is not started. CHECKPOINT guarantees
that completed transactions are regularly written from the disk cache to the
database device. (Typically, this option is used if you experience problems
with system databases that should be repaired.) Enables the sp_configure
allow updates option. By default, allow updates is disabled.
-n Does not use the Windows application log to record SQL Server events. If
you start an instance of SQL Server with -n, we recommend that you also
use the -e startup option. Otherwise, SQL Server events are not logged.
-s Allows you to start a named instance of SQL Server 2008 R2. Without the -s
parameter set, the default instance will try to start. You must switch to the
appropriate BINN directory for the instance at a command prompt before
starting sqlservr.exe. For example, if Instance1 were to use \mssql$Instance1
for its binaries, the user must be in the \mssql$Instance1\binn directory to
start sqlservr.exe -s instance1.
-T trace# Indicates that an instance of SQL Server should be started with a specified
trace flag (trace#) in effect. Trace flags are used to start the server with
nonstandard behavior. For more information, see [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/b971b540-
1ac2-435b-b191-24399eb88265.htm]
-x Disables the keeping of CPU time and cache-hit ratio statistics. Allows
maximum performance.
-e Increases the number of extents that are allocated for each file in a filegroup.
This option may be helpful for data warehouse applications that have a
limited number of users running index or data scans.
The following modes will require special care of the administrator. It is highly recommended
not to use these modes within a productive environment within the scope of the certified
Guidance Addendum Page 36/79
Server client computers the SQL Server Configuration Manager tool can be used. The
settings are stored and changed in the Operating System.
SQL Server Configuration Manager is a Microsoft Management Console snap-in that is
available from the Start menu, or can be added to any other Microsoft Management
Console display.
SQL Server Configuration Manager can be used to start, pause, resume, or stop the
services of SQL Server 2008 R2, to view service properties, or to change service
properties.
SQL Server 2008 R2 supports Shared Memory, TCP/IP, Named Pipes, and VIA
protocols for its communication. These protocols can be managed (e.g. disabled and
enabled) using SQL Configuration Manager. For information about choosing a
network protocols see also [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_4deptrbl/html/6565fb7d-b076-
4447-be90-e10d0dec359a.htm] However the VIA protocol shall not be used within
the certified version of the product (see also chapter 7).
More detailed information about the functionality which is provided by the SQL Server
Configuration Manager can be found in [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10sq_GetStart/html/e6beaea4-164c-4078-
95ae-b9e28b0aefe8.htm].
Table 8: Commands to add and delete users from database and server groups
An overview over the predefined server roles that ship together with the product and their
permissions can be found in [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_4deptrbl/html/13d47a53-1b5a-466f-
8117-d060aa8d943e.htm].
5.4.1.4 Create and delete database groups
The following commands can be used to create and delete database scoped groups.
Command Purpose Reference in [AGD]
Sp_addrole Add a [AGD, ms-
group help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/e8a21642-
8440-419a-8585-93d3d9d44f00.htm]
Create role Add a [AGD, ms-
group help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/b0cd54ad-
e81d-4d71-acec-8a6d7261ca08.htm]
Sp_droprole Delete a [ADG, ms-
group help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/889ee074-
00f8-40a9-bddb-d7d3ef0cbc19.htm]
Drop Role Delete a [AGD, ms-
group help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/1f6f13ae-
56a2-4ef1-93f5-8e6151b83e1d.htm]
An overview over the predefined database roles that ship together with the product and their
permissions can be found in [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_4deptrbl/html/a08108a3-f1fb-43ac-a264-
3f2f9749db5d.htm].
5.4.1.5 Create, Start and Stop Security Audit
The following commands can be used to create, start and stop a trace process. When
creating a new trace process one has to specify, what should happen in the case where the
audit file is full.
Command Purpose Reference in [AGD]
Sp_trace_create Create a [AGD, ms-
new trace help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/htm
process l/f3a43597-4c5a-4520-bcab-becdbbf81d2e.htm]
Sp_trace_setstatus Start and [AGD, ms-
Stop a trace help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/htm
process l/29e7a7d7-b9c1-414a-968a-fc247769750d.htm]
5.4.1.6.1 Sp_trace_setcategory
This Stored Procedure allows the administrator to enable or disable a given data column for
all events in a given trace category.
Syntax
sp_trace_setcategory [@traceid=] traceid
Guidance Addendum Page 42/79
,[@categoryid=] categoryid
,[@columnid=]columnid
,[@on=] on
Arguments
[@traceid=] traceid
This is the ID of the trace process in which the events shall be enable/disabled. Traceid is of
type INT.
[@categoryid=] categoryid
This is the ID of the category (sys.trace_categories) of which all events shall be
enabled/disabled. Categoryid is of type INT.
[@columnid=]columnid
This is the ID of the column (sys.trace_columns) that shall be enabled/disabled for all
events in the category. Columnid is of type INT.
[@on=] on
This argument specifies whether the events shall be enable (1) or disabled (0). On is of type
BIT.
Return Values
0 (Success) or >0 (Failure)
Permissions
Requires the EXECUTE permission on the Stored Procedure and ALTER TRACE
permission.
Remarks
Please not that other than standard system Stored Procedures that do live in the sys. –
schema this Stored Procedure is stored in the dbo-schema of the master database.
5.4.1.6.2 Sp_trace_setcategory_all
This Stored Procedure allows the administrator to enable or disable all valid data column for
all events in a given trace category.
Syntax
sp_trace_setcategory [@traceid=] traceid
,[@categoryid=] categoryid
,[@on=] on
Arguments
[@traceid=] traceid
This is the ID of the trace process in which the events shall be enable/disabled. Traceid is of
type INT.
[@categoryid=] categoryid
Guidance Addendum Page 43/79
5.4.1.8.1 Sp_deny_logon
This Stored Procedure allows the administrator to deny session establishment to a certain
login based on the day of the week and the time of the day.
Syntax
sp_deny_logon [@login_name=] 'login'
,[@start_weekday=] start_weekday
, [@start_time =] 'start_time'
,[@end_weekday=] end_weekday
,[@end_time=] 'end_time'
Arguments
[@login_name=] 'login'
Is the name of the login. 'login is of data type sysname.
[@start_weekday=] start_weekday
Guidance Addendum Page 44/79
Is the day of the week where the session deny should start. Start_weekday is tinyint
according to the @@DATEFIRST setting (i.e. 1 means Sunday in the default setting for
@@DATEFIRST).
[@start_time =] 'start_time'
Is the time of the day where the session deny should start. Start_time is of nvarchar(12), in
format hh:mm:ss.000 (the last three digits represent milliseconds)
[@end_weekday=] end_weekday
Is the day of the week where the session deny should end. end_weekday is tinyint
according to the @@DATEFIRST setting (i.e. 1 means Sunday in the default setting for
@@DATEFIRST).
[@end_time=] 'end_time'
Is the time of the day where the session deny should end. end_time is of nvarchar(12), in
format hh:mm:ss.000 (the last three digits represent milliseconds)
Return Values
0 (Success) or >0 (Failure)
Remarks
This Stored Procedure can be called with any @@datefirst setting and the start of the
interval given can be > than the end of the interval. In this case it splits the passed interval
into two intervals.
Please note that other than standard system Stored Procedures that do live in the sys. –
schema this Stored Procedure is stored in the dbo-schema of the master database.
Permissions
Requires the CONTROL SERVER permission.
5.4.1.8.2 Sp_revoke_logon_denies
This Stored Procedure allows an administrator to revoke all denies from a certain login.
Syntax
sp_revoke_logon_denies [@login_name=]'login'
Arguments
[@login_name=] 'login'
Is the name of the login for which all denies shall be revoked. 'login is of data type
sysname.
Return Values
0 (Success) or >0 (Failure)
Remarks
Please note that other than standard system Stored Procedures that do live in the sys. –
schema this Stored Procedure is stored in the dbo-schema of the master database.
Permissions
Guidance Addendum Page 45/79
5.4.1.8.3 Sp_set_maximum_number_of_connections_per_login
This Stored Procedure allows the administrator to set the maximum number of connections
that are allowed per login. This value is a global value that is valid for all logins.
Syntax
dbo.sp_set_maximum_number_of_connections_per_login
[@max_connections=] max_connections
Arguments
[@max_connections=] max_connections
New value for the maximum number of allowed connection per login. Max_connections is of
data type INT.
Return Values
0 (Success) or >0 (Failure)
Remarks
Please note that other than standard system Stored Procedures that do live in the sys. –
schema this Stored Procedure is stored in the dbo-schema of the master database.
Permissions
Requires the CONTROL SERVER permission.
5.4.1.8.4 Sp_remove_maximum_number_of_connections_limit
This Stored Procedure allows the administrator to remove the setting for the maximum
number of connections that are allowed per login. After successfully executing this Stored
Procedure the TOE will no longer enforce any limitation on the number of concurrent
sessions per login.
Syntax
dbo.sp_remove_maximum_number_of_connections_limit
Arguments
-
Return Values
0 (Success) or >0 (Failure)
Remarks
Please note that other than standard system Stored Procedures that do live in the sys. –
schema this Stored Procedure is stored in the dbo-schema of the master database.
Permissions
Requires the CONTROL SERVER permission.
Guidance Addendum Page 46/79
Based on the identity of the user, the group membership of the user and the granted or
denied permissions the database engine will decide based on the following rules whether
an operation that is requested by a user is allowed:
1. If the requested mode of access is denied to the user, the access will be denied
2. If the requested mode of access is denied to any role of which the user is a member,
the access will be denied
3. If the requested mode of access is permitted to that user, the access will be
permitted
4. If the requested mode of access is permitted to any role of which the user is a
member, the operation will be permitted
5. Else: The access will be denied
It should be noted that the permission check on an object includes the permissions of its
parent objects. The permissions for the object itself and all its parent objects are
accumulated together before the aforementioned rules are evaluated.
However, there are two cases for which the aforementioned rules are overridden:
1. A sysadmin, the owner of an object and owners of parent objects always have
access
2. In the case of “Ownership Chaining” (see also [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_4deptrbl/html/762249ee-881a-
4c3e-b8c0-3a9475039aca.htm]) the access is allowed.
The complete administrative part of this Security Function is covered by the Security
Function Security Management (see chapter 5.4.1).
For further information about the trace functionality of the TOE please refer to chapter 6.
Guidance Addendum Page 49/79
The administrator is free to define other values for the number of trace files or the size per
file. He is also free not to use the rollover option but to only have one trace file. However the
option to stop the server in case an error occurs in the context of this trace process shall
always be used.
In this context it is important to mention that the administrator should ensure that sufficient
disc space is available for the trace files as the engine in its default configuration will stop
operation if the trace process has to be stopped due to insufficient disc space.
For the case that the TOE stops operation due to insufficient disc space for the trace file the
administrator should either provide additional disc space or backup and delete the “old”
trace files before starting the engine again.
Per default the trace files for this process are written into the default log directory (usually
\MSSQL\LOG) and named “cc_trace_TIMESTAMP3_x.trc”. The “CC Trace” process will
start automatically after the TOE has been stopped and started again. However as in every
other trace process, which uses the rollover option, a rollover will happen (i.e. a new trace
file will be started) every time the trace process is started again.
If the script succeeds it will return a message including the internal ID of the trace process
and information about the trace files, which are in use.
The following table lists all events, which are included in the “CC trace” process.
3
Please note that the timestamp, which is used as part of the filename for the trace files has a resolution of 1
second. Thus the execution of the script will abort with an error if the script is started twice in one second.
Guidance Addendum Page 53/79
Table 15: Important attributes of “Audit Server Starts and Stops” event
Please note that the event which indicates that the server has been started will always show
success as otherwise the server would not have been started.
Guidance Addendum Page 55/79
Attribute Description
SPID ID of the session on which the event occurred.
StartTime Time at which the event started, if available.
LoginName Name of the login of the user (either the SQL Server security login or
the Microsoft Windows login credentials in the form of
DOMAIN\username).
DBUserName SQL Server database user name of the client.
SessionLoginName The login name of the user who originated the session. For example,
if you connect to SQL Server using Login1 and execute a statement
as Login2, SessionLoginName displays Login1, while LoginName
displays Login2. This data column displays both SQL Server and
Windows logins.
Success 1 = success. 0 = failure. For example, a value of 1 indicates success
of a permissions check and a value of 0 indicates failure of that check.
EventSubClass Type of event subclass., 1=Grant, 2=Revoke, 3=Deny
DatabaseName Name of the database in which the user statement is running. (if
available)
ParentName Name of the schema the object is within. (if available)
ObjectName Name of the target object
The following chapters introduce the events which can be used to trace the use of the
management functions of the TOE.
6.3.7.1 Add/delete logins
The “Audit Server Principal Management” event class occurs when server principals are
created, altered, or dropped. Server principals include all logins and server scoped roles.
This event contains the following attributes which are important in the context of this
evaluation:
Attribute Description
SPID ID of the session on which the event occurred.
StartTime Time at which the event started, if available.
LoginName Name of the login of the user (either the SQL Server security login or
the Microsoft Windows login credentials in the form of
DOMAIN\username).
DBUserName SQL Server database user name of the client.
SessionLoginName The login name of the user who originated the session. For example, if
you connect to SQL Server using Login1 and execute a statement as
Login2, SessionLoginName displays Login1, while LoginName
displays Login2. This data column displays both SQL Server and
Windows logins.
Success 1 = success. 0 = failure. For example, a value of 1 indicates success of
a permissions check and a value of 0 indicates failure of that check.
EventSubClass Type of event subclass.
1=Create, 2=Alter, 3=Drop, 4=Dump, 5=Disable, 6=Enable, 11=Load
TextData Additional information about the principal which is managed in form of
a SQL string.
This text field also contains information of which type a login is (SQL or
Windows) for the case that a login is created
ObjectName Name of the object being referenced.
“Audit Add Login to Server Role” Event Class indicates that a login was added or
removed from a fixed server role.
“Audit Add Member to DB Role” Event Class indicates that a login has been added
to or removed from a database role.
The “Audit Add Login to Server Role” event has the following attributes which are important
in the context of this evaluation:
Attribute Description
SPID ID of the session on which the event occurred.
StartTime Time at which the event started, if available.
LoginName Name of the login of the user (either the SQL Server security login or
the Microsoft Windows login credentials in the form of
DOMAIN\username).
DBUserName SQL Server database user name of the client.
SessionLoginName The login name of the user who originated the session. For example,
if you connect to SQL Server using Login1 and execute a statement
as Login2, SessionLoginName displays Login1, while LoginName
displays Login2. This data column displays both SQL Server and
Windows logins.
Success 1 = success. 0 = failure. For example, a value of 1 indicates success
of a permissions check and a value of 0 indicates failure of that
check.
EventSubClass Type of event subclass.
1=Add, 2=Drop
RoleName Name of the fixed server role whose membership is being modified.
Table 21: Important attributes of “Audit Add Login to Server Role” event
The “Audit Add Member to DB Role” event has the following attributes which are important
in the context of this evaluation:
Guidance Addendum Page 62/79
Attribute Description
SPID ID of the session on which the event occurred.
StartTime Time at which the event started, if available.
LoginName Name of the login of the user (either the SQL Server security login or
the Microsoft Windows login credentials in the form of
DOMAIN\username).
DBUserName SQL Server database user name of the client.
SessionLoginName The login name of the user who originated the session. For example,
if you connect to SQL Server using Login1 and execute a statement
as Login2, SessionLoginName displays Login1, while LoginName
displays Login2. This data column displays both SQL Server and
Windows logins.
Success 1 = success. 0 = failure. For example, a value of 1 indicates success
of a permissions check and a value of 0 indicates failure of that
check.
EventSubClass Type of event subclass.
1=Add, 2=Drop, 3=Change group
RoleName Name of an application role being enabled.
The Audit Login Failed event contains the following attributes which are important in the
context of this evaluation:
Attribute Description
SPID ID of the session on which the event occurred.
StartTime Time at which the event started, if available.
LoginName Name of the login of the user (either the SQL Server security login or
the Microsoft Windows login credentials in the form of
DOMAIN\username).
SessionLoginName The login name of the user who originated the session. For example,
if you connect to SQL Server using Login1 and execute a statement
as Login2, SessionLoginName displays Login1, while LoginName
displays Login2. This data column displays both SQL Server and
Windows logins.
Success 1 = success. 0 = failure. This event will always show failure.
TextData Text value dependent on the event class captured in the trace.
Attribute Description
SPID ID of the session on which the event occurred.
StartTime Time at which the event started, if available.
LoginName Name of the login of the user (either the SQL Server security login or
the Microsoft Windows login credentials in the form of
DOMAIN\username).
SessionLoginName The login name of the user who originated the session. For example,
if you connect to SQL Server using Login1 and execute a statement
as Login2, SessionLoginName displays Login1, while LoginName
displays Login2. This data column displays both SQL Server and
Windows logins.
DatabaseName Name of the database in which the user statement is running. (if
available)
TextData Text of the procedure call
Attribute Description
SPID ID of the session on which the event occurred.
StartTime Time at which the event started, if available.
LoginName Name of the login of the user (either the SQL Server security login or
the Microsoft Windows login credentials in the form of
DOMAIN\username).
SessionLoginName The login name of the user who originated the session. For example,
if you connect to SQL Server using Login1 and execute a statement
as Login2, SessionLoginName displays Login1, while LoginName
displays Login2. This data column displays both SQL Server and
Windows logins.
TextData Text of the error message or exception
login in the database engine who is leaving the company. In such a case the
administrator would usually consider to delete or block the login of the user.
Guidance Addendum Page 69/79
object imply which other permissions. For example the extract shown in Figure 19
(from Column.pdf) shows that permissions on a table do automatically imply
permissions on the columns of the table. More specific: The CONTROL permission
on a table implies permissions for Reference, Select and Update on the columns of
the table.
server role, or both ALTER ANY LOGIN permission on the server and membership
in the role from which the member is being dropped. However to successfully
execute this Stored Procedure the pure membership in the role from which a user
should be removed is sufficient. The administrator should be aware of the fact that a
login who is added to a server role does in this way implicitly inherit the permission
to remove all other logins from that role.
The description of the CREATE LOGIN statement in [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/eb737149-7c92-4552-
946b-91085d8b1b01.htm] describes that the ALTER ANY LOGIN permission on the
server is needed. However – as an exception – the CREATE LOGIN statement can
also be executed by a user to create a login for her own Windows account (in this
case the user would have access due to the membership in a Windows group).
The descriptions around the T-SQL commands for creating, altering and dropping
database audit specifications in [AGD] lists a set of different permissions that are
associated with those commands. However to successfully execute those command
the ALTER ANY DATABASE AUDIT permission is the minimum required
permission.
The descriptions around the T-SQL commands for creating, altering and dropping
server audit specifications in [AGD] lists a set of different permissions that are
associated with those commands. However to successfully execute those command
the ALTER ANY SERVER AUDIT permission is the minimum required permission.
The use of the column data types text/ntext and image is a deprecated feature (see
also [AGD, ms-
help://MS.SQLCC.v10/MS.SQLSVR.v10.en/s10de_6tsql/html/b0d8769c-7598-4f97-
8162-ace5f182b5bc.htm]) and has not been considered during the evaluation and
certification process with respect to the access control functionality. Therefore the
administrator shall ensure that user defined objects do not use this data type. The
following SQL query can be used to show all columns that use this data type within
the current database.
select b.name, a.name from sys.columns a inner join sys.objects b on a.object_id =
b.object_id where b.is_ms_shipped=0 and (a.user_type_id=35 or a.user_type_id=99
or a.user_type_id=34)
Please note that it is possible that after the evaluation and certification process of
the TOE as described in this document additional security patches are issued.
Therefore the administrator shall regularly visit the Microsoft technet website
(http://www.microsoft.com/technet/security/current.aspx) to get informed about new
security bulletins. For each new security patch the administrator shall carefully
consider to install it (depending on the needs of the specific installation). The
authenticity of each downloadable package can be verified using the digital
signature of the file: a file can be considered authentic if it is digitally signed by
Microsoft Corporation (see Figure 20 for an example).
The Microsoft technet also has a site that explains, how the development group of
Microsoft products can be contacted for the case that an administrator finds a
security bug (https://www.microsoft.com/technet/security/bulletin/alertus.aspx).
Guidance Addendum Page 74/79
8 Appendix
8.1.1 sp_MSgetversion
This Stored Procedure can be used to get the current version of Microsoft SQL Server.
Input: no input parameters
Returns: 0 / Error number
Output: row(s) with the Version Number in Character_value
Syntax: exec sp_MSgetversion
8.1.2 xp_dirtree
Returns a complete listing of all subdirectories on the server; for each subdirectory listed its
depth in the directory tree is also returned. If a depth is specified then only subdirectories up
to and including the specified depth will be returned. If IncludeFiles is specified (as a 1) then
files will also be returned and the result set will include an additional column to indicate if a
row is a file or a directory.
Input: @filepath, @depth, @IncludeFiles
Output: subdirectory, depth, file
Note: file is only displayed if @IncludeFiles = 1
Permission If the calling user is ‘sa’ this Stored Procedure is executed in the context of
the SQL Server system account. In all other cases the Stored Procedure will
be executed in the context of the calling user (i.e. the Stored Procedure will
impersonate the user). This impersonation will fail for the case that a SQL
login is used and an empty set will be returned.
Syntax: xp_dirtree <filepath>, <depth>, <IncludeFiles>
Examples: exec xp_dirtree 'c:' - Lists all dirs and sub-dirs on C:
exec xp_dirtree 'c:', 1 - Lists all dirs at the root level of C:
exec xp_dirtree 'c:', 1, 1 - Lists all dirs and files at the root level of C:
8.1.3 xp_fileexist
This Stored Procedure can be used to determine whether a particular file exists on disk or
not.
Guidance Addendum Page 76/79
Input: <filename>
Result: 0 / Error number
Permission If the calling user is ‘sa’ this Stored Procedure is executed in the context of
the SQL Server system account. In all other cases the Stored Procedure will
be executed in the context of the calling user (i.e. the Stored Procedure will
impersonate the user). This impersonation will fail for the case that a SQL
login is used and an empty set will be returned.
Syntax: EXECUTE xp_fileexist <filename> [, <file_exists INT> OUTPUT]
Example: For example, to check whether the file boot.ini exists on disk c: or not, run:
EXEC master..xp_fileexist 'c:\boot.ini'
8.1.4 xp_fixeddrives
Returns a row for each fixed drive containing the drive name and the amount of disk space
available in MB.
Input: no input parameters
Output: (two columns – drive, MB free)
Permission If the calling user is ‘sa’ this Stored Procedure is executed in the context of
the SQL Server system account. In all other cases the Stored Procedure will
be executed in the context of the calling user (i.e. the Stored Procedure will
impersonate the user). This impersonation will fail for the case that a SQL
login is used and an empty set will be returned.
Syntax: exec @retval=xp_fileexist
Example: To see the list of drives, run:
EXEC master.xp_fixeddrives
8.1.5 xp_getnetname
This extended stored procedure returns the WINS name of the SQL Server that you're
connected to.
Input: no input parameters
Output: (optional) one column (Server Net Name)
Else single-row, single-column result set is returned
Syntax: exec @retval=xp_getnetname
8.1.6 xp_MSADEnabled
This Stored Procedure can be used to determine whether the server is on Win NT4 SP5 or
later with AD enabled
Input: no input parameters
Result: 0 / Error number
Guidance Addendum Page 77/79
8.1.7 xp_qv
This Stored Procedure wraps SQLBOOT's QueryProductValue function.
USAGE: xp_qv '<setting>' [, '<instancename>']
If the optional instance name is not provided, then the default instance
('MSSQLSERVER') is assumed.
RETURNS: A signed int return value from QueryProductValue or VALUE_ERROR (-1), if
an error occurred. VALUE_NOT_FOUND (-2) is returned if the input value is
not a valid VALUE_* const.
Example: declare @sqlbootvalue int
exec @sqlbootvalue = xp_qv '2745196162'
select @sqlbootvalue 'VALUE_REPLICATION'
8.1.8 xp_instance_regread
See xp_regread for details
8.1.9 xp_regread
Functionality: This Stored Procedure is used to read from the registry.
Input: @rootkey, @key, @value_name, [,@value] (can have 5 input parameters)
Comments: Error if <2 input parameters
5th param – “no_output” then no output is displayed
No error check if >5 params are given
Permission If the calling user is ‘sa’ this Stored Procedure is executed in the context of
the SQL Server system account. The Stored Procedure ensures that other
users are only granted access to a limited set of registry values.
Return: 0/ Error number
Syntax: EXECUTE xp_regread [@rootkey=]'rootkey', [@key=]'key' [,
@value_name=]'value_name'] [, [@value=]@value OUTPUT]
Example: To read into the variable @test from the value 'TestValue' from the key
'SOFTWARE\Test' from the 'HKEY_LOCAL_MACHINE', run:
DECLARE @test varchar(20)
Guidance Addendum Page 78/79
8.1.10 sp_enable_sql_debug
Functionality: Returns a marshaled COM interface pointer that implements
IHostDebugServerInstance, as varbinary(8000). IHostDebugServerInstance
is the entry point to the integrated Transact-SQL/CLR debugging
interfaces. A debugger calls sp_enable_sql_debug and then unmarshals the
returned blob to get IHostDebugServerInstance. All methods of
IHostDebugServerInstance and related interface implementations in SQL
Server verify the caller is ‘sa’ and return E_ACCESSSDENIED if the check
fails.
This Stored Procedure has been developed for debugging purposes only and
must not be used in a productive environment.
Input: none
Permission Only ‘sa’ can call this stored procedure; otherwise permission error 300 will
be returned.
Syntax: sp_enable_sql_debug @interface_blob output
Example: declare @v varbinary(8000);
exec master.dbo.sp_enable_sql_debug @v output;
select @v
Guidance Addendum Page 79/79
8.2 References