Microsoft SQL Server 2022 Instance Security Technical Implementation Guide
Pick two releases to diff their requirements.
Open a previous version of this STIG.
Digest of Updates ✎ 1
Comparison against the immediately-prior release (V1R1). Rule matching uses the Group Vuln ID. Content-change detection compares the rule’s description, check, and fix text after stripping inline markup — cosmetic-only edits aren’t flagged.
Content changes 1
- V-271268 Medium check SQL Server must protect against a user falsely repudiating by ensuring the NT AUTHORITY SYSTEM account is not used for administration.
- RMF Control
- AC-10
- Severity
- M
- CCI
- CCI-000054
- Version
- SQLI-22-003600
- Vuln IDs
-
- V-271263
- Rule IDs
-
- SV-271263r1108405_rule
Checks: C-75306r1108403_chk
Review the system documentation to determine whether any concurrent session limits have been defined. If it does not, assume a limit of 10 for database administrators and two for all other users. If a mechanism other than a logon trigger is used, verify its correct operation by the appropriate means. If it does not work correctly, this is a finding. Due to excessive CPU consumption when using a logon trigger, an alternative method of limiting concurrent sessions is setting the max connection limit within SQL Server to an appropriate value. This serves to block a distributed denial-of-service (DDOS) attack by limiting the attacker's connections while allowing a database administrator to still force a SQL connection. In SQL Server Management Studio's Object Explorer tree, right-click on the Server Name >> Properties >> Connections Tab. OR Run the query: EXEC sys.sp_configure N'user connections' If the max connection limit is set to 0 (unlimited) or does not match the documented value, this is a finding. Otherwise, determine if a logon trigger exists: In SQL Server Management Studio's Object Explorer tree, expand [SQL Server Instance] >> Server Objects >> Triggers. OR Run the query: SELECT name FROM master.sys.server_triggers; If no triggers are listed, this is a finding. If triggers are listed, identify the trigger(s) limiting the number of concurrent sessions per user. If none are found, this is a finding. If they are present but disabled, this is a finding. Examine the trigger source code for logical correctness and for compliance with the documented limit(s). If errors or variances exist, this is a finding. Verify that the system does execute the trigger(s) each time a user session is established. If it does not operate correctly for all types of user, this is a finding.
Fix: F-75213r1108404_fix
If a trigger consumes too much CPU, an example alternative method for limiting the concurrent users is setting the max connection limit on SQL Server. In SQL Server Management Studio's Object Explorer tree, right-click on the Server Name >> Properties >> Connections Tab >> Set the Maximum Number of Concurrent Connections to a value other than 0 (0 = unlimited), and document it. OR Run the query: EXEC sys.sp_configure N'user connections','5000' /* this is an example max limit */ GO RECONFIGURE WITH OVERRIDE GO Restart SQL Server for the setting to take effect. Reference: https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-user-connections-server-configuration-option? Otherwise, establish the limit(s) appropriate to the type(s) of user account accessing the SQL Server instance, and record them in the system documentation. Implement one or more logon triggers to enforce the limit(s), without exposing the dynamic management views to general users. Example script: CREATE TRIGGER SQL_STIG_Connection_Limit ON ALL SERVER WITH EXECUTE AS 'renamed_sa' /*Make sure to use the renamed SA account here*/ FOR LOGON AS BEGIN If (Select COUNT(1) from sys.dm_exec_sessions WHERE is_user_process = 1 AND original_login_name = ORIGINAL_LOGIN() ) > (CASE ORIGINAL_LOGIN() WHEN 'domain/ima.dba' THEN 150 /*this is a busy DBA's domain account */ WHEN 'application1_login' THEN 6 /* this is a SQL login for an application */ WHEN 'application2_login' THEN 20 /* this is a SQL login for another application */ … ELSE 1 /* All unspecified users are restricted to a single login */ END) BEGIN PRINT 'The login [' + ORIGINAL_LOGIN() + '] has exceeded its concurrent session limit.' ROLLBACK; END END; Reference: https://msdn.microsoft.com/en-us/library/ms189799.aspx
- RMF Control
- AC-2
- Severity
- H
- CCI
- CCI-000015
- Version
- SQLI-22-003800
- Vuln IDs
-
- V-271264
- Rule IDs
-
- SV-271264r1111061_rule
Checks: C-75307r1109229_chk
If the SQL Server is not part of an Active Directory domain, this is Not Applicable. Obtain the fully qualified domain name of the SQL Server instance: 1. Launch Windows Explorer. 2. Right-click "Computer" or "This PC" (Varies by OS level). 3. Click "Properties". Note the value shown for "Full computer name". Note: For a cluster, this value must be obtained from the Failover Cluster Manager. Obtain the TCP port that is supporting the SQL Server instance: 1. Click "Start". 2. Type "SQL Server 2022 Configuration Manager". 3. From the search results, click "SQL Server 2022 Configuration Manager". 4. From the tree on the left, expand "SQL Server Network Configuration". 5. Click "Protocols for <Instance Name>" where <Instance Name> is the name of the instance (MSSQLSERVER is the default name). 6. In the right pane, right-click "TCP/IP" and choose "Properties". 7. In the window that opens, click the "IP Addresses" tab. Note the TCP port configured for the instance. Obtain the service account that is running the SQL Server service: 1. Click "Start". 2. Type "SQL Server 2022 Configuration Manager". 3. From the search results, click "SQL Server 2022 Configuration Manager". 4. From the tree on the left, select "SQL Server Services". Note the account listed in the "Log On As" column for the SQL Server instance being reviewed. 5. Launch a command-line or PowerShell window. 6. Enter the following command where <Service Account> is the identity of the service account: setspn -L <Service Account> Example: setspn -L CONTOSO\sql2016svc 7. Review the Registered Service Principal Names returned. If the listing does not contain the following supported service principal names (SPN) formats, this is a finding. Named instance MSSQLSvc/<FQDN>:[<port> | <instancename>], where: MSSQLSvc is the service that is being registered. <FQDN> is the fully qualified domain name of the server. <port> is the TCP port number. <instancename> is the name of the SQL Server instance. Default instance MSSQLSvc/<FQDN>:<port> | MSSQLSvc/<FQDN>, where: MSSQLSvc is the service that is being registered. <FQDN> is the fully qualified domain name of the server. <port> is the TCP port number. If the MSSQLSvc service is registered for any fully qualified domain names that do not match the current server, this may indicate the service account is shared across SQL Server instances. Review server documentation, if the sharing of service accounts across instances is not documented and authorized, this is a finding.
Fix: F-75214r1108407_fix
Ensure Service Principal Names (SPNs) are properly registered for the SQL Server instance. Use the Microsoft Kerberos Configuration Manager to review Kerberos configuration issues for a given SQL Server instance. https://www.microsoft.com/en-us/download/details.aspx?id=39046 Alternatively, SPNs for SQL Server can be manually registered. For other connections that support Kerberos the SPN is registered in the format MSSQLSvc/<FQDN>/<instancename> for a named instance. The format for registering the default instance is MSSQLSvc/<FQDN>. Using an account with permissions to register SPNs, issue the following commands from a command-prompt: setspn -S MSSQLSvc/<Fully Qualified Domain Name> <Service Account> setspn -S MSSQLSvc/<Fully Qualified Domain Name>:<TCP Port> <Service Account> For a named instance, use: setspn -S MSSQLSvc/<FQDN>:<instancename> <Service Account> setspn -S MSSQLSvc/<FQDN>:<TCP Port> <Service Account> Restart the SQL Server instance. More information regarding this process is available at https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/register-a-service-principal-name-for-kerberos-connections#Manual.
- RMF Control
- AC-2
- Severity
- H
- CCI
- CCI-000015
- Version
- SQLI-22-003700
- Vuln IDs
-
- V-271265
- Rule IDs
-
- SV-271265r1108933_rule
Checks: C-75308r1108409_chk
Determine whether SQL Server is configured to use only Windows authentication. In the Object Explorer in SQL Server Management Studio (SSMS), right-click on the server instance. Select "Properties", then select the Security page. If Windows Authentication Mode is selected, this is not a finding. OR In a query interface such as the SSMS Transact-SQL editor, run the statement: SELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly') WHEN 1 THEN 'Windows Authentication' WHEN 0 THEN 'Windows and SQL Server Authentication' END as [Authentication Mode] If the returned value in the "Authentication Mode" column is "Windows Authentication", this is not a finding. Mixed mode (both SQL Server authentication and Windows authentication) is in use. If the need for mixed mode has not been documented and approved by the information system security officer (ISSO)/information system security manager (ISSM), this is a finding. From the documentation, obtain the list of accounts authorized to be managed by SQL Server. Determine the accounts (SQL Logins) actually managed by SQL Server. Run the statement: SELECT name FROM sys.sql_logins WHERE type_desc = 'SQL_LOGIN' AND is_disabled = 0; If any accounts listed by the query are not listed in the documentation, this is a finding.
Fix: F-75215r1108932_fix
If mixed mode is required, document the need and justification; describe the measures taken to ensure the use of SQL Server authentication is kept to a minimum; describe the measures taken to safeguard passwords; and list or describe the SQL Logins used. Documentation must be approved by the ISSO/ISSM. If mixed mode is not required, disable it as follows: 1. In the SSMS Object Explorer, right-click on the server instance. 2. Select Properties >> Security page. 3. Click the radio button for "Windows Authentication Mode". 4. Click "OK". 5. Restart the SQL Server instance. OR Run the statement: USE [master] EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2 GO Restart the SQL Server instance. For each account being managed by SQL Server but not requiring it, drop or disable the SQL Login. Replace it with an appropriately configured account, as needed. To drop or disable a login in the SSMS Object Explorer, navigate to "Security Logins". Right-click on the login name and click "Delete" or "Disable". To drop or disable a login by using a query: USE master; DROP LOGIN login_name; ALTER LOGIN login_name DISABLE; Dropping a login does not delete the equivalent database user(s). There may be more than one database containing a user mapped to the login. Drop the user(s) unless still needed. To drop a user in the SSMS Object Explorer: Navigate to Databases >> Security Users. Right-click on the username. Click "Delete". To drop a user via a query: USE database_name; DROP USER <user_name>;
- RMF Control
- AC-3
- Severity
- H
- CCI
- CCI-000213
- Version
- SQLI-22-003900
- Vuln IDs
-
- V-271266
- Rule IDs
-
- SV-271266r1117167_rule
Checks: C-75309r1108412_chk
Review the system documentation to determine the required levels of protection for DBMS server securables by type of login. Review the permissions in place on the server. If the permissions do not match the documented requirements, this is a finding. Use the supplemental file "Instance permissions assignments to logins and roles.sql".
Fix: F-75216r1108413_fix
Use GRANT, REVOKE, DENY, ALTER SERVER ROLE … ADD MEMBER … and/or ALTER SERVER ROLE …. DROP MEMBER statements to add and remove permissions on server-level securables, bringing them into line with the documented requirements.
- RMF Control
- AU-10
- Severity
- M
- CCI
- CCI-000166
- Version
- SQLI-22-004200
- Vuln IDs
-
- V-271267
- Rule IDs
-
- SV-271267r1108417_rule
Checks: C-75310r1108415_chk
Execute the following: SELECT name FROM sys.server_principals WHERE type in ('U','G') AND name LIKE '%$' If no logins are returned, this is not a finding. If logins are returned, determine whether each login is a computer account. Launch PowerShell and execute the following code: Note: <name> represents the username portion of the login. For example, if the login is "CONTOSO\user1$", the username is "user1". ([ADSISearcher]"(&(ObjectCategory=Computer)(Name=<name>))").FindAll() If no account information is returned, this is not a finding. If account information is returned, this is a finding.
Fix: F-75217r1108416_fix
Remove all logins that were returned in the check content.
- RMF Control
- AU-10
- Severity
- M
- CCI
- CCI-000166
- Version
- SQLI-22-004100
- Vuln IDs
-
- V-271268
- Rule IDs
-
- SV-271268r1136917_rule
Checks: C-75311r1136916_chk
Execute the following queries. The first query checks for clustering and availability groups being provisioned in the database engine. The second query lists permissions granted to the local system account. SELECT SERVERPROPERTY('IsClustered') AS [IsClustered], SERVERPROPERTY('IsHadrEnabled') AS [IsHadrEnabled] EXECUTE AS LOGIN = 'NT AUTHORITY\SYSTEM' SELECT * FROM fn_my_permissions(NULL, 'server') REVERT GO If "IsClustered" returns "1", "IsHadrEnabled" returns "0", and any permissions have been granted to the Local System account beyond "CONNECT SQL", "VIEW SERVER STATE", "VIEW ANY DATABASE", "VIEW SERVER PERFORMANCE STATE", and "VIEW SERVER SECURITY STATE", this is a finding. If "IsHadrEnabled" returns "1" and any permissions have been granted to the Local System account beyond "CONNECT SQL", "CREATE AVAILABILITY GROUP", "ALTER ANY AVAILABILITY GROUP", "VIEW SERVER STATE", "VIEW ANY DATABASE", "VIEW SERVER PERFORMANCE STATE", and "VIEW SERVER SECURITY STATE", this is a finding. If both "IsClustered" and "IsHadrEnabled" return "0" and any permissions have been granted to the Local System account beyond "CONNECT SQL" and "VIEW ANY DATABASE", this is a finding.
Fix: F-75218r1108419_fix
Remove permissions that were identified as not allowed in the check content. USE Master; REVOKE <Permission> TO [NT AUTHORITY\SYSTEM] GO To grant permissions to services or applications, use the Service SID of the service or a domain service account.
- RMF Control
- AU-10
- Severity
- M
- CCI
- CCI-000166
- Version
- SQLI-22-004000
- Vuln IDs
-
- V-271269
- Rule IDs
-
- SV-271269r1108423_rule
Checks: C-75312r1108421_chk
Obtain the list of authorized SQL Server accounts in the system documentation. Determine if any accounts are shared. A shared account is defined as a username and password that are used by multiple individuals to log into SQL Server. An example of a shared account is the SQL Server installation account. Windows Groups are not shared accounts as the group itself does not have a password. If accounts are determined to be shared, determine if individuals are first individually authenticated. If individuals are not individually authenticated before using the shared account (e.g., by the operating system or by an application making calls to the database), this is a finding. The key is individual accountability. If this can be traced, this is not a finding. If accounts are determined to be shared, determine if they are directly accessible to end users. If so, this is a finding. Review contents of audit logs, traces, and data tables to confirm that the identity of the individual user performing the action is captured. If shared identifiers are found and are not accompanied by individual identifiers, this is a finding. Note: Privileged installation accounts may be required to be accessed by the DBA or other administrators for system maintenance. In these cases, each use of the account must be logged in some manner to assign accountability for any actions taken during the use of the account.
Fix: F-75219r1108422_fix
Remove user-accessible shared accounts and use individual user IDs. Build/configure applications to ensure successful individual authentication prior to shared account access. Ensure each user's identity is received and used in audit data in all relevant circumstances. Design, develop, and implement a method to log use of any account to which more than one person has access. Restrict interactive access to shared accounts to the fewest persons possible.
- RMF Control
- AU-12
- Severity
- M
- CCI
- CCI-000169
- Version
- SQLI-22-004300
- Vuln IDs
-
- V-271270
- Rule IDs
-
- SV-271270r1108426_rule
Checks: C-75313r1108424_chk
Review the server documentation to determine if any additional events are required to be audited. If no additional events are required, this is not a finding. Execute the following to get all of the installed audits: SELECT name AS 'Audit Name', status_desc AS 'Audit Status', audit_file_path AS 'Current Audit File' FROM sys.dm_server_audit_status All currently defined audits for the SQL server instance will be listed. If no audits are returned, this is a finding. To view the actions being audited by the audits, execute the following: SELECT a.name AS 'AuditName', s.name AS 'SpecName', d.audit_action_name AS 'ActionName', d.audited_result AS 'Result' FROM sys.server_audit_specifications s JOIN sys.server_audits a ON s.audit_guid = a.audit_guid JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id WHERE a.is_state_enabled = 1 Compare the documentation to the list of generated audit events. If there are any missing events, this is a finding.
Fix: F-75220r1108425_fix
Add all required audit events to the STIG-compliant audit specification server documentation.
- RMF Control
- AU-12
- Severity
- M
- CCI
- CCI-000171
- Version
- SQLI-22-004400
- Vuln IDs
-
- V-271271
- Rule IDs
-
- SV-271271r1108429_rule
Checks: C-75314r1108427_chk
Obtain the list of approved audit maintainers from the system documentation. Review the server roles and individual logins that have the following role memberships, all of which enable the ability to create and maintain audit definitions. sysadmin dbcreator Review the server roles and individual logins that have the following permissions, all of which enable the ability to create and maintain audit definitions. ALTER ANY SERVER AUDIT CONTROL SERVER ALTER ANY DATABASE CREATE ANY DATABASE Use the following query to determine the roles and logins that have the listed permissions: SELECT-- DISTINCT CASE WHEN SP.class_desc IS NOT NULL THEN CASE WHEN SP.class_desc = 'SERVER' AND S.is_linked = 0 THEN 'SERVER' WHEN SP.class_desc = 'SERVER' AND S.is_linked = 1 THEN 'SERVER (linked)' ELSE SP.class_desc END WHEN E.name IS NOT NULL THEN 'ENDPOINT' WHEN S.name IS NOT NULL AND S.is_linked = 0 THEN 'SERVER' WHEN S.name IS NOT NULL AND S.is_linked = 1 THEN 'SERVER (linked)' WHEN P.name IS NOT NULL THEN 'SERVER_PRINCIPAL' ELSE '???' END AS [Securable Class], CASE WHEN E.name IS NOT NULL THEN E.name WHEN S.name IS NOT NULL THEN S.name WHEN P.name IS NOT NULL THEN P.name ELSE '???' END AS [Securable], P1.name AS [Grantee], P1.type_desc AS [Grantee Type], sp.permission_name AS [Permission], sp.state_desc AS [State], P2.name AS [Grantor], P2.type_desc AS [Grantor Type], R.name AS [Role Name] FROM sys.server_permissions SP INNER JOIN sys.server_principals P1 ON P1.principal_id = SP.grantee_principal_id INNER JOIN sys.server_principals P2 ON P2.principal_id = SP.grantor_principal_id FULL OUTER JOIN sys.servers S ON SP.class_desc = 'SERVER' AND S.server_id = SP.major_id FULL OUTER JOIN sys.endpoints E ON SP.class_desc = 'ENDPOINT' AND E.endpoint_id = SP.major_id FULL OUTER JOIN sys.server_principals P ON SP.class_desc = 'SERVER_PRINCIPAL' AND P.principal_id = SP.major_id FULL OUTER JOIN sys.server_role_members SRM ON P.principal_id = SRM.member_principal_id LEFT OUTER JOIN sys.server_principals R ON SRM.role_principal_id = R.principal_id WHERE sp.permission_name IN ('ALTER ANY SERVER AUDIT','CONTROL SERVER','ALTER ANY DATABASE','CREATE ANY DATABASE') OR R.name IN ('sysadmin','dbcreator') If any of the logins, roles, or role memberships returned have permissions that are not documented, or the documented audit maintainers do not have permissions, this is a finding.
Fix: F-75221r1108428_fix
Create a server role specifically for audit maintainers and give it permission to maintain audits without granting it unnecessary permissions (the role name used here is an example; other names may be used): CREATE SERVER ROLE SERVER_AUDIT_MAINTAINERS; GO GRANT ALTER ANY SERVER AUDIT TO SERVER_AUDIT_MAINTAINERS; GO Use REVOKE and/or DENY and/or ALTER SERVER ROLE ... DROP MEMBER ... statements to remove the ALTER ANY SERVER AUDIT permission from all logins. Then, for each authorized login, run the statement: ALTER SERVER ROLE SERVER_AUDIT_MAINTAINERS ADD MEMBER; GO Use REVOKE and/or DENY and/or ALTER SERVER ROLE ... DROP MEMBER ... statements to remove CONTROL SERVER, ALTER ANY DATABASE and CREATE ANY DATABASE permissions from logins that do not need them.
- RMF Control
- AU-12
- Severity
- M
- CCI
- CCI-000172
- Version
- SQLI-22-004600
- Vuln IDs
-
- V-271272
- Rule IDs
-
- SV-271272r1109110_rule
Checks: C-75315r1108988_chk
Review the system documentation to determine if SQL Server is required to audit when the following events occur: - Attempts to retrieve privilege/permission/role membership information. - Security objects are accessed, modified, or deleted. - Data classifications (e.g., classification levels/security levels) are accessed, modified, or deleted. - Any other specified objects are accessed, modified, or deleted as required by the site. If SQL Server is not required to audit any of the above, this is not a finding. If the documentation does not exist, this is a finding. Determine if an audit is configured and started by executing the following query. If no records are returned, this is a finding. SELECT name AS 'Audit Name', status_desc AS 'Audit Status', audit_file_path AS 'Current Audit File' FROM sys.dm_server_audit_status If auditing the retrieval of the above information or objects is required, execute the following to verify the SCHEMA_OBJECT_ACCESS_GROUP is included in the server audit specification: SELECT a.name AS 'AuditName', s.name AS 'SpecName', d.audit_action_name AS 'ActionName', d.audited_result AS 'Result' FROM sys.server_audit_specifications s JOIN sys.server_audits a ON s.audit_guid = a.audit_guid JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id WHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP' If the SCHEMA_OBJECT_ACCESS_GROUP is not returned in an active audit, this is a finding.
Fix: F-75222r1108989_fix
Deploy an audit to log when attempts to access privileges, categorized information, security objects, and any other specific objects occur. Refer to the supplemental file "SQL 2022 Audit.sql".
- RMF Control
- AU-14
- Severity
- M
- CCI
- CCI-001464
- Version
- SQLI-22-004700
- Vuln IDs
-
- V-271273
- Rule IDs
-
- SV-271273r1109234_rule
Checks: C-75316r1108433_chk
When audits are enabled, they start up when the instance starts. Refer to https://msdn.microsoft.com/en-us/library/cc280386.aspx#Anchor_2 Check if an audit is configured and enabled by executing the following query: SELECT name AS 'Audit Name', status_desc AS 'Audit Status', audit_file_path AS 'Current Audit File' FROM sys.dm_server_audit_status WHERE status_desc = 'STARTED' All currently defined audits for the SQL server instance will be listed. If no audits are returned, this is a finding.
Fix: F-75223r1109233_fix
Configure the SQL audit(s) to automatically start during system startup. ALTER SERVER AUDIT [<Server Audit Name>] WITH STATE = ON Execute the following: SELECT name AS 'Audit Name', status_desc AS 'Audit Status', audit_file_path AS 'Current Audit File' FROM sys.dm_server_audit_status WHERE status_desc = 'STARTED' Ensure the SQL STIG Audit is configured to initiate session auditing upon startup.
- RMF Control
- AU-3
- Severity
- M
- CCI
- CCI-000135
- Version
- SQLI-22-005500
- Vuln IDs
-
- V-271280
- Rule IDs
-
- SV-271280r1108456_rule
Checks: C-75323r1108454_chk
If a SQL Server Audit is not in use for audit purposes, this is a finding unless a third-party product is being used that can perform detailed auditing for SQL Server. Review system documentation to determine whether SQL Server is required to audit any events, and any fields, in addition to those in the standard audit. If there are none specified, this is not a finding. If SQL Server Audit is in use, compare the audit specification(s) with the documented requirements. If any such requirement is not satisfied by the audit specification(s) (or by supplemental, locally deployed mechanisms), this is a finding.
Fix: F-75230r1108455_fix
Design and deploy an audit that captures all auditable events and data items. In the event a third-party tool is used for auditing, it must contain all the required information, including but not limited to, events, type, location, subject, date and time, and by whom the change occurred. Implement additional custom audits to capture the additional organizational required information.
- RMF Control
- AU-9
- Severity
- M
- CCI
- CCI-000162
- Version
- SQLI-22-005900
- Vuln IDs
-
- V-271282
- Rule IDs
-
- SV-271282r1109273_rule
Checks: C-75325r1108460_chk
If the database is set up to write audit logs using APPLICATION or SECURITY event logs rather than writing to a file, this is Not Applicable. Obtain the SQL Server Audit file location(s) by running the following SQL script: SELECT log_file_path AS "Audit Path" FROM sys.server_file_audits For each audit, the path column will give the location of the file. Verify that all audit files have the correct permissions by doing the following for each audit file: Navigate to audit folder location(s) using a command prompt or Windows Explorer. Right-click the file/folder and click "Properties". On the "Security" tab, verify the following permissions are applied: Administrator (read) Users (none) Audit Administrator (Full Control) Auditors group (Read) SQL Server Service SID OR Service Account (Full Control) SQL Server SQL Agent Service SID OR Service Account, if SQL Server Agent is in use. (Read, Execute, Write) If any less restrictive permissions are present (and not specifically justified and approved), this is a finding.
Fix: F-75232r1109273_fix
Modify audit file permissions to meet the requirement to protect against unauthorized access. Application event log and security log permissions are covered in the Windows Server STIGs. Reference these depending on the OS in use. Navigate to audit folder location(s) using a command prompt or Windows Explorer. Right-click the file and click "Properties". On the Security tab, modify the security permissions to: Administrator (read) Users (none) Audit Administrator(Full Control) Auditors group (Read) SQL Server Service SID OR Service Account (Full Control) [Notes 1, 2] SQL Server SQL Agent Service SID OR Service Account, if SQL Server Agent is in use. (Read, Execute, Write) [Notes 1, 2] ----- Note 1: It is highly advisable to use a separate account for each service. When installing SQL Server in single-server mode, users can opt to have these provisioned for them. These automatically generated accounts are referred to as virtual accounts. Each virtual account has an equivalent Service SID with the same name. The installer also creates an equivalent SQL Server login, also with the same name. Applying folder and file permissions to Service SIDs rather than to domain accounts or local computer accounts provides tighter control, because these permissions are available only to the specific service when it is running and not in any other context. However, when using failover clustering, a domain account must be specified at installation, rather than a virtual account. For more on this topic, refer to http://msdn.microsoft.com/en-us/library/ms143504(v=sql.130).aspx. Note 2: Tips for adding a service SID/virtual account to a folder's permission list: 1. In Windows Explorer, right-click the folder and select "Properties". 2. Select the "Security" tab. 3. Click "Edit". 4. Click "Add". 5. Click "Locations". 6. Select the computer name. 7. Search for the name. 7.a. SQL Server Service 7.a.i. Type "NT SERVICE\MSSQL" and click "Check Names". (This is the first 16 characters of the name. At least one character must follow "NT SERVICE\"; this will present with a list of all matches. If the full, correct name was typed, step 7.a.ii is bypassed.) 7.a.ii. Select the "MSSQL$" user and click "OK". 7.b. SQL Agent Service 7.b.i. Type "NT SERVICE\SQL" and click "Check Names". 7.b.ii. Select the "SQLAgent$" user and click "OK". 8. Click "OK". 9. Permission like a normal user from here.
- RMF Control
- AU-9
- Severity
- M
- CCI
- CCI-001493
- Version
- SQLI-22-006300
- Vuln IDs
-
- V-271283
- Rule IDs
-
- SV-271283r1108465_rule
Checks: C-75326r1108463_chk
Check the server documentation for a list of approved users with access to SQL Server Audits. To create, alter, or drop a server audit, principals require the ALTER ANY SERVER AUDIT or the CONTROL SERVER permission. Review the SQL Server permissions granted to principals. Look for permissions ALTER ANY SERVER AUDIT, ALTER ANY DATABASE AUDIT, CONTROL SERVER: SELECT login.name, perm.permission_name, perm.state_desc FROM sys.server_permissions perm JOIN sys.server_principals login ON perm.grantee_principal_id = login.principal_id WHERE permission_name in ('ALTER ANY DATABASE AUDIT', 'ALTER ANY SERVER AUDIT', 'CONTROL SERVER') and login.name not like '##MS_%'; If unauthorized accounts have these privileges, this is a finding.
Fix: F-75233r1108464_fix
Remove audit-related permissions from individuals and roles not authorized to have them. USE master; DENY [ALTER ANY SERVER AUDIT] TO [User]; GO
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001499
- Version
- SQLI-22-006600
- Vuln IDs
-
- V-271284
- Rule IDs
-
- SV-271284r1109111_rule
Checks: C-75327r1108991_chk
Review server documentation to determine the process by which shared software libraries are monitored for change. Ensure the process alerts for changes in a file's ownership, modification dates, and hash value at a minimum. If alerts do not at least hash their value, this is a finding. To determine the location for these instance-specific binaries: 1. Launch SQL Server Management Studio (SSMS). 2. Connect to the instance to be reviewed. 3. Right-click server name in Object Explorer. 4. Click "Facets". 5. Select the "Server" facet. 6. Record the value for the "RootDirectory" facet property. Tip: Use the Get-FileHash cmdlet shipped with PowerShell 5.0 to get the SHA-2 hash of one or more files.
Fix: F-75234r1108992_fix
Implement and document a process by which changes made to software libraries are monitored and alerted. A PowerShell based hashing solution is one such process. The Get-FileHash command can be used to compute the SHA-2 hash of one or more files. For more information, refer to the following link: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/get-filehash Using the Export-Clixml command, a baseline can be established and exported to a file: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-clixml?view=powershell-7.5 Using the Compare-Object command, a comparison of the latest baseline versus the original baseline can expose the differences: https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-powershell-1.0/ee156812(v=technet.10)?redirectedfrom=MSDN
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001499
- Version
- SQLI-22-006500
- Vuln IDs
-
- V-271285
- Rule IDs
-
- SV-271285r1109236_rule
Checks: C-75328r1109235_chk
Review Server documentation to determine the authorized owner and users or groups with modify rights for this SQL instance's binary files. Additionally check the owner and users or groups with modify rights for shared software library paths on disk. If any unauthorized users are granted modify rights or the owner is incorrect, this is a finding. To determine the location for these instance-specific binaries: 1. Launch SQL Server Management Studio (SSMS). 2. Connect to the instance to be reviewed. 3. Right-click server name in "Object Explorer". 4. Click "Facets". 5. Select the "Server" facet. 6. Record the value for the "RootDirectory" facet property. 7. Navigate to the folder above and review the "Binn" subdirectory. TIP: Use the Get-FileHash cmdlet shipped with PowerShell 5.0 to get the SHA-2 hash of one or more files.
Fix: F-75235r1108470_fix
Change the ownership of all shared software libraries on disk to the authorized account. Remove any modify permissions granted to unauthorized users or groups.
- RMF Control
- CM-5
- Severity
- H
- CCI
- CCI-001499
- Version
- SQLI-22-006700
- Vuln IDs
-
- V-271286
- Rule IDs
-
- SV-271286r1108474_rule
Checks: C-75329r1108472_chk
From the system documentation, obtain the list of accounts authorized to install/update SQL Server. Run the following PowerShell command to list all users who have installed/modified SQL Server 2022 software and compare the list against those persons who are qualified and authorized to use the software. sl "C:\Program files\Microsoft SQL Server\160\Setup Bootstrap\Log" Get-ChildItem -Recurse | Select-String -Pattern "LogonUser = " If any accounts are shown that are not authorized in the system documentation, this is a finding.
Fix: F-75236r1108473_fix
From a command prompt, open lusrmgr.msc. Navigate to "Users" and right-click "Individual User". Select "Properties", then "Member Of". Configure SQL Server and OS settings and access controls to restrict user access to objects and data that the user is authorized to view/use.
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001499
- Version
- SQLI-22-006800
- Vuln IDs
-
- V-271287
- Rule IDs
-
- SV-271287r1108843_rule
Checks: C-75330r1108843_chk
Determine the directory in which SQL Server has been installed: Using SQL Server Management Studio's Object Explorer, right-click [SQL Server Instance], select "Facets", then record the value of RootDirectory. Determine the Operating System directory: 1. Click "Start". 2. Type "Run". 3. Press "Enter". 4. Type "%windir%". 5. Click "Ok". 6. Record the value in the address bar. Verify the SQL Server RootDirectory is not in the Operating System directory. Compare the SQL RootDirectory and the Operating System directory. If the SQL RootDirectory is in the same directory as the Operating System, this is a finding. Verify the SQL Server RootDirectory is not in another application's directory. Navigate to the SQL RootDirectory using Windows Explorer. Examine each directory for evidence another application is stored in it. If evidence exists the SQL RootDirectory is in another application's directory, this is a finding. If the SQL RootDirectory is not in the Operating System directory or another application's directory, this is not a finding. Examples: 1. The Operating System directory is "C:\Windows". The SQL RootDirectory is "D:\Program Files\MSSQLSERVER\MSSQL". The MSSQLSERVER directory is not living in the Operating System directory or the directory of another application. This is not a finding. 2. The Operating System directory is "C:\Windows". The SQL RootDirectory is "C:\Windows\MSSQLSERVER\MSSQL". This is a finding. 3. The Operating System directory is "C:\Windows". The SQL RootDirectory is "D:\Program Files\Microsoft Office\MSSQLSERVER\MSSQL". The MSSQLSERVER directory is in the Microsoft Office directory, which indicates Microsoft Office is installed here. This is a finding.
Fix: F-75237r1108476_fix
Reinstall SQL Server application components using dedicated directories that are separate from the operating system. Relocate or reinstall other application software that currently shares directories with SQL Server components separate from the operating system and/or temporary storage.
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-006900
- Vuln IDs
-
- V-271290
- Rule IDs
-
- SV-271290r1109112_rule
Checks: C-75333r1108994_chk
Review vendor documentation and vendor websites to identify vendor-provided demonstration or sample databases, database applications, objects, and files. Review the SQL Server to determine if any of the demonstration and sample databases, database applications, or files are installed in the database or included with the SQL Server Instance. Run the following query to check for names matching known sample databases. Sample databases may have been renamed, so this is not an exhaustive list. SELECT name FROM sys.databases WHERE name LIKE '%pubs%' OR name LIKE '%northwind%' OR name LIKE '%adventureworks%' OR name LIKE '%wideworldimporters%' OR name LIKE '%contoso%' If any sample databases are found, this is a finding.
Fix: F-75240r1108485_fix
Remove all demonstration or sample databases from production instances.
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-007000
- Vuln IDs
-
- V-271291
- Rule IDs
-
- SV-271291r1108899_rule
Checks: C-75334r1108854_chk
From the server documentation, obtain a listing of required components. Generate a listing of components installed on the server. 1. Click "Start". 2. Type "SQL Server 2022 Installation Center". 3. Launch the program. 4. Click "Tools". 5. Click "Installed SQL Server features discovery report". 6. Compare the feature listing against the required components listing. If any features are installed, but are not required, this is a finding.
Fix: F-75241r1108488_fix
Remove all features that are not required.
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-017900
- Vuln IDs
-
- V-271292
- Rule IDs
-
- SV-271292r1111143_rule
Checks: C-75335r1111141_chk
To determine if [Replication Xps] is enabled, execute the following command: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'Replication Xps' If [value_in_use] is a [1], review the system documentation to determine whether the use of [Replication Xps] is approved. If it is not approved, this is a finding.
Fix: F-75242r1111142_fix
Disable use of or remove any external application executable object definitions that are not approved. To disable the use of [Replication Xps] option, from the query prompt: EXEC SP_CONFIGURE 'show advanced options', 1; RECONFIGURE WITH OVERRIDE; EXEC SP_CONFIGURE 'replication xps', 0; RECONFIGURE WITH OVERRIDE; EXEC SP_CONFIGURE 'show advanced options', 0; RECONFIGURE WITH OVERRIDE; GO RECONFIGURE; GO
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-017700
- Vuln IDs
-
- V-271293
- Rule IDs
-
- SV-271293r1111138_rule
Checks: C-75336r1111136_chk
To determine if [External Scripts Enabled] is enabled, execute the following command: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'External Scripts Enabled' If [value_in_use] is a [1], review the system documentation to determine whether the use of [External Scripts Enabled] is approved. If it is not approved, this is a finding.
Fix: F-75243r1111137_fix
Disable use of or remove any external application executable object definitions that are not approved. To disable the use of [External Scripts Enabled] option, from the query prompt: EXEC SP_CONFIGURE 'External Scripts Enabled', 0; RECONFIGURE WITH OVERRIDE;
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-017600
- Vuln IDs
-
- V-271295
- Rule IDs
-
- SV-271295r1111135_rule
Checks: C-75338r1111133_chk
To determine if [Remote Data Archive] is enabled, execute the following command: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'Remote Data Archive' If [value_in_use] is a [1], review the system documentation to determine whether the use of [Remote Data Archive] is approved. If it is not approved, this is a finding.
Fix: F-75245r1111134_fix
Disable use of or remove any external application executable object definitions that are not approved. To disable the use of [Remote Data Archive] option, from the query prompt: EXEC SP_CONFIGURE 'Remote Data Archive', 0; RECONFIGURE WITH OVERRIDE;
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-017500
- Vuln IDs
-
- V-271296
- Rule IDs
-
- SV-271296r1111132_rule
Checks: C-75339r1111130_chk
To determine if [Allow Polybase Export] is enabled, execute the following command: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'Allow Polybase Export' If [value_in_use] is a [1], review the system documentation to determine whether the use of [Allow Polybase Export] is approved. If it is not approved, this is a finding.
Fix: F-75246r1111131_fix
Disable use of or remove any external application executable object definitions that are not approved. To disable the use of [Allow Polybase Export] option, from the query prompt: EXEC SP_CONFIGURE 'Allow Polybase Export', 0; RECONFIGURE WITH OVERRIDE;
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-017400
- Vuln IDs
-
- V-271297
- Rule IDs
-
- SV-271297r1111129_rule
Checks: C-75340r1111127_chk
To determine if [Hadoop Connectivity] is enabled, execute the following command: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'Hadoop Connectivity' If [value_in_use] is a [1], review the system documentation to determine whether the use of [Hadoop Connectivity] is approved. If it is not approved, this is a finding.
Fix: F-75247r1111128_fix
Disable use of or remove any external application executable object definitions that are not approved. To disable the use of [Hadoop Connectivity] option, from the query prompt: EXEC SP_CONFIGURE 'hadoop connectivity', 0; RECONFIGURE WITH OVERRIDE;
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-017200
- Vuln IDs
-
- V-271298
- Rule IDs
-
- SV-271298r1111126_rule
Checks: C-75341r1111124_chk
To determine if [Remote Access] is enabled, execute the following command: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'Remote Access' If [value_in_use] is a [1], review the system documentation to determine whether the use of [Remote Access] is approved. If it is not approved, this is a finding.
Fix: F-75248r1111125_fix
Disable use of [Remote Access] if it is not authorized. To disable the use of [Remote Access], from the query prompt: EXEC SP_CONFIGURE 'remote access', 0; RECONFIGURE WITH OVERRIDE;
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-007500
- Vuln IDs
-
- V-271299
- Rule IDs
-
- SV-271299r1108513_rule
Checks: C-75342r1108511_chk
A linked server allows for access to distributed, heterogeneous queries against OLE DB data sources. After a linked server is created, distributed queries can be run against this server, and queries can join tables from more than one data source. If the linked server is defined as an instance of SQL Server, remote stored procedures can be executed. To obtain a list of linked servers, execute the following command: SELECT name FROM sys.servers s WHERE s.is_linked = 1 Review the system documentation to determine whether the linked servers listed are required and approved. If it is not approved, this is a finding. Run the following to get a linked server login mapping: SELECT s.name, p.principal_id, l.remote_name FROM sys.servers s JOIN sys.linked_logins l ON s.server_id = l.server_id LEFT JOIN sys.server_principals p ON l.local_principal_id = p.principal_id WHERE s.is_linked = 1 Review the linked login mapping and check the remote name as it can impersonate sysadmin. If a login in the list is impersonating sysadmin and system documentation does not require this, it is a finding.
Fix: F-75249r1108512_fix
Remove any linked servers and all associated logins that are not authorized. To remove a linked server and all associated logins run the following: sp_dropserver 'LinkedServerName', 'droplogins'; To remove a login from a linked server run the following: EXEC sp_droplinkedsrvlogin 'LoginName', NULL;
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-007400
- Vuln IDs
-
- V-271300
- Rule IDs
-
- SV-271300r1109264_rule
Checks: C-75343r1109264_chk
Extended stored procedures are DLLs that an instance of SQL Server can dynamically load and run. Extended stored procedures run directly in the address space of an instance of SQL Server and are programmed by using the SQL Server Extended Stored Procedure API. Nonstandard extended stored procedures can compromise the integrity of the SQL Server process. This feature will be removed in a future version of SQL Server. Do not use this feature in new development work and modify applications that currently use this feature as soon as possible. To determine if nonstandard extended stored procedures exist, run the following: USE [master] GO DECLARE @xplist AS TABLE ( xp_name sysname, source_dll nvarchar(255) ) INSERT INTO @xplist EXEC sp_helpextendedproc SELECT X.xp_name, X.source_dll, O.is_ms_shipped FROM @xplist X JOIN sys.all_objects O ON X.xp_name = O.name WHERE O.is_ms_shipped = 0 ORDER BY X.xp_name If any records are returned, review the system documentation to determine whether the use of nonstandard extended stored procedures are required and approved. If it is not approved, this is a finding.
Fix: F-75250r1108515_fix
Remove any nonstandard extended stored procedures that are not documented and approved using the following: sp_dropextendedproc 'proc name'
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-007300
- Vuln IDs
-
- V-271301
- Rule IDs
-
- SV-271301r1109114_rule
Checks: C-75344r1108999_chk
To determine if [CLR] is enabled, execute the following command: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'clr enabled' If [value_in_use] is a [1], review the system documentation to determine whether the use of [CLR] is approved. If it is not approved, this is a finding.
Fix: F-75251r1109000_fix
Disable use of or remove any CLR code that is not authorized. To disable the use of CLR, from the query prompt: EXEC SP_CONFIGURE 'clr enabled', 0; RECONFIGURE WITH OVERRIDE; For any approved CLR code with Unsafe or External permissions, use the ALTER ASSEMBLY to change the permission set for the assembly and ensure a certificate is configured.
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-007200
- Vuln IDs
-
- V-271302
- Rule IDs
-
- SV-271302r1109113_rule
Checks: C-75345r1108996_chk
To determine if [xp_cmdshell] is enabled, execute the following command: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'xp_cmdshell' If [value_in_use] is a [1], review the system documentation to determine whether the use of [xp_cmdshell] is approved. If it is not approved, this is a finding.
Fix: F-75252r1108997_fix
Disable use of or remove any external application executable object definitions that are not approved. To disable the use of xp_cmdshell, from the query prompt: EXEC SP_CONFIGURE 'show advanced options', 1; RECONFIGURE WITH OVERRIDE; EXEC SP_CONFIGURE 'xp_cmdshell', 0; RECONFIGURE WITH OVERRIDE; EXEC SP_CONFIGURE 'show advanced options', 0; RECONFIGURE WITH OVERRIDE;
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000382
- Version
- SQLI-22-007700
- Vuln IDs
-
- V-271303
- Rule IDs
-
- SV-271303r1109116_rule
Checks: C-75346r1109004_chk
Review SQL Server Configuration for the ports used by SQL Server. To determine whether SQL Server is configured to use a fixed port or dynamic ports, in the right-side pane, double-click on the TCP/IP entry to open the Properties dialog. (The default fixed port is 1433.) Alternatively, run the following SQL query to determine the port used by SQL Server: SELECT ISNULL(CONVERT(VARCHAR(25),local_tcp_port),'Dynamic Ports are Enabled') FROM sys.dm_exec_connections WHERE session_id = @@SPID If any ports in use are in conflict with PPSM guidance and not explained and approved in the system documentation, this is a finding.
Fix: F-75253r1108524_fix
Use SQL Server Configuration to change the ports used by SQL Server to comply with PPSM guidance, or document the need for other ports, and obtain written approval. Close ports no longer needed.
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000382
- Version
- SQLI-22-007600
- Vuln IDs
-
- V-271304
- Rule IDs
-
- SV-271304r1109265_rule
Checks: C-75347r1109265_chk
To determine the protocol(s) enabled for SQL Server, open SQL Server Configuration Manager. In the left pane, expand SQL Server Network Configuration. Click on the entry for the SQL Server instance under review: "Protocols for". The right-side pane displays the protocols enabled for the instance. Alternatively, run the following SQL Script and review the registry_key for enabled protocols. SELECT * FROM sys.dm_server_registry WHERE registry_key like 'HKLM\Software\Microsoft\Microsoft SQL Server\%\MSSQLServer\SuperSocketNetLib\%' AND value_name = 'enabled' AND value_data = 1 If any listed protocols are enabled but not documented and authorized, this is a finding.
Fix: F-75254r1108844_fix
Navigate to SQL Server Configuration Manager >> SQL Server Network Configuration >> Protocols, then right-click on each listed protocol that is enabled but not authorized and select "Disable".
- RMF Control
- IA-2
- Severity
- M
- CCI
- CCI-000764
- Version
- SQLI-22-007800
- Vuln IDs
-
- V-271305
- Rule IDs
-
- SV-271305r1109239_rule
Checks: C-75348r1109006_chk
Obtain the list of authorized SQL Server accounts in the system documentation. Determine if any accounts are shared. A shared account is defined as a username and password that are used by multiple individuals to log in to SQL Server. Active Directory groups are not shared accounts as the group itself does not have a password. Run the following query to return all server-level principals: SELECT name FROM sys.server_principals WHERE type in ('U','S','E') AND name NOT LIKE '%$' If any of the returned accounts are shared, determine if individuals are first individually authenticated. If individuals are not individually authenticated before using the shared account (e.g., by the operating system or possibly by an application making calls to the database), this is a finding. The key is individual accountability. If this can be traced, this is not a finding. If accounts are shared, determine if they are directly accessible to end users. If so, this is a finding. Review contents of audit logs and data tables to confirm that the identity of the individual user performing the action is captured. If shared identifiers are found and not accompanied by individual identifiers, this is a finding. Execute the following query: SELECT name FROM sys.server_principals WHERE type in ('U','S','E') AND name LIKE '%$' If users are returned, determine whether each user is a computer account. Launch PowerShell. Execute the following code: Note: <name> represents the username portion of the user. For example, if the user is "CONTOSO\user1$", the username is "user1". ([ADSISearcher]"(&(ObjectCategory=Computer)(Name=<name>))").FindAll() If no account information is returned, this is not a finding. If account information is returned, this is a finding.
Fix: F-75255r1109007_fix
Remove all shared accounts and computer accounts. To remove users, run the following command for each user: DROP USER [ IF EXISTS ] <user_name>;
- RMF Control
- Severity
- H
- CCI
- CCI-004066
- Version
- SQLI-22-008000
- Vuln IDs
-
- V-271306
- Rule IDs
-
- SV-271306r1109119_rule
Checks: C-75349r1109012_chk
Execute the following query to determine if Contained Databases are used: SELECT * FROM sys.databases WHERE containment = 1 If any records are returned, check the server documentation for a list of authorized contained database users. Execute the following query to ensure contained database users are not using SQL Authentication: EXEC sp_MSforeachdb 'USE [?]; SELECT DB_NAME() AS DatabaseName, * FROM sys.database_principals dp inner join sys.databases d on d.name = dp.name WHERE dp.authentication_type = 2 and d.containment = 1' If any records are returned, this is a finding.
Fix: F-75256r1109013_fix
Configure SQL Server contained databases to have users originating from Microsoft Entra (Azure Active Directory) principals. Remove any users not created from Microsoft Entra principals. Reference Contained Databases: https://learn.microsoft.com/en-us/sql/relational-databases/databases/contained-databases?
- RMF Control
- Severity
- H
- CCI
- CCI-004066
- Version
- SQLI-22-007900
- Vuln IDs
-
- V-271307
- Rule IDs
-
- SV-271307r1109241_rule
Checks: C-75350r1109240_chk
Check for use of SQL Authentication: SELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly') WHEN 1 THEN 'Windows Authentication' WHEN 0 THEN 'SQL Authentication' END as [Authentication Mode] If the returned value in the "Authentication Mode" column is "Windows Authentication", this is not a finding. SQL Server should be configured to inherit password complexity and password lifetime rules from the operating system. Review the SQL Server Instance to ensure logons are created with respect to the complexity settings and password lifetime rules by running the following statement: SELECT [name], is_expiration_checked, is_policy_checked,* FROM sys.sql_logins WHERE is_disabled = 0 AND name NOT IN ('##MS_PolicyTsqlExecutionLogin##','##MS_PolicyEventProcessingLogin##') AND sid <> 1 If any account does not have both "is_expiration_checked" and "is_policy_checked" equal to "1", this is a finding.
Fix: F-75257r1109010_fix
Ensure check of policy and expiration are enforced when SQL logins are created. Use the command below to set CHECK_EXPIRATION and CHECK_POLICY for any login found to be noncompliant: ALTER LOGIN [LoginnameHere] WITH CHECK_EXPIRATION=ON; ALTER LOGIN [LoginNameHere] WITH CHECK_POLICY=ON; New SQL authenticated logins must be created with CHECK_EXPIRATION and CHECK_POLICY set to ON. CREATE LOGIN [LoginNameHere] WITH PASSWORD = 'ComplexPasswordHere', CHECK_EXPIRATION = ON, CHECK_POLICY = ON;
- RMF Control
- IA-5
- Severity
- H
- CCI
- CCI-000197
- Version
- SQLI-22-008200
- Vuln IDs
-
- V-271309
- Rule IDs
-
- SV-271309r1109243_rule
Checks: C-75352r1108934_chk
If SQL Server is using "Windows Authentication mode" this requirement can be marked as Not Applicable. Open SQL Server Configuration Manager by typing "SQL Server 2022 Configuration Manager" in the search bar and pressing "Enter". Navigate to SQL Server Configuration Manager >> SQL Server Network Configuration. Right-click on "Protocols", where there is a placeholder for the SQL Server instance name and click on "Properties". On the "Flags" tab, if "Force Encryption" is set to "NO", this is a finding. On the "Flags" tab, if "Force Encryption" is set to "YES", examine the certificate used on the "Certificate" tab. If it is not a DOD approved certificate, or if no certificate is listed, this is a finding. For clustered instances, the Certificate will NOT be shown in the SQL Server Configuration Manager. 1. From a command prompt, navigate to the certificate store where the Full Qualified Domain Name (FQDN) certificate is stored, by typing "Manage computer certificates" in the search bar and pressing "Enter". 2. In the left side of the window, expand the "Personal" folder, and click "Certificates". 3. Verify the Certificate with the FQDN name is issued by the DOD. Double-click the certificate, click the "Details" tab, and note the value for the Thumbprint. 4. Ensure the value for the "Thumbprint" field matches the value in the registry by running regedit and looking at "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\<instance>\MSSQLServer\SuperSocketNetLib\Certificate". 5. Run this on each node of the cluster. If any nodes have a certificate in use by SQL that is not issued or approved by DOD, this is a finding.
Fix: F-75259r1109242_fix
Configure SQL Server to encrypt authentication data for remote connections using DOD-approved cryptography. Deploy encryption to the SQL Server Network Connections. From the search bar, open SQL Server Configuration Manager by typing "SQL Server 2022 Configuration Manager" and pressing "ENTER". Navigate to SQL Server Configuration Manager >> SQL Server Network Configuration. Right-click on "Protocols for", where there is a placeholder for the SQL Server instance name, and click on "Properties". In the "Protocols for Properties" dialog box, on the "Certificate" tab, select the DOD certificate from the drop down for the Certificate box, and then click "OK". On the "Flags" tab, in the "ForceEncryption" box, select "Yes", and then click "OK" to close the dialog box. Then restart the SQL Server service. For clustered instances install the certificate after setting "Force Encryption" to "Yes" in SQL Server Configuration Manager. 1. Navigate to the certificate store where the FQDN certificate is stored, by typing "Manage computer certificates" in the search bar and pressing "ENTER". 2. On the "Properties" page for the certificate, go to the "Details" tab and copy the "thumbprint" value of the certificate to a "Notepad" window. 3. Remove the spaces between the hex characters in the "thumbprint" value in Notepad. 4. Start regedit, navigate to the following registry key, and copy the value from step 2: HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\<instance>\MSSQLServer\SuperSocketNetLib\Certificate. 5. If the SQL virtual server is currently on this node, failover to another node in the cluster, and then reboot the node where the registry change occurred. 6. Repeat this procedure on all the nodes. Configure SQL Server to encrypt authentication data for remote connections using DOD-approved cryptography. Deploy encryption to the SQL Server Network Connections.
- RMF Control
- IA-5
- Severity
- H
- CCI
- CCI-000197
- Version
- SQLI-22-008300
- Vuln IDs
-
- V-271310
- Rule IDs
-
- SV-271310r1111062_rule
Checks: C-75353r1109244_chk
Access the SQL Server. Access an administrator command prompt. Type "regedit" to launch the Registry Editor. Navigate to: HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2 If this key does not exist, this is a finding. Verify a REG_DWORD value of "0" for "DisabledByDefault" and a value of "1" for "Enabled" for both Client and Server. Navigate to: HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0 HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1 HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0 HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0 Under each key, verify a REG_DWORD value of "1" for "DisabledByDefault" and a value of "0" for "Enabled" for both Client and Server subkeys. If any of the respective registry paths are non-existent or contain values other than specified above, this is a finding. If Vendor documentation supporting the configuration is provided, reduce this finding to a CAT III.
Fix: F-75260r1109245_fix
Important Note: Incorrectly modifying the Windows Registry can result in serious system errors. Before making any modifications, ensure there is a recent backup of the system and registry settings. Access the SQL Server. Access an administrator command prompt. Type "regedit" to launch the Registry Editor. Enable TLS 1.2: 1. Navigate to the path HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols. a. If the "TLS 1.2" key does not exist, right-click "Protocols". b. Click "New". c. Click "Key". d. Type the name "TLS 1.2". 2. Navigate to the "TLS 1.2" subkey. a. If the subkey "Client" does not exist, right-click "TLS 1.2". b. Click "New". c. Click "Key". d. Type the name "Client". e. Repeat steps A-D for the "Server" subkey. 3. Navigate to the "Client" subkey. a. If the value "Enabled" does not exist, right-click on "Client". b. Click "New". c. Click "DWORD". d. Enter "Enabled" as the name. e. Repeat steps A-D for the value "DisabledByDefault". 4. Double-click "Enabled". 5. In Value Data, enter "1". 6. Click "OK". 7. Double-click "DisabledByDefault". 8. In Value Data, enter "0". 9. Click "OK". 10. Repeat steps 3-9 for the "Server" subkey. Disable unwanted SSL/TLS protocol versions: 1. Navigate to the path HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols. a. If the "TLS 1.0" key does not exist, right-click "Protocols". b. Click "New". c. Click "Key". d. Type the name "TLS 1.0". 2. Navigate to the "TLS 1.0" subkey. a. If the subkey "Client" does not exist, right-click "TLS 1.0". b. Click "New". c. Click "Key". d. Type the name "Client". e. Repeat steps A-D for the "Server" subkey. 3. Navigate to the "Client" subkey. a. If the value "Enabled" does not exist, right-click on "Client". b. Click "New". c. Click "DWORD". d. Enter "Enabled" as the name. e. Repeat steps A-D for the value "DisabledByDefault". 4. Double-click "Enabled". 5. In Value Data, enter "0". 6. Click "OK". 7. Double-click "DisabledByDefault". 8. In Value Data, enter "1". 9. Click "OK". 10. Repeat steps 3-9 for the "Server" subkey. 11. Repeat steps 1-10 for "TLS 1.1", "SSL 2.0", and "SSL 3.0".
- RMF Control
- IA-6
- Severity
- H
- CCI
- CCI-000206
- Version
- SQLI-22-018100
- Vuln IDs
-
- V-271313
- Rule IDs
-
- SV-271313r1111146_rule
Checks: C-75356r1111144_chk
Run this query to determine whether SQL Server authentication is enabled: EXEC master.sys.xp_loginconfig 'login mode'; If the config_value returned is "Windows NT Authentication", this is not a finding. For SQLCMD, which cannot be configured not to accept a plain-text password, and any other essential tool with the same limitation, verify that the system documentation explains the need for the tool, who uses it, and any relevant mitigations; and that authorizing approval (AO) approval has been obtained; if not, this is a finding. Request evidence that all users of the tool are trained on the importance of not using the plain-text password option, how to keep the password hidden, and that they adhere to this practice; if not, this is a finding.
Fix: F-75263r1111145_fix
Where possible, change the login mode to Windows-only: USE [master] GO EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 1; GO If mixed-mode authentication is necessary, then for SQLCMD, which cannot be configured not to accept a plain-text password when mixed-mode authentication is enabled, and any other essential tool with the same limitation: 1. Document the need for it, who uses it, and any relevant mitigations, and obtain AO approval. 2. Train all users of the tool in the importance of not using the plain-text password option and in how to keep the password hidden.
- RMF Control
- IA-7
- Severity
- H
- CCI
- CCI-000803
- Version
- SQLI-22-008700
- Vuln IDs
-
- V-271314
- Rule IDs
-
- SV-271314r1109121_rule
Checks: C-75357r1109018_chk
Verify that Windows is configured to require the use of FIPS compliant algorithms. 1. Click "Start". 2. Type "Local Security Policy". 3. Press "Enter". 4. Expand "Local Policies". 5. Select "Security Options". 6. Review the Security Setting for "System Cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing". If the Security Setting for this option is "Disabled", this is a finding. Alternatively, run the following code in PowerShell: Get-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\FipsAlgorithmPolicy | Select Enabled If the returned value is "0", this is a finding.
Fix: F-75264r1109019_fix
Configure Windows to require the use of FIPS compliant algorithms for the unclassified information that requires it. 1. Click "Start". 2. Type "Local Security Policy". 3. Press "Enter". 4. Expand "Local Policies". 5. Select "Security Options". 6. Locate "System Cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing". 7. Change the Setting option to "Enabled". 8. Restart Windows.
- RMF Control
- SC-28
- Severity
- H
- CCI
- CCI-001199
- Version
- SQLI-22-009700
- Vuln IDs
-
- V-271322
- Rule IDs
-
- SV-271322r1108582_rule
Checks: C-75365r1108580_chk
If the application owner and authorizing official have determined that encryption of data at rest is not required, this is not a finding. Review procedures for and evidence of backup of the Master Key in the System Security Plan. If the procedures or evidence does not exist, this is a finding. If the procedures do not indicate that a backup of the Master Key is stored in a secure location that is not on the SQL Server, this is a finding. If procedures do not indicate access restrictions to the Master Key backup, this is a finding.
Fix: F-75272r1108581_fix
Document and implement procedures to safely back up and store the Master Key in a secure location that is not on the SQL Server. Include in the procedures methods to establish evidence of backup and storage, and careful, restricted access and restoration of the Master Key. BACKUP MASTER KEY TO FILE = 'path_to_file' ENCRYPTION BY PASSWORD = 'password'; As this requires a password, take care to ensure it is not exposed to unauthorized persons or stored as plain text.
- RMF Control
- SC-28
- Severity
- H
- CCI
- CCI-001199
- Version
- SQLI-22-009600
- Vuln IDs
-
- V-271323
- Rule IDs
-
- SV-271323r1108585_rule
Checks: C-75366r1108583_chk
Review procedures for and evidence of backup of the Server Service Master Key in the System Security Plan. If the procedures or evidence does not exist, this is a finding. If the procedures do not indicate that a backup of the Service Master Key is stored in a secure location that is not on the SQL Server, this is a finding. If procedures do not indicate access restrictions to the Service Master Key backup, this is a finding.
Fix: F-75273r1108584_fix
Document and implement procedures to safely back up and store the Service Master Key in a secure location that is not on the SQL Server. In the procedures, include methods to establish evidence of backup and storage, and careful, restricted access and restoration of the Service Master Key. BACKUP SERVICE MASTER KEY TO FILE = 'path_to_file' ENCRYPTION BY PASSWORD = 'password'; As this requires a password, take care to ensure it is not exposed to unauthorized persons or stored as plain text.
- RMF Control
- SC-28
- Severity
- H
- CCI
- CCI-001199
- Version
- SQLI-22-009500
- Vuln IDs
-
- V-271324
- Rule IDs
-
- SV-271324r1109248_rule
Checks: C-75367r1109247_chk
Review system documentation to determine whether the system handles classified information. If the system does not handle classified information, the severity of this check is downgraded to CAT II. If the application owner and authorizing official have determined that encryption of data at rest is required, verify that the data on secondary devices is encrypted. If full-disk encryption is being used, this is not a finding. If data encryption is required, verify that the data is encrypted before being put on the secondary device by executing the following: SELECT db.name AS DatabaseName, db.is_encrypted AS IsEncrypted, CASE WHEN dm.encryption_state = 0 THEN 'No database encryption key present, no encryption' WHEN dm.encryption_state = 1 THEN 'Unencrypted' WHEN dm.encryption_state = 2 THEN 'Encryption in progress' WHEN dm.encryption_state = 3 THEN 'Encrypted' WHEN dm.encryption_state = 4 THEN 'Key change in progress' WHEN dm.encryption_state = 5 THEN 'Decryption in progress' WHEN dm.encryption_state = 6 THEN 'Protection change in progress' END AS EncryptionState, dm.encryption_state AS EncryptionState, dm.key_algorithm AS KeyAlgorithm, dm.key_length AS KeyLength FROM sys.databases db LEFT JOIN sys.dm_database_encryption_keys dm ON db.database_id = dm.database_id WHERE db.database_id > 4 ORDER BY [Database Name] ; For each user database where encryption is required, verify that encryption is in effect. If it is not, this is a finding. Verify that there are physical security measures, operating system access control lists, and organizational controls appropriate to the sensitivity level of the data in the database(s). If not, this is a finding.
Fix: F-75274r1109022_fix
Apply appropriate controls to protect the confidentiality and integrity of data on a secondary device. Where encryption is required, this can be done by full-disk encryption or by database encryption. To enable database encryption, create a master key, create a database encryption key, protect it by using mechanisms tied to the master key, and then turn encryption on. Implement physical security measures, operating system access control lists, and organizational controls appropriate to the sensitivity level of the data in the database(s).
- RMF Control
- SC-4
- Severity
- M
- CCI
- CCI-001090
- Version
- SQLI-22-009900
- Vuln IDs
-
- V-271327
- Rule IDs
-
- SV-271327r1117173_rule
Checks: C-75370r1109026_chk
Review system configuration to determine whether IFI support has been enabled (IFI is enabled by default). Run the following query in SSMS: SELECT servicename ,instant_file_initialization_enabled FROM sys.dm_server_services If the column instant_file_initialization_enabled returns a value of "Y", then IFI is enabled. Alternatively, navigate to Start >> Control Panel >> System and Security >> Administrative Tools >> Local Security Policy >> Local Policies >> User Rights Assignment >> Perform volume maintenance tasks. The default SQL service account for a default instance is NT SERVICE\MSSQLSERVER or for a named instance is NT SERVICE\MSSQL$InstanceName. If the SQL service account or SQL service SID has been granted "Perform volume maintenance tasks" Local Rights Assignment, this means that IFI is enabled. Review the system documentation to determine if IFI is required. If IFI is enabled but not documented as required, this is a finding. If IFI is not enabled, this is not a finding.
Fix: F-75277r1109249_fix
If IFI is not documented as being required, disable instant file initialization for the instance of SQL Server by removing the SQL Service SID and/or service account from the "Perform volume maintenance tasks" local rights assignment. To grant an account the "Perform volume maintenance tasks" permission: 1. On the computer where the data file will be created, open the Local Security Policy application (secpol.msc). 2. In the left pane, expand "Local Policies" then select "User Rights Assignment". 3. In the right pane, double-click "Perform volume maintenance tasks". 4. Select "Add User or Group" and add the SQL Server service account. 5. Select "Apply", then close all Local Security Policy dialog boxes. 6. Restart the SQL Server service. 7. Check the SQL Server error log at startup.
- RMF Control
- SC-4
- Severity
- M
- CCI
- CCI-001090
- Version
- SQLI-22-009800
- Vuln IDs
-
- V-271328
- Rule IDs
-
- SV-271328r1117173_rule
Checks: C-75371r1109268_chk
Review system documentation to determine whether common criteria compliance is required due to potential impact on system performance. SQL Server Residual Information Protection (RIP) requires a memory allocation to be overwritten with a known pattern of bits before memory is reallocated to a new resource. Meeting the RIP standard can contribute to improved security; however, overwriting the memory allocation can slow performance. After the common criteria compliance enabled option is enabled, the overwriting occurs. Review the Instance configuration: SELECT value_in_use FROM sys.configurations WHERE name = 'common criteria compliance enabled' If "value_in_use" is set to "1" this is not a finding. If "value_in_use" is set to "0" this is a finding. If no results are returned, common criteria compliance is not available in the installed version of SQL Server, this is a finding. Common criteria compliance is only supported in Enterprise and Developer editions of SQL Server. Note: Enabling this feature may impact performance on highly active SQL Server instances. If an exception justifying setting SQL Server RIP to disabled (value_in_use set to "0") has been documented and approved, then this is downgraded to a CAT III finding.
Fix: F-75278r1109024_fix
Configure SQL Server to effectively protect the private resources of one process or user from unauthorized access by another process or user. To enable the use of [Common Criteria Compliance], from the query prompt: EXEC SP_CONFIGURE 'show advanced options', 1; RECONFIGURE WITH OVERRIDE; EXEC SP_CONFIGURE 'common criteria compliance enabled', 1; RECONFIGURE WITH OVERRIDE; EXEC SP_CONFIGURE 'show advanced options', 0; RECONFIGURE WITH OVERRIDE;
- RMF Control
- SC-4
- Severity
- M
- CCI
- CCI-001090
- Version
- SQLI-22-010000
- Vuln IDs
-
- V-271329
- Rule IDs
-
- SV-271329r1117173_rule
Checks: C-75372r1108601_chk
Review the permissions granted to users by the operating system/file system on the database files, database log files, and database backup files. To obtain the location of SQL Server data, transaction log, and backup files, open and execute the supplemental file "Get SQL Data and Backup Directories.sql". For each of the directories returned by the above script, verify whether the correct permissions have been applied. 1. Launch Windows Explorer. 2. Navigate to the folder. 3. Right-click the folder and click "Properties". 4. Navigate to the "Security" tab. 5. Review the listing of principals and permissions. Account Type Directory Type Permission ----------------------------------------------------------------------------------------------- Database Administrators ALL Full Control SQL Server Service SID Data; Log; Backup; Full Control SQL Server Agent Service SID Backup Full Control SYSTEM ALL Full Control CREATOR OWNER ALL Full Control For information on how to determine a "Service SID", refer to https://aka.ms/sql-service-sids. Additional permission requirements, including full directory permissions and operating system rights for SQL Server, are documented at https://aka.ms/sqlservicepermissions. If any additional permissions are granted but not documented as authorized, this is a finding.
Fix: F-75279r1108602_fix
Remove any unauthorized permission grants from SQL Server data, log, and backup directories. 1. On the "Security" tab, highlight the user entry. 2. Click "Remove".
- RMF Control
- SI-10
- Severity
- M
- CCI
- CCI-001310
- Version
- SQLI-22-010010
- Vuln IDs
-
- V-271331
- Rule IDs
-
- SV-271331r1108609_rule
Checks: C-75374r1108607_chk
Review DBMS source code (stored procedures, functions, triggers) and application source code, to identify cases of dynamic code execution. If dynamic code execution is employed in circumstances where the objective could practically be satisfied by static execution with strongly typed parameters, this is a finding.
Fix: F-75281r1108608_fix
Where dynamic code execution is employed in circumstances where the objective could practically be satisfied by static execution with strongly typed parameters, modify the code to do so.
- RMF Control
- SI-10
- Severity
- M
- CCI
- CCI-001310
- Version
- SQLI-22-010020
- Vuln IDs
-
- V-271332
- Rule IDs
-
- SV-271332r1108612_rule
Checks: C-75375r1108610_chk
Review DBMS source code (stored procedures, functions, triggers) and application source code to identify cases of dynamic code execution. If dynamic code execution is employed without protective measures against code injection, this is a finding.
Fix: F-75282r1108611_fix
Where dynamic code execution is used, modify the code to implement protections against code injection.
- RMF Control
- SI-11
- Severity
- M
- CCI
- CCI-001314
- Version
- SQLI-22-010100
- Vuln IDs
-
- V-271334
- Rule IDs
-
- SV-271334r1109125_rule
Checks: C-75377r1109029_chk
Error messages within applications, custom database code (stored procedures, triggers) must be enforced by guidelines and code review practices. SQL Server generates certain system events and user-defined events to the SQL Server error log. The SQL Server error log can be viewed using SQL Server Management Studio GUI. All users granted the security admin or sysadmin level of permission are able to view the logs. Review the users returned in the following script: USE master GO SELECT Name FROM syslogins WHERE (sysadmin = 1 or securityadmin = 1) and hasaccess = 1; If any nonauthorized users have access to the SQL Server Error Log located at Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG, this is a finding. In addition, the SQL Server Error Log is also located at Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG\. Review the permissions on this folder to ensure that only authorized users are listed. If any nonauthorized users have access to the SQL Server Error Log in SQL Server Management Studio or if documentation does not exist stating that full error messages must be returned, this is a finding. Otherwise, verify if trace flag 3625 is enabled to mask certain system-level error information returned to nonadministrative users. Launch SQL Server Configuration Manager >> select SQL Server Services >> select the SQL Server >> right-click and select Properties >> select Startup Parameters tab >> verify -T3625 exists in the dialogue window. OR Run the query: DBCC TRACESTATUS; If TraceFlag 3625 does not return with Status = 1, and if documentation does not exist stating that full error messages must be returned, this is a finding.
Fix: F-75284r1109030_fix
Configure audit logging, tracing, and/or custom code in the database or application to record detailed error messages generated by SQL Server for review by authorized personnel. If any nonauthorized users have access to the SQL Server Error Log in SQL Server Management Studio, use the REVOKE or DENY commands to remove them from the security admin or sysadmin roles. If any nonauthorized users have access to the SQL Server Error Log located at Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG, remove their permissions. Consider enabling trace flag 3625 to mask certain system-level error information returned to nonadministrative users. Configure audit logging, tracing and/or custom code in the database or application to record detailed error messages generated by SQL Server, for review by authorized personnel. If any nonauthorized users have access to the SQL Server Error Log in SQL Server Management Studio, use the REVOKE or DENY commands to remove them from the security admin or sysadmin roles. If any nonauthorized users have access to the SQL Server Error Log located at Program Files\Microsoft SQL Server\MSSQL.n\MSSQL\LOG, remove their permissions. Enable trace flag 3625 to mask certain system-level error information returned to nonadministrative users. To launch SQL Server Configuration Manager, select SQL Server Services, select the SQL Server, then right-click and select "Properties". Select the "Startup Parameters" tab, enter "-T3625", and then click "Add". Click "OK", then restart SQL instance.
- RMF Control
- AC-6
- Severity
- M
- CCI
- CCI-002235
- Version
- SQLI-22-010400
- Vuln IDs
-
- V-271341
- Rule IDs
-
- SV-271341r1111081_rule
Checks: C-75384r1109251_chk
Review server-level securables and built-in role membership to ensure only authorized users have privileged access and the ability to create server-level objects and grant permissions to themselves or others. Review the system documentation to determine the required levels of protection for DBMS server securables by type of login. Review the permissions in place on the server. If the actual permissions do not match the documented requirements, this is a finding. Get all permission assignments to logins and roles: SELECT DISTINCT CASE WHEN SP.class_desc IS NOT NULL THEN CASE WHEN SP.class_desc = 'SERVER' AND S.is_linked = 0 THEN 'SERVER' WHEN SP.class_desc = 'SERVER' AND S.is_linked = 1 THEN 'SERVER (linked)' ELSE SP.class_desc END WHEN E.name IS NOT NULL THEN 'ENDPOINT' WHEN S.name IS NOT NULL AND S.is_linked = 0 THEN 'SERVER' WHEN S.name IS NOT NULL AND S.is_linked = 1 THEN 'SERVER (linked)' WHEN P.name IS NOT NULL THEN 'SERVER_PRINCIPAL' ELSE '???' END AS [Securable Class], CASE WHEN E.name IS NOT NULL THEN E.name WHEN S.name IS NOT NULL THEN S.name WHEN P.name IS NOT NULL THEN P.name ELSE '???' END AS [Securable], P1.name AS [Grantee], P1.type_desc AS [Grantee Type], sp.permission_name AS [Permission], sp.state_desc AS [State], P2.name AS [Grantor], P2.type_desc AS [Grantor Type] FROM sys.server_permissions SP INNER JOIN sys.server_principals P1 ON P1.principal_id = SP.grantee_principal_id INNER JOIN sys.server_principals P2 ON P2.principal_id = SP.grantor_principal_id FULL OUTER JOIN sys.servers S ON SP.class_desc = 'SERVER' AND S.server_id = SP.major_id FULL OUTER JOIN sys.endpoints E ON SP.class_desc = 'ENDPOINT' AND E.endpoint_id = SP.major_id FULL OUTER JOIN sys.server_principals P ON SP.class_desc = 'SERVER_PRINCIPAL' AND P.principal_id = SP.major_id Get all server role memberships: SELECT R.name AS [Role], M.name AS [Member] FROM sys.server_role_members X INNER JOIN sys.server_principals R ON R.principal_id = X.role_principal_id INNER JOIN sys.server_principals M ON M.principal_id = X.member_principal_id The CONTROL SERVER permission is similar but not identical to the sysadmin fixed server role. Permissions do not imply role memberships, and role memberships do not grant permissions (e.g., CONTROL SERVER does not imply membership in the sysadmin fixed server role). Ensure only the documented and approved logins have privileged functions in SQL Server. If the current configuration does not match the documented baseline, this is a finding.
Fix: F-75291r1109252_fix
Restrict the granting of permissions to server-level securables to only those authorized, most notably: members of sysadmin and securityadmin built-in instance-level roles, CONTROL SERVER permission, and use of the GRANT with GRANT permission.
- RMF Control
- AC-6
- Severity
- M
- CCI
- CCI-002233
- Version
- SQLI-22-010500
- Vuln IDs
-
- V-271342
- Rule IDs
-
- SV-271342r1108642_rule
Checks: C-75385r1108640_chk
Review the server documentation to obtain a listing of accounts used for executing external processes. Execute the following to obtain a listing of accounts currently configured for use by external processes. SELECT C.name AS credential_name, C.credential_identity FROM sys.credentials C GO SELECT P.name AS proxy_name, C.name AS credential_name, C.credential_identity FROM sys.credentials C JOIN msdb.dbo.sysproxies P ON C.credential_id = P.credential_id WHERE P.enabled = 1 GO If any Credentials or SQL Agent Proxy accounts are returned that are not documented and authorized, this is a finding.
Fix: F-75292r1108641_fix
Remove any SQL Agent Proxy accounts and credentials that are not authorized. DROP CREDENTIAL <Credential Name> GO USE [msdb] EXEC sp_delete_proxy @proxy_name = '<Proxy Name>' GO
- RMF Control
- AU-4
- Severity
- M
- CCI
- CCI-001849
- Version
- SQLI-22-010900
- Vuln IDs
-
- V-271343
- Rule IDs
-
- SV-271343r1108645_rule
Checks: C-75386r1108643_chk
If the database is setup to write audit logs using APPLICATION or SECURITY event logs rather than writing to a file, this is Not Applicable. Check the server documentation for the SQL Audit file size configurations. Locate the Audit file path and drive. SELECT max_file_size, max_rollover_files, log_file_path AS "Audit Path" FROM sys.server_file_audits Calculate the space needed as the maximum file size and number of files from the SQL Audit File properties. If the calculated product of the "max_file_size" times the "max_rollover_files" exceeds the size of the storage location, this is a finding; OR if "max_file_size" is set to "0" (Unlimited), this is a finding; OR if "max_rollover_files" are set to "0" (None) or "2147483647" (Unlimited), this is a finding.
Fix: F-75293r1108644_fix
Review the SQL Audit file location; ensure the destination has enough space available to accommodate the maximum total size of all files that could be written. Configure the maximum number of audit log files that are to be generated, staying within the number of logs the system was sized to support. Update the "max_files" or "max_rollover_files" parameter of the audits to ensure the correct number of files is defined. If writing to application event logs or security logs, space considerations are covered in the Windows Server STIGs. Be sure to reference these depending on the OS in use.
- RMF Control
- AU-5
- Severity
- M
- CCI
- CCI-001855
- Version
- SQLI-22-011000
- Vuln IDs
-
- V-271344
- Rule IDs
-
- SV-271344r1111082_rule
Checks: C-75387r1108646_chk
The operating system and SQL Server offer a number of methods for checking the drive or volume free space. Locate the destination drive where SQL Audits are stored and review system configuration. If no alert exists to notify support staff in the event the SQL Audit drive reaches 75 percent, this is a finding.
Fix: F-75294r1108647_fix
Use operating system alerting mechanisms, SQL Agent, Operations Management tools, and/or third-party tools to configure the system to notify appropriate support staff immediately upon storage volume utilization reaching 75 percent.
- RMF Control
- AU-5
- Severity
- M
- CCI
- CCI-001858
- Version
- SQLI-22-011100
- Vuln IDs
-
- V-271345
- Rule IDs
-
- SV-271345r1109254_rule
Checks: C-75388r1108649_chk
Review SQL Server settings, OS, or third-party logging software settings to determine whether a real-time alert will be sent to the appropriate personnel when auditing fails for any reason. If real-time alerts are not sent upon auditing failure, this is a finding.
Fix: F-75295r1108650_fix
Configure the system to provide immediate real-time alerts to appropriate support staff when an audit log failure occurs.
- RMF Control
- AU-8
- Severity
- M
- CCI
- CCI-001890
- Version
- SQLI-22-011200
- Vuln IDs
-
- V-271346
- Rule IDs
-
- SV-271346r1109256_rule
Checks: C-75389r1109255_chk
SQL Server Audits store the timestamp in UTC time. Determine if the computer is joined to a domain. SELECT DEFAULT_DOMAIN()[DomainName] If this is not NULL, this is not a finding. If the computer is not joined to a domain, determine what the time source is. (Run the following command in an elevated PowerShell session.) w32tm /query /source If the results of the command return "Local CMOS Clock" and this is not documented with justification and authorizing official (AO) authorization, this is a finding. If the OS does not synchronize with a time server, review the procedure for maintaining accurate time on the system. If such a procedure does not exist, this is a finding. If the procedure exists, review evidence that the correct time is actually maintained. If the evidence indicates otherwise, this is a finding.
Fix: F-75296r1108653_fix
Where possible, configure the operating system to automatic synchronize with an official time server, using NTP. Where there is reason not to implement automatic synchronization with an official time server, using NTP, document the reason, and the procedure for maintaining the correct time, and obtain AO approval. Enforce the procedure.
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001813
- Version
- SQLI-22-011500
- Vuln IDs
-
- V-271349
- Rule IDs
-
- SV-271349r1108938_rule
Checks: C-75392r1108937_chk
Obtain a list of users who have privileged access to the server via the local administrators group. 1. Launch lusrmgr.msc. 2. Select "Groups". 3. Double-click "Administrators". Alternatively, execute the following command in PowerShell: net localgroup administrators Check the server documentation to verify the users returned are authorized. If the users are not documented and authorized, this is a finding.
Fix: F-75299r1108662_fix
Remove users from the local Administrators group who are not authorized.
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001813
- Version
- SQLI-22-011400
- Vuln IDs
-
- V-271350
- Rule IDs
-
- SV-271350r1111084_rule
Checks: C-75393r1111083_chk
Obtain a list of logins who have privileged permissions and role memberships in SQL. Execute the following to obtain a list of logins and roles and their respective permissions assignment: SELECT p.name AS Principal, p.type_desc AS Type, sp.permission_name AS Permission, sp.state_desc AS State FROM sys.server_principals p INNER JOIN sys.server_permissions sp ON p.principal_id = sp.grantee_principal_id WHERE sp.permission_name = 'CONTROL SERVER' OR sp.state = 'W' Execute the following to obtain a list of logins and their role memberships: SELECT m.name AS Member, m.type_desc AS Type, r.name AS Role FROM sys.server_principals m INNER JOIN sys.server_role_members rm ON m.principal_id = rm.member_principal_id INNER JOIN sys.server_principals r ON rm.role_principal_id = r.principal_id WHERE r.name IN ('sysadmin','securityadmin','serveradmin') Check the server documentation to verify the logins and roles returned are authorized. If the logins and/or roles are not documented and authorized, this is a finding.
Fix: F-75300r1109032_fix
Revoke unauthorized permissions from principals. https://learn.microsoft.com/en-us/sql/t-sql/statements/revoke-server-permissions-transact-sql? Remove unauthorized logins from roles. ALTER SERVER ROLE DROP MEMBER login; https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-server-role-transact-sql?
- RMF Control
- Severity
- M
- CCI
- CCI-003938
- Version
- SQLI-22-011800
- Vuln IDs
-
- V-271351
- Rule IDs
-
- SV-271351r1111086_rule
Checks: C-75394r1111085_chk
Review the SQL configuration to verify that audit records are produced when denied actions occur. To determine if an audit is configured, execute the following script: SELECT name AS 'Audit Name', status_desc AS 'Audit Status', audit_file_path AS 'Current Audit File' FROM sys.dm_server_audit_status If no records are returned, this is a finding. Execute the following to verify the following events are included in the server audit specification: APPLICATION_ROLE_CHANGE_PASSWORD_GROUP, AUDIT_CHANGE_GROUP, BACKUP_RESTORE_GROUP, DATABASE_CHANGE_GROUP, DATABASE_OBJECT_ACCESS_GROUP, DATABASE_OBJECT_CHANGE_GROUP, DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP, DATABASE_OBJECT_PERMISSION_CHANGE_GROUP, DATABASE_OWNERSHIP_CHANGE_GROUP, DATABASE_OPERATION_GROUP, DATABASE_PERMISSION_CHANGE_GROUP, DATABASE_PRINCIPAL_CHANGE_GROUP, DATABASE_PRINCIPAL_IMPERSONATION_GROUP, DATABASE_ROLE_MEMBER_CHANGE_GROUP, DBCC_GROUP, LOGIN_CHANGE_PASSWORD_GROUP, LOGOUT_GROUP, SCHEMA_OBJECT_CHANGE_GROUP, SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP, SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP, SERVER_OBJECT_CHANGE_GROUP, SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP, SERVER_OBJECT_PERMISSION_CHANGE_GROUP, SERVER_OPERATION_GROUP, SERVER_PERMISSION_CHANGE_GROUP, SERVER_PRINCIPAL_CHANGE_GROUP, SERVER_PRINCIPAL_IMPERSONATION_GROUP, SERVER_ROLE_MEMBER_CHANGE_GROUP, SERVER_STATE_CHANGE_GROUP, TRACE_CHANGE_GROUP, USER_CHANGE_PASSWORD_GROUP SELECT a.name AS 'AuditName', s.name AS 'SpecName', d.audit_action_name AS 'ActionName', d.audited_result AS 'Result' FROM sys.server_audit_specifications s JOIN sys.server_audits a ON s.audit_guid = a.audit_guid JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id WHERE a.is_state_enabled = 1 AND d.audit_action_name IN ( 'APPLICATION_ROLE_CHANGE_PASSWORD_GROUP', 'AUDIT_CHANGE_GROUP', 'BACKUP_RESTORE_GROUP', 'DATABASE_CHANGE_GROUP', 'DATABASE_OBJECT_ACCESS_GROUP', 'DATABASE_OBJECT_CHANGE_GROUP', 'DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP', 'DATABASE_OBJECT_PERMISSION_CHANGE_GROUP', 'DATABASE_OWNERSHIP_CHANGE_GROUP', 'DATABASE_OPERATION_GROUP', 'DATABASE_PERMISSION_CHANGE_GROUP', 'DATABASE_PRINCIPAL_CHANGE_GROUP', 'DATABASE_PRINCIPAL_IMPERSONATION_GROUP', 'DATABASE_ROLE_MEMBER_CHANGE_GROUP', 'DBCC_GROUP', 'LOGIN_CHANGE_PASSWORD_GROUP', 'LOGOUT_GROUP', 'SCHEMA_OBJECT_CHANGE_GROUP', 'SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP', 'SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP', 'SERVER_OBJECT_CHANGE_GROUP', 'SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP', 'SERVER_OBJECT_PERMISSION_CHANGE_GROUP', 'SERVER_OPERATION_GROUP', 'SERVER_PERMISSION_CHANGE_GROUP', 'SERVER_PRINCIPAL_CHANGE_GROUP', 'SERVER_PRINCIPAL_IMPERSONATION_GROUP', 'SERVER_ROLE_MEMBER_CHANGE_GROUP', 'SERVER_STATE_CHANGE_GROUP', 'TRACE_CHANGE_GROUP', 'USER_CHANGE_PASSWORD_GROUP' ) Order by d.audit_action_name If the identified groups are not returned, this is a finding.
Fix: F-75301r1109035_fix
Add the required events to the server audit specification to audit denied actions. Refer to the supplemental file "SQL2022Audit.sql" script. Reference: https://learn.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-database-engine?
- RMF Control
- SC-39
- Severity
- M
- CCI
- CCI-002530
- Version
- SQLI-22-012400
- Vuln IDs
-
- V-271358
- Rule IDs
-
- SV-271358r1117179_rule
Checks: C-75401r1109039_chk
Review the server documentation to obtain a listing of required service accounts. Review the accounts configured for all SQL Server services installed on the server. Run the following query in SSMS: SELECT servicename,service_account FROM sys.dm_server_services Review the returned results. If any services are configured with the same service account or with an account that is not documented and authorized, this is a finding.
Fix: F-75308r1109040_fix
Configure SQL Server services to have a documented, dedicated account. For nondomain servers, consider using virtual service accounts (VSAs). For more information, refer to: https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-windows-service-accounts-and-permissions? For standalone domain-joined servers, consider using managed service accounts. For more information, refer to: https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-windows-service-accounts-and-permissions? For clustered instances, consider using group managed service accounts. For more information, refer to: https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-windows-service-accounts-and-permissions? or https://learn.microsoft.com/en-us/archive/blogs/markweberblog/group-managed-service-accounts-gmsa-and-sql-server-2016
- RMF Control
- SC-39
- Severity
- M
- CCI
- CCI-002530
- Version
- SQLI-22-012300
- Vuln IDs
-
- V-271359
- Rule IDs
-
- SV-271359r1117179_rule
Checks: C-75402r1111087_chk
Review the server documentation to determine whether use of CLR assemblies is required. Run the following query to determine whether CLR is enabled for the instance: SELECT name, value, value_in_use FROM sys.configurations WHERE name = 'clr enabled' If "value_in_use" is a "1" and CLR is not required, this is a finding.
Fix: F-75309r1111088_fix
Disable use of or remove any CLR code that is not authorized. To disable the use of CLR, from the query prompt: EXEC SP_CONFIGURE 'clr enabled', 0; RECONFIGURE WITH OVERRIDE;
- RMF Control
- SI-10
- Severity
- M
- CCI
- CCI-002754
- Version
- SQLI-22-012600
- Vuln IDs
-
- V-271362
- Rule IDs
-
- SV-271362r1108702_rule
Checks: C-75405r1108700_chk
Review DBMS code (stored procedures, functions, triggers), application code, settings, column and field definitions, and constraints to determine whether the database is protected against invalid input. If code exists that allows invalid data to be acted upon or input into the database, this is a finding. If column/field definitions are not reflective of the data, this is a finding. If columns/fields do not contain constraints and validity checking where required, this is a finding. Where a column/field is noted in the system documentation as necessarily free form, even though its name and context suggest that it should be strongly typed and constrained, the absence of these protections is not a finding. Where a column/field is clearly identified by name, caption or context as Notes, Comments, Description, Text, etc., the absence of these protections is not a finding.
Fix: F-75312r1108701_fix
Use parameterized queries, stored procedures, constraints and foreign keys to validate data input. Modify SQL Server to properly use the correct column data types as required in the database.
- RMF Control
- SI-2
- Severity
- M
- CCI
- CCI-002605
- Version
- SQLI-22-012800
- Vuln IDs
-
- V-271364
- Rule IDs
-
- SV-271364r1117151_rule
Checks: C-75407r1108706_chk
Obtain evidence that software patches are consistently applied to SQL Server within the time frame defined for each patch. To be considered supported, Microsoft must report that the version is supported by security patches to known vulnerability. Review the Support dates at https://learn.microsoft.com/en-us/troubleshoot/sql/releases/download-and-install-latest-updates. Check the SQL Server version by running the following script: Print @@version If the SQL Server version is not shown as supported, this is a finding. If such evidence cannot be obtained, or the evidence that is obtained indicates a pattern of noncompliance, this is a finding.
Fix: F-75314r1108707_fix
Upgrade SQL Server to the Microsoft-supported version. Institute and adhere to policies and procedures to ensure that patches are consistently applied to SQL Server within the time allowed.
- RMF Control
- SA-22
- Severity
- H
- CCI
- CCI-003376
- Version
- SQLI-22-018300
- Vuln IDs
-
- V-271365
- Rule IDs
-
- SV-271365r1117151_rule
Checks: C-75408r1111147_chk
Review the system documentation and interview the database administrator. Identify all database software components. Review the version and release information. Verify the SQL Server version via one of the following methods: Connect to the server by using Object Explorer in SQL Server Management Studio. After Object Explorer is connected, it will show the version information in parentheses with the username used to connect to the specific instance of SQL Server. Or, from SQL Server Management Studio execute the following: SELECT @@VERSION; More information for finding the version is available at the following link: https://learn.microsoft.com/en-us/troubleshoot/sql/releases/find-my-sql-version. Access the vendor website or use other means to verify the version is still supported. Refer to https://learn.microsoft.com/en-us/lifecycle/products/sql-server-2016. If the installed version or any of the software components are not supported by the vendor, this is a finding.
Fix: F-75315r1108710_fix
Remove or decommission all unsupported software products. Upgrade unsupported DBMS or unsupported components to a supported version of the product.
- RMF Control
- AU-12
- Severity
- M
- CCI
- CCI-000172
- Version
- SQLI-22-013800
- Vuln IDs
-
- V-271370
- Rule IDs
-
- SV-271370r1111091_rule
Checks: C-75413r1111090_chk
Review the SQL configuration to verify that audit records are produced when denied actions occur. To determine if an audit is configured, execute the following script: SELECT name AS 'Audit Name', status_desc AS 'Audit Status', audit_file_path AS 'Current Audit File' FROM sys.dm_server_audit_status If no records are returned, this is a finding. Execute the following to verify the events below are included in the server audit specification: SCHEMA_OBJECT_CHANGE_GROUP SELECT a.name AS 'AuditName', s.name AS 'SpecName', d.audit_action_name AS 'ActionName', d.audited_result AS 'Result' FROM sys.server_audit_specifications s JOIN sys.server_audits a ON s.audit_guid = a.audit_guid JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id WHERE a.is_state_enabled = 1 AND d.audit_action_name IN ( 'SCHEMA_OBJECT_CHANGE_GROUP' ) Order by d.audit_action_name If the identified groups are not returned, this is a finding.
Fix: F-75320r1109043_fix
Add the required events to the server audit specification to audit denied actions. Refer to the supplemental file "SQL2022Audit.sql" script. Reference: https://learn.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-database-engine?
- RMF Control
- AU-12
- Severity
- M
- CCI
- CCI-000172
- Version
- SQLI-22-014800
- Vuln IDs
-
- V-271375
- Rule IDs
-
- SV-271375r1111093_rule
Checks: C-75418r1111092_chk
Review the SQL configuration to verify that audit records are produced when denied actions occur. To determine if an audit is configured, execute the following script: SELECT name AS 'Audit Name', status_desc AS 'Audit Status', audit_file_path AS 'Current Audit File' FROM sys.dm_server_audit_status If no records are returned, this is a finding. Execute the following to verify the events below are included in the server audit specification: SUCCESSFUL_LOGIN_GROUP FAILED_LOGIN_GROUP SELECT a.name AS 'AuditName', s.name AS 'SpecName', d.audit_action_name AS 'ActionName', d.audited_result AS 'Result' FROM sys.server_audit_specifications s JOIN sys.server_audits a ON s.audit_guid = a.audit_guid JOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id WHERE a.is_state_enabled = 1 AND d.audit_action_name IN ( 'SUCCESSFUL_LOGIN_GROUP', 'FAILED_LOGIN_GROUP' ) Order by d.audit_action_name If the identified groups are not returned, this is a finding. Alternatively: 1. In SQL Management Studio, right-click on the instance. 2. Select "Properties". 3. Select "Security" on the left side. 4. Check the setting for "Login auditing". If "Both failed and successful logins" is not selected, this is a finding.
Fix: F-75325r1109046_fix
Add the required events to the server audit specification to audit denied actions. Refer to the supplemental file "SQL2022Audit.sql" script. Reference: https://learn.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-database-engine? Alternatively, enable "Both failed and successful logins". 1. In SQL Management Studio, right-click on the instance. 2. Select "Properties". 3. Select "Security" on the left side. 4. Select "Both failed and successful logins". 5. Click "OK".
- RMF Control
- AU-12
- Severity
- M
- CCI
- CCI-000172
- Version
- SQLI-22-015500
- Vuln IDs
-
- V-271381
- Rule IDs
-
- SV-271381r1111095_rule
Checks: C-75424r1111094_chk
Determine whether any Server Audits are configured to filter records. From SQL Server Management Studio, execute the following query: SELECT name AS AuditName, predicate AS AuditFilter FROM sys.server_audits WHERE predicate IS NOT NULL If any audits are returned, review the associated filters. If any direct access to the database(s) is being excluded, this is a finding.
Fix: F-75331r1109049_fix
Check the system documentation for required SQL Server Audits. Remove any Audit filters that exclude or reduce required auditing. Update filters to ensure direct access is not excluded.
- RMF Control
- AU-4
- Severity
- M
- CCI
- CCI-001851
- Version
- SQLI-22-015900
- Vuln IDs
-
- V-271385
- Rule IDs
-
- SV-271385r1108771_rule
Checks: C-75428r1108769_chk
Review the system documentation for a description of how audit records are off-loaded. If the system has a continuous network connection to the centralized log management system, but the DBMS audit records are not written directly to the centralized log management system or transferred in near-real-time, this is a finding. If the system does not have a continuous network connection to the centralized log management system, and the DBMS audit records are not transferred to the centralized log management system weekly or more often, this is a finding.
Fix: F-75335r1108770_fix
Configure the system or deploy and configure software tools to transfer audit records to a centralized log management system, continuously and in near-real time where a continuous network connection to the log management system exists, or at least weekly in the absence of such a connection.
- RMF Control
- CM-6
- Severity
- M
- CCI
- CCI-000366
- Version
- SQLI-22-017800
- Vuln IDs
-
- V-271387
- Rule IDs
-
- SV-271387r1111140_rule
Checks: C-75430r1111139_chk
Open SQL Server Configuration Manager. Select SQL Server Services. Review the Start Mode and State of SQL Server Browser. If its Start Type is shown as "Disabled", this is not a finding. If the need for the SQL Server Browser service is documented and authorized, verify the SQL Instances that do not require use of the SQL Browser Service are hidden with the following SQL script: DECLARE @HiddenInstance INT EXEC master.dbo.Xp_instance_regread N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib', N'HideInstance', @HiddenInstance output SELECT CASE WHEN @HiddenInstance = 0 AND Serverproperty('IsClustered') = 0 THEN 'No' ELSE 'Yes' END AS [Hidden] If the value of "Hidden" is "Yes", this is not a finding. If the value of "Hidden" is "No" and the startup type of the "SQL Server Browser" service is not "Disabled", this is a finding.
Fix: F-75337r1108871_fix
If SQL Server Browser is needed, document the justification and obtain the appropriate authorization. Where SQL Server Browser is judged unnecessary, the Service can be disabled. To disable, in the Services tool, double-click "SQL Server Browser". Set "Startup Type" to "Disabled". If "Service Status" is "Running", click "Stop" and then click "OK".
- RMF Control
- CM-6
- Severity
- M
- CCI
- CCI-000366
- Version
- SQLI-22-016100
- Vuln IDs
-
- V-271388
- Rule IDs
-
- SV-271388r1111098_rule
Checks: C-75431r1111096_chk
Review the server documentation to determine if auditing of the telemetry data is required. If auditing of telemetry data is not required, this is not a finding. If auditing of telemetry data is required, determine the telemetry service username by executing the following query: SELECT name FROM sys.server_principals WHERE name LIKE '%SQLTELEMETRY%' Review the values of the following registry key: Note: InstanceId refers to the type and instance of the feature (e.g., MSSQL16.SqlInstance, MSAS16.SSASInstance, MSRS16.SSRSInstance). HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\[InstanceId]\CPE\UserRequestedLocalAuditDirectory If the registry key does not exist or the value is blank, this is a finding. Navigate the path defined in the "UserRequestedLocalAuditDirectory" registry key in file explorer. Right-click on the folder and choose "Properties". Open the "Security" tab. Verify the SQLTELEMETRY account has the following permissions: - List folder contents - Read - Write If the permissions are not set properly on the folder, this is a finding. Open services.msc and find the telemetry service. - For Database Engine, use SQL Server CEIP service (<INSTANCENAME>). - For Analysis Services, use SQL Server Analysis Services CEIP (<INSTANCENAME>). Right-click on the service and choose "Properties". Verify the "Startup type" is "Automatic." If the service is not configured to automatically start, this is a finding. Review the processes and procedures for reviewing the telemetry data. If there is evidence that the telemetry data is periodically reviewed in accordance with the processes and procedures, this is not a finding. If no processes and procedures exist for reviewing telemetry data, this is a finding.
Fix: F-75338r1111097_fix
Configure the instance to audit telemetry data. More information about auditing telemetry data can be found at https://msdn.microsoft.com/en-us/library/mt743085.aspx. Create a folder to store the telemetry audit data in. Grant the SQLTELEMETRY service the following permissions on the folder: - List folder contents - Read - Write Create and configure the following registry key: Note: InstanceId refers to the type and instance of the feature. (e.g., MSSQL16.SqlInstance, MSAS16.SSASInstance, MSRS16.SSRSInstance) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\[InstanceId]\CPE\UserRequestedLocalAuditDirectory [string] Set the "UserRequestedLocalAuditDirectory" key value to the path of the telemetry audit folder. Set the telemetry service to start automatically. Restart the service. - For Database Engine, use SQL Server CEIP service (<INSTANCENAME>). - For Analysis Services, use SQL Server Analysis Services CEIP (<INSTANCENAME>).
- RMF Control
- CM-6
- Severity
- M
- CCI
- CCI-000366
- Version
- SQLI-22-016000
- Vuln IDs
-
- V-271389
- Rule IDs
-
- SV-271389r1109133_rule
Checks: C-75432r1109051_chk
Review the values for CustomerFeedback and EnableErrorReporting. Option 1: Launch "Registry Editor" Navigate to: HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\[InstanceId]\CPE Review the following values: CustomerFeedback, EnableErrorReporting Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\160 Review the following values: CustomerFeedback, EnableErrorReporting Option 2: Run the PowerShell commands: Get-ItemProperty -Path "HKLM:\Software\Microsoft\Microsoft SQL Server\<SqlInstanceId>\CPE" Get-ItemProperty -Path "HKLM:\ Software\Microsoft\Microsoft SQL Server\160" Review the following values: CustomerFeedback, EnableErrorReporting If this is a classified system, and any of the above values are not "0", this is a finding. If this is an unclassified system, review the server documentation to determine whether CEIP participation is authorized. If CEIP participation is not authorized, and any of the above values are "1", this is a finding.
Fix: F-75339r1109052_fix
To disable participation in the CEIP program, change the value of the following registry keys to "0". To enable participation in the CEIP program, change the value of the following registry keys to "1". HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\[InstanceId]\CPE\CustomerFeedback HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\[InstanceId]\CPE\EnableErrorReporting HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\160\CustomerFeedback HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\160\EnableErrorReporting Or in PowerShell, run: Set-ItemProperty -Path "HKLM:\Software\Microsoft\Microsoft SQL Server\[InstanceId]\CPE" -Name CustomerFeedback -Value 0 Set-ItemProperty -Path "HKLM:\Software\Microsoft\Microsoft SQL Server\[InstanceId]\CPE" -Name EnableErrorReporting -Value 0 Set-ItemProperty -Path "HKLM:\Software\Microsoft\Microsoft SQL Server\160" -Name CustomerFeedback -Value 0 Set-ItemProperty -Path "HKLM:\Software\Microsoft\Microsoft SQL Server\160" -Name EnableErrorReporting -Value 0
- RMF Control
- Severity
- M
- CCI
- CCI-004063
- Version
- SQLI-22-019500
- Vuln IDs
-
- V-271400
- Rule IDs
-
- SV-271400r1111151_rule
Checks: C-75443r1111149_chk
Check for use of SQL Server Authentication: SELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly') WHEN 1 THEN 'Windows Authentication' WHEN 0 THEN 'SQL Server Authentication' END as [Authentication Mode] If the returned value in the "Authentication Mode" column is "Windows Authentication", this is not a finding. If the returned value is not "Windows Authentication", verify SQL Server is configured to require immediate selection of a new password upon account recovery. All scripts, functions, triggers, and stored procedures that are used to create a user or reset a user's password should include a line similar to the following password_option: MUST_CHANGE Example: CREATE LOGIN STIG_test WITH PASSWORD ='Password' MUST_CHANGE, CHECK_EXPIRATION = ON, CHECK_POLICY = ON; If they do not, this is a finding. If SQL Server is not configured to require immediate selection of a new password upon account recovery, this is a finding.
Fix: F-75350r1111150_fix
Configure the DBMS to require immediate selection of a new password upon account recovery. Ensure that all scripts, functions, triggers, and stored procedures that are used to create a user or reset a user's password include a line similar to the following password_option: MUST_CHANGE If MUST_CHANGE is specified, CHECK_EXPIRATION and CHECK_POLICY must be set to ON. Otherwise, the statement will fail. More information can be found at https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-login-transact-sql?view=sql-server-ver16.
- RMF Control
- AC-3
- Severity
- M
- CCI
- CCI-000213
- Version
- SQLI-22-016200
- Vuln IDs
-
- V-274444
- Rule IDs
-
- SV-274444r1117167_rule
Checks: C-78537r1111099_chk
Check SQL Server settings to determine if the [sa] (system administrator) account has been disabled by executing the following query: USE master; GO SELECT name, is_disabled FROM sys.sql_logins WHERE principal_id = 1; GO Verify that the "name" column contains the current name of the [sa] database server account. If the "is_disabled" column is not set to "1", this is a finding.
Fix: F-78442r1111100_fix
Modify the enabled flag of SQL Server's [sa] (system administrator) account by running the following script: USE master; GO ALTER LOGIN [sa] DISABLE; GO
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-016300
- Vuln IDs
-
- V-274445
- Rule IDs
-
- SV-274445r1111103_rule
Checks: C-78538r1111102_chk
Verify the SQL Server default [sa] (system administrator) account name has been changed by executing the following query: USE master; GO SELECT * FROM sys.sql_logins WHERE [name] = 'sa' OR [principal_id] = 1; GO If the login account name "SA" or "sa" appears in the query output, this is a finding.
Fix: F-78443r1109058_fix
Modify the SQL Server's [sa] (system administrator) account by running the following script: USE master; GO ALTER LOGIN [sa] WITH NAME = <new name> GO
- RMF Control
- AC-6
- Severity
- M
- CCI
- CCI-002233
- Version
- SQLI-22-016400
- Vuln IDs
-
- V-274446
- Rule IDs
-
- SV-274446r1111106_rule
Checks: C-78539r1111104_chk
Review the system documentation to obtain a listing of documented stored procedures used by SQL Server during startup. Execute the following query: Select [name] as StoredProc From sys.procedures Where OBJECTPROPERTY(OBJECT_ID, 'ExecIsStartup') = 1 If any stored procedures are returned that are not documented, this is a finding.
Fix: F-78444r1111105_fix
To disable startup stored procedure(s), run the following in Master for each undocumented procedure: sp_procoption @procname = '<procedure name>', @OptionName = 'Startup', @optionValue = 'Off'
- RMF Control
- CM-6
- Severity
- M
- CCI
- CCI-000366
- Version
- SQLI-22-016500
- Vuln IDs
-
- V-274447
- Rule IDs
-
- SV-274447r1111109_rule
Checks: C-78540r1111107_chk
If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, and the requirement is documented and authorized, this is not a finding. If Database Mirroring is in use, run the following to check for encrypted transmissions: SELECT name, type_desc, encryption_algorithm_desc FROM sys.database_mirroring_endpoints WHERE encryption_algorithm != 2 If any records are returned, this is a finding.
Fix: F-78445r1111108_fix
Run the following to enable encryption on the mirroring endpoint: ALTER ENDPOINT <Endpoint Name> FOR DATABASE_MIRRORING (ENCRYPTION = REQUIRED ALGORITHM AES)
- RMF Control
- CM-6
- Severity
- M
- CCI
- CCI-000366
- Version
- SQLI-22-016600
- Vuln IDs
-
- V-274448
- Rule IDs
-
- SV-274448r1111112_rule
Checks: C-78541r1111110_chk
If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, and the requirement is documented and authorized, this is not a finding. If SQL Service Broker is in use, run the following to check for encrypted transmissions: SELECT name, type_desc, encryption_algorithm_desc FROM sys.service_broker_endpoints WHERE encryption_algorithm != 2 If any records are returned, this is a finding.
Fix: F-78446r1111111_fix
Run the following to enable encryption on the Service Broker endpoint: ALTER ENDPOINT <EndpointName> FOR SERVICE_BROKER (ENCRYPTION = REQUIRED ALGORITHM AES)
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-016700
- Vuln IDs
-
- V-274449
- Rule IDs
-
- SV-274449r1111115_rule
Checks: C-78542r1111113_chk
To determine if permissions to execute registry extended stored procedures have been revoked from all users (other than dbo), execute the following command: SELECT OBJECT_NAME(major_id) AS [Stored Procedure] ,dpr.NAME AS [Principal] FROM sys.database_permissions AS dp INNER JOIN sys.database_principals AS dpr ON dp.grantee_principal_id = dpr.principal_id WHERE major_id IN ( OBJECT_ID('xp_regaddmultistring') ,OBJECT_ID('xp_regdeletekey') ,OBJECT_ID('xp_regdeletevalue') ,OBJECT_ID('xp_regenumvalues') ,OBJECT_ID('xp_regenumkeys') ,OBJECT_ID('xp_regremovemultistring') ,OBJECT_ID('xp_regwrite') ,OBJECT_ID('xp_instance_regaddmultistring') ,OBJECT_ID('xp_instance_regdeletekey') ,OBJECT_ID('xp_instance_regdeletevalue') ,OBJECT_ID('xp_instance_regenumkeys') ,OBJECT_ID('xp_instance_regenumvalues') ,OBJECT_ID('xp_instance_regremovemultistring') ,OBJECT_ID('xp_instance_regwrite') ) AND dp.[type] = 'EX' ORDER BY dpr.NAME; If any records are returned, review the system documentation to determine if accessing the registry via extended stored procedures is required and authorized. If it is not authorized, this is a finding.
Fix: F-78447r1111114_fix
Remove execute permissions to any registry extended stored procedure from all users (other than dbo): USE master GO REVOKE EXECUTE ON [<procedureName>] FROM [<principal>] GO
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-016800
- Vuln IDs
-
- V-274450
- Rule IDs
-
- SV-274450r1111117_rule
Checks: C-78543r1111116_chk
Review the system documentation to determine if FileStream is in use. If in use and authorized, this is not a finding. If FileStream is not documented as being authorized, execute the following query: EXEC sp_configure 'filestream access level' If "run_value" is greater than "0", this is a finding. This rule checks that the Filestream SQL-specific option is disabled. SELECT CASE WHEN EXISTS (SELECT * FROM sys.configurations WHERE Name = 'filestream access level' AND Cast(value AS INT) = 0) THEN 'No' ELSE 'Yes' END AS TSQLFileStreamAccess; If the above query returns "Yes" in the "FileStreamEnabled" field, this is a finding.
Fix: F-78448r1109270_fix
Disable the use of Filestream. 1. Delete all FILESTREAM columns from all tables. ALTER TABLE <name> DROP COLUMN <column name> 2. Disassociate tables from the FILESTREAM filegroups. ALTER TABLE <name> SET (FILESTREAM_ON = 'NULL' 3. Remove all FILESTREAM data containers. ALTER DATABASE <name> REMOVE FILE <file name> 4. Remove all FILESTREAM filegroups. ALTER DATABASE <name> REMOVE FILEGROUP <file name> 5. Disable FILESTREAM. EXEC sp_configure filestream_access_level, 0 RECONFIGURE 6. Restart the SQL Service.
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-017000
- Vuln IDs
-
- V-274451
- Rule IDs
-
- SV-274451r1111120_rule
Checks: C-78544r1111118_chk
To determine if the "Ole Automation Procedures" option is enabled, execute the following query: EXEC SP_CONFIGURE 'show advanced options', '1'; RECONFIGURE WITH OVERRIDE; EXEC SP_CONFIGURE 'Ole Automation Procedures'; If the value of "config_value" is "0", this is not a finding. If the value of "config_value" is "1", review the system documentation to determine whether the use of "Ole Automation Procedures" is required and authorized. If it is not authorized, this is a finding.
Fix: F-78449r1111119_fix
Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of "Ole Automation Procedures" option, from the query prompt: sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ole Automation Procedures', 0; GO RECONFIGURE; GO
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- SQLI-22-017100
- Vuln IDs
-
- V-274452
- Rule IDs
-
- SV-274452r1111123_rule
Checks: C-78545r1111121_chk
To determine if "User Options" option is enabled, execute the following query: EXEC SP_CONFIGURE 'show advanced options', '1'; RECONFIGURE WITH OVERRIDE; EXEC SP_CONFIGURE 'user options'; If the value of "config_value" is "0", this is not a finding. If the value of "config_value" is "1", review the system documentation to determine whether the use of "user options" is required and authorized. If it is not authorized, this is a finding.
Fix: F-78450r1111122_fix
Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of the "User Options" option, from the query prompt: sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'user options', 0; GO RECONFIGURE; GO
- RMF Control
- AU-10
- Severity
- M
- CCI
- CCI-000166
- Version
- SQLI-22-004250
- Vuln IDs
-
- V-274453
- Rule IDs
-
- SV-274453r1109109_rule
Checks: C-78546r1109107_chk
Execute the following query: SELECT name FROM sys.database_principals WHERE type in ('U','G') AND name LIKE '%$' If no users are returned, this is not a finding. If users are returned, determine whether each user is a computer account. Launch PowerShell. Execute the following code: Note: <name> represents the username portion of the user. For example, if the user is "CONTOSO\user1$", the username is "user1". ([ADSISearcher]"(&(ObjectCategory=Computer)(Name=<name>))").FindAll() If no account information is returned, this is not a finding. If account information is returned, this is a finding.
Fix: F-78451r1109108_fix
Ensure all logins are uniquely identifiable and authenticate all users who log on to the system. This likely would be done via a combination of Active Directory with unique accounts and the SQL Server by ensuring mapping to individual accounts. Verify server documentation to ensure accounts are documented and unique. Remove any undocumented accounts or shared accounts that cannot be individually authenticated.