{"stig":{"title":"MS SQL Server 2016 Instance Security Technical Implementation Guide","version":"3","release":"6"},"checks":[{"vulnId":"V-213929","ruleId":"SV-213929r1018580_rule","severity":"medium","ruleTitle":"SQL Server must limit the number of concurrent sessions to an organization-defined number per user for all accounts and/or account types.","description":"Database management includes the ability to control the number of users and user sessions utilizing SQL Server. Unlimited concurrent connections to SQL Server could allow a successful denial-of-service (DoS) attack by exhausting connection resources; and a system can also fail or be degraded by an overload of legitimate users. Limiting the number of concurrent sessions is helpful in reducing these risks.\n  \nThis requirement addresses concurrent session control for a single account. It does not address concurrent sessions by a single user via multiple system accounts.\n  \nThe capability to limit the number of concurrent sessions per user must be configured in or added to SQL Server (for example, by use of a logon trigger), when this is technically feasible. Note that it is not sufficient to limit sessions via a web server or application server alone, because legitimate users and adversaries can potentially connect to SQL Server by other means. \n  \nThe organization will need to define the maximum number of concurrent sessions by account type, by account, or a combination thereof. In deciding on the appropriate number, it is important to consider the work requirements of the various types of users. For example, 2 might be an acceptable limit for general users accessing the database via an application; but 10 might be too few for a database administrator using a database management GUI tool, where each query tab and navigation pane may count as a separate session.\n  \n(Sessions may also be referred to as connections or logons, which for the purposes of this requirement are synonyms.)","checkContent":"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 2 for all other users. \n \nIf 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.\n\nDue to excessive CPU consumption when utilizing 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.\n\nIn SQL Server Management Studio's Object Explorer tree:\nRight-click on the Server Name >> Select Properties >> Select Connections Tab\n\nOR\n\nRun the query:\nEXEC sys.sp_configure N'user connections'\n\nIf the max connection limit is set to 0 (unlimited) or does not match the documented value, this is a finding.\n \nOtherwise, determine if a logon trigger exists:  \n \nIn SQL Server Management Studio's Object Explorer tree:  \nExpand [SQL Server Instance] >> Server Objects >> Triggers  \n \nOR \n \nRun the query:  \nSELECT name FROM master.sys.server_triggers;  \n \nIf no triggers are listed, this is a finding.  \n \nIf 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.  \n \nExamine the trigger source code for logical correctness and for compliance with the documented limit(s). If errors or variances exist, this is a finding.\n \nVerify 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.","fixText":"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.\n\nIn SQL Server Management Studio's Object Explorer tree, right-click on the Server Name >> Select Properties >> Select Connections Tab >> Set the Maximum Number of Concurrent Connections to a value other than 0 (0 = unlimited), and document it.\n\nOR\n\nRun the query:\n\nEXEC sys.sp_configure N'user connections','5000' /* this is an example max limit */\nGO\nRECONFIGURE WITH OVERRIDE\nGO\n\nRestart SQL Server for the setting to take effect.\n\nReference: https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-the-user-connections-server-configuration-option?\n\nOtherwise, 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.  \n\nExample script below:\n \nCREATE TRIGGER SQL_STIG_Connection_Limit \nON ALL SERVER WITH EXECUTE AS 'renamed_sa' /*Make sure to use the renamed SA account here*/ \nFOR LOGON \nAS \nBEGIN \nIf (Select COUNT(1) from sys.dm_exec_sessions WHERE is_user_process = 1 AND original_login_name = ORIGINAL_LOGIN() ) > \n  (CASE ORIGINAL_LOGIN()\n              WHEN 'domain/ima.dba' THEN 150    /*this is a busy DBA’s domain account */\n              WHEN 'application1_login' THEN 6  /* this is a SQL login for an application */\n              WHEN 'application2_login' THEN 20 /* this is a SQL login for another application */\n              …\n              ELSE 1 /* All unspecified users are restricted to a single login */\n  END)\n              BEGIN \n                             PRINT 'The login [' + ORIGINAL_LOGIN() + '] has exceeded its concurrent session limit.' \n                             ROLLBACK; \n              END\nEND; \n  \nReference:  https://msdn.microsoft.com/en-us/library/ms189799.aspx","ccis":["CCI-000054"]},{"vulnId":"V-213930","ruleId":"SV-213930r1043176_rule","severity":"high","ruleTitle":"SQL Server must integrate with an organization-level authentication/access mechanism providing account management and automation for all users, groups, roles, and any other principals.","description":"Enterprise environments make account management for applications and databases challenging and complex. A manual process for account management functions adds the risk of a potential oversight or other error. Managing accounts for the same person in multiple places is inefficient and prone to problems with consistency and synchronization. \n \nA comprehensive application account management process that includes automation helps to ensure that accounts designated as requiring attention are consistently and promptly addressed.  \n \nExamples include, but are not limited to, using automation to take action on multiple accounts designated as inactive, suspended, or terminated, or by disabling accounts located in non-centralized account stores, such as multiple servers. Account management functions can also include: assignment of group or role membership; identifying account type; specifying user access authorizations (i.e., privileges); account removal, update, or termination; and administrative alerts. The use of automated mechanisms can include, for example, using email or text messaging to notify account managers when users are terminated or transferred; using the information system to monitor account usage; and using automated telephone notification to report atypical system account usage. \n \nSQL Server must be configured to automatically utilize organization-level account management functions, and these functions must immediately enforce the organization's current account policy.  \n \nAutomation may be composed of differing technologies that when placed together contain an overall mechanism supporting an organization's automated account management requirements.","checkContent":"Determine whether SQL Server is configured to use only Windows authentication.  \n \nIn the Object Explorer in SQL Server Management Studio (SSMS), right-click on the server instance. \nSelect \"Properties\".  \nSelect the Security page.  \n \nIf Windows Authentication Mode is selected, this is not a finding.  \n \nOR \n \nIn a query interface such as the SSMS Transact-SQL editor, run the statement:  \nSELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly')    \nWHEN 1 THEN 'Windows Authentication'    \nWHEN 0 THEN 'Windows and SQL Server Authentication'    \nEND as [Authentication Mode]  \n \nIf the returned value in the \"Authentication Mode\" column is \"Windows Authentication\", this is not a finding.  \n \nMixed 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.  \n \nFrom the documentation, obtain the list of accounts authorized to be managed by SQL Server.  \n \nDetermine the accounts (SQL Logins) actually managed by SQL Server. Run the statement:  \n \nSELECT name \nFROM sys.sql_logins \nWHERE type_desc = 'SQL_LOGIN' AND is_disabled = 0;  \n \nIf any accounts listed by the query are not listed in the documentation, this is a finding.","fixText":"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.\n\nDocumentation must be approved by the ISSO/ISSM.\n \nIf mixed mode is not required, disable it as follows:  \n \nIn the SSMS Object Explorer, right-click on the server instance. \nSelect \"Properties\".  \nSelect the Security page.  \nClick on the radio button for \"Windows Authentication Mode\".  \nClick on \"OK\".  \nRestart the SQL Server instance.  \n \nOR  \n \nRun the statement:  \nUSE [master] \nEXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\\Microsoft\\MSSQLServer\\MSSQLServer', N'LoginMode', REG_DWORD, 2 \nGO \n \nRestart the SQL Server instance.  \n \nFor 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.  \n \nTo drop or disable a login in the SSMS Object Explorer:  \nNavigate to \"Security Logins\".  \nRight-click on the login name and click \"Delete\" or \"Disable\".  \n \nTo drop or disable a login by using a query:  \nUSE master;  \nDROP LOGIN login_name; \nALTER LOGIN login_name DISABLE; \n \nDropping 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. \n \nTo drop a user in the SSMS Object Explorer:  \nNavigate to Databases >> Security Users.  \nRight-click on the user name. \nClick \"Delete\".  \n \nTo drop a user via a query:  \nUSE database_name; \nDROP USER <user_name>;","ccis":["CCI-000015"]},{"vulnId":"V-213931","ruleId":"SV-213931r1043176_rule","severity":"medium","ruleTitle":"SQL Server must be configured to utilize the most-secure authentication method available.","description":"Enterprise environments make account management for applications and databases challenging and complex. A manual process for account management functions adds the risk of a potential oversight or other error. Managing accounts for the same person in multiple places is inefficient and prone to problems with consistency and synchronization. \n \nA comprehensive application account management process that includes automation helps to ensure that accounts designated as requiring attention are consistently and promptly addressed.  \n \nExamples include, but are not limited to, using automation to take action on multiple accounts designated as inactive, suspended, or terminated, or by disabling accounts located in non-centralized account stores, such as multiple servers. Account management functions can also include: assignment of group or role membership; identifying account type; specifying user access authorizations (i.e., privileges); account removal, update, or termination; and administrative alerts. The use of automated mechanisms can include, for example: using email or text messaging to notify account managers when users are terminated or transferred; using the information system to monitor account usage; and using automated telephone notification to report atypical system account usage. \n \nSQL Server must be configured to automatically utilize organization-level account management functions, and these functions must immediately enforce the organization's current account policy.  \n \nAutomation may be comprised of differing technologies that when placed together contain an overall mechanism supporting an organization's automated account management requirements. \n \nSQL Server supports several authentication methods to allow operation in various environments, Kerberos, NTLM, and SQL Server. An instance of SQL Server must be configured to utilize the most-secure method available. Service accounts utilized by SQL Server should be unique to a given instance.","checkContent":"If the SQL Server is not part of an Active Directory domain, this finding is Not Applicable. \n\nObtain the fully qualified domain name of the SQL Server instance: \n\nLaunch Windows Explorer. \n\nRight-click on \"Computer\" or \"This PC\" (Varies by OS level), click \"Properties\". \n\nNote the value shown for \"Full computer name\". \n\n*** Note: For a cluster, this value must be obtained from the Failover Cluster Manager. *** \n\nObtain the TCP port that is supporting the SQL Server instance: \n\nClick Start >> Type \"SQL Server 2016 Configuration Manager\" >> From the search results, click \"SQL Server 2016 Configuration Manager\". \n\nFrom the tree on the left, expand \"SQL Server Network Configuration\". \n\nClick \"Protocols for <Instance Name>\" where <Instance Name> is the name of the instance (MSSQLSERVER is the default name). \n\nIn the right pane, right-click on \"TCP/IP\" and choose \"Properties\". \n\nIn the window that opens, click the \"IP Addresses\" tab. \n\nNote the TCP port configured for the instance. \n\nObtain the service account that is running the SQL Server service: \n\nClick \"Start\".  \nType \"SQL Server 2016 Configuration Manager\".  \nFrom the search results, click \"SQL Server 2016 Configuration Manager\". \n\nFrom the tree on the left, select \"SQL Server Services\". \n\nNote the account listed in the \"Log On As\" column for the SQL Server instance being reviewed. \n\nLaunch a command-line or PowerShell window. \n\nEnter the following command where <Service Account> is the identity of the service account. \n\nsetspn -L <Service Account> \n\nExample: setspn -L CONTOSO\\sql2016svc \n\nReview the Registered Service Principal Names returned.  \n\nIf the listing does not contain the following supported service principal names (SPN) formats, this is a finding. \n\nNamed instance\n   MSSQLSvc/<FQDN>:[<port> | <instancename>], where:\n   MSSQLSvc is the service that is being registered.\n   <FQDN> is the fully qualified domain name of the server.\n   <port> is the TCP port number.\n   <instancename> is the name of the SQL Server instance.\n\nDefault instance\n   MSSQLSvc/<FQDN>:<port> | MSSQLSvc/<FQDN>, where:\n   MSSQLSvc is the service that is being registered.\n   <FQDN> is the fully qualified domain name of the server.\n   <port> is the TCP port number.\n\nIf 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.","fixText":"Ensure Service Principal Names (SPNs) are properly registered for the SQL Server instance. \n\nUtilize the Microsoft Kerberos Configuration Manager to review Kerberos configuration issues for a given SQL Server instance. \n\nhttps://www.microsoft.com/en-us/download/details.aspx?id=39046 \n\nAlternatively, SPNs for SQL Server can be manually registered. \n\nFor 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>.\n\nUsing an account with permissions to register SPNs, issue the following commands from a command-prompt: \n\nsetspn -S MSSQLSvc/<Fully Qualified Domain Name> <Service Account> \nsetspn -S MSSQLSvc/<Fully Qualified Domain Name>:<TCP Port> <Service Account> \nFor a named instance, use:\nsetspn -S MSSQLSvc/<FQDN>:<instancename> <Service Account> \nsetspn -S MSSQLSvc/<FQDN>:<TCP Port> <Service Account>\n\nRestart the SQL Server instance. \n\nMore information regarding this process is available at:  \nhttps://docs.microsoft.com/en-us/sql/database-engine/configure-windows/register-a-service-principal-name-for-kerberos-connections#Manual","ccis":["CCI-000015"]},{"vulnId":"V-213932","ruleId":"SV-213932r1137654_rule","severity":"high","ruleTitle":"SQL Server must enforce approved authorizations for logical access to information and system resources in accordance with applicable access control policies.","description":"Authentication with a DoD-approved PKI certificate does not necessarily imply authorization to access SQL Server.  To mitigate the risk of unauthorized access to sensitive information by entities that have been issued certificates by DoD-approved PKIs, all DoD systems, including databases, must be properly configured to implement access control policies.  \n \nSuccessful authentication must not automatically give an entity access to an asset or security boundary. Authorization procedures and controls must be implemented to ensure each authenticated entity also has a validated and current authorization. Authorization is the process of determining whether an entity, once authenticated, is permitted to access a specific asset. Information systems use access control policies and enforcement mechanisms to implement this requirement.  \n \nAccess control policies include identity-based policies, role-based policies, and attribute-based policies. Access enforcement mechanisms include access control lists, access control matrices, and cryptography. These policies and mechanisms must be employed by the application to control access between users (or processes acting on behalf of users) and objects (e.g., devices, files, records, processes, programs, and domains) in the information system.  \n \nThis requirement is applicable to access control enforcement applications, a category that includes database management systems.  If SQL Server does not follow applicable policy when approving access, it may be in conflict with networks or other applications in the information system. This may result in users either gaining or being denied access inappropriately and in conflict with applicable policy.","checkContent":"Review the system documentation to determine the required levels of protection for DBMS server securables, by type of login.  \n \nReview the permissions actually in place on the server.  \n \nIf the actual permissions do not match the documented requirements, this is a finding. \n \nUse the supplemental file \"Instance permissions assignments to logins and roles.sql.\"","fixText":"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.","ccis":["CCI-000213"]},{"vulnId":"V-213933","ruleId":"SV-213933r1167475_rule","severity":"medium","ruleTitle":"SQL Server must protect against a user falsely repudiating by ensuring all accounts are individual, unique, and not shared.","description":"Nonrepudiation of actions taken is required to maintain data integrity. Examples of particular actions taken by individuals include creating information, sending a message, approving information (e.g., indicating concurrence or signing a contract), and receiving a message.  \n \nNonrepudiation protects against later claims by a user of not having created, modified, or deleted a particular data item or collection of data in the database. \n \nIn designing a database, the organization must define the types of data and the user actions that must be protected from repudiation. The implementation must then include building audit features into the application data tables and configuring SQL Server's audit tools to capture the necessary audit trail. Design and implementation also must ensure that applications pass individual user identification to SQL Server, even where the application connects to SQL Server with a standard, shared account.\n\nSatisfies: SRG-APP-000080-DB-000063, SRG-APP-000815-DB-000160","checkContent":"Obtain the list of authorized SQL Server accounts in the system documentation.  \n \nDetermine if any accounts are shared. A shared account is defined as a username and password 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. \n \nIf accounts are determined to be shared, determine if individuals are first individually authenticated.  \n \nIf 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.  \n \nThe key is individual accountability. If this can be traced, this is not a finding.  \n \nIf accounts are shared, determine if they are directly accessible to end users. If so, this is a finding.  \n \nReview contents of audit logs, traces and data tables to confirm the identity of the individual user performing the action is captured.  \n \nIf shared identifiers are found, and not accompanied by individual identifiers, this is a finding.  \n \nNote: 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.","fixText":"Remove user-accessible shared accounts and use individual user IDs.  \n \nBuild/configure applications to ensure successful individual authentication prior to shared account access.  \n \nEnsure each user's identity is received and used in audit data in all relevant circumstances.  \n \nDesign, 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.","ccis":["CCI-000166"]},{"vulnId":"V-213934","ruleId":"SV-213934r960864_rule","severity":"medium","ruleTitle":"SQL Server must protect against a user falsely repudiating by ensuring the NT AUTHORITY SYSTEM account is not used for administration.","description":"Non-repudiation of actions taken is required in order to maintain data integrity. Examples of particular actions taken by individuals include creating information, sending a message, approving information (e.g., indicating concurrence or signing a contract), and receiving a message.  \n \nNon-repudiation protects against later claims by a user of not having created, modified, or deleted a particular data item or collection of data in the database. \n \nIn designing a database, the organization must define the types of data and the user actions that must be protected from repudiation. The implementation must then include building audit features into the application data tables and configuring the DBMS's audit tools to capture the necessary audit trail. Design and implementation also must ensure that applications pass individual user identification to the DBMS, even where the application connects to the DBMS with a standard, shared account. \n \nAny user with enough access to the server can execute a task that will be run as NT AUTHORITY\\SYSTEM either using task scheduler or other tools. At this point, NT AUTHORITY\\SYSTEM essentially becomes a shared account because the operating system and SQL Server are unable to determine who created the process. \n \nPrior to SQL Server 2012, NT AUTHORITY\\SYSTEM was a member of the sysadmin role by default. This allowed jobs/tasks to be executed in SQL Server without the approval or knowledge of the DBA because it looked like operating system activity.","checkContent":"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.\n\nSELECT\n    SERVERPROPERTY('IsClustered') AS [IsClustered],\n    SERVERPROPERTY('IsHadrEnabled') AS [IsHadrEnabled]\n\nEXECUTE AS LOGIN = 'NT AUTHORITY\\SYSTEM'\n\nSELECT * FROM fn_my_permissions(NULL, 'server')\n\nREVERT\n\nGO\n\n \nIf IsClustered returns 1, IsHadrEnabled returns 0, and any permissions have been granted to the Local System account beyond \"CONNECT SQL\", \"VIEW SERVER STATE\", and \"VIEW ANY DATABASE\", this is a finding.\n \nIf 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\", and \"VIEW ANY DATABASE\", this is a finding.\n \nIf 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.","fixText":"Remove permissions that were identified as not allowed in the check content.\n\nUSE Master;\n\nREVOKE <Permission> TO [NT AUTHORITY\\SYSTEM]\n\nGO\n\n\nTo grant permissions to services or applications, utilize the Service SID of the service or a domain service account.","ccis":["CCI-000166"]},{"vulnId":"V-213935","ruleId":"SV-213935r960864_rule","severity":"medium","ruleTitle":"SQL Server must protect against a user falsely repudiating by ensuring only clearly unique Active Directory user accounts can connect to the instance.","description":"Non-repudiation of actions taken is required in order to maintain data integrity. Examples of particular actions taken by individuals include creating information, sending a message, approving information (e.g., indicating concurrence or signing a contract), and receiving a message.  \n \nNon-repudiation protects against later claims by a user of not having created, modified, or deleted a particular data item or collection of data in the database. \n \nIn designing a database, the organization must define the types of data and the user actions that must be protected from repudiation. The implementation must then include building audit features into the application data tables and configuring the DBMS's audit tools to capture the necessary audit trail. Design and implementation also must ensure that applications pass individual user identification to the DBMS, even where the application connects to the DBMS with a standard, shared account. \n \nIf the computer account of a remote computer is granted access to SQL Server, any service or scheduled task running as NT AUTHORITY\\SYSTEM or NT AUTHORITY\\NETWORK SERVICE can log into the instance and perform actions. These actions cannot be traced back to a specific user or process.","checkContent":"Execute the following query:\n\nSELECT name\nFROM sys.server_principals\nWHERE type in ('U','G')\nAND name LIKE '%$'\n\nIf no logins are returned, this is not a finding.\n\nIf logins are returned, determine whether each login is a computer account.\n\nLaunch PowerShell.\n\nExecute the following code:\n\nNote: <name> represents the username portion of the login. For example, if the login is \"CONTOSO\\user1$\", the username is \"user1\".\n\n([ADSISearcher]\"(&(ObjectCategory=Computer)(Name=<name>))\").FindAll()\n\nIf no account information is returned, this is not a finding.\n\nIf account information is returned, this is a finding.","fixText":"Remove all logins that were returned in the check content.","ccis":["CCI-000166"]},{"vulnId":"V-213936","ruleId":"SV-213936r960879_rule","severity":"medium","ruleTitle":"SQL Server must be configured to generate audit records for DoD-defined auditable events within all DBMS/database components.","description":"Without the capability to generate audit records, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one.  \n \nAudit records can be generated from various components within SQL Server (e.g., process, module). Certain specific application functionalities may be audited as well. The list of audited events is the set of events for which audits are to be generated. This set of events is typically a subset of the list of all events for which the system is capable of generating audit records. \n \nDoD has defined the list of events for which SQL Server will provide an audit record generation capability as the following:  \n \n(i) Successful and unsuccessful attempts to access, modify, or delete privileges, security objects, security levels, or categories of information (e.g., classification levels); \n \n(ii) Access actions, such as successful and unsuccessful logon attempts, privileged activities, or other system-level access, starting and ending time for user access to the system, concurrent logons from different workstations, successful and unsuccessful accesses to objects, all program initiations, and all direct access to the information system; and \n \n(iii) All account creation, modification, disabling, and termination actions. \n \nOrganizations may define additional events requiring continuous or ad hoc auditing.","checkContent":"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. \n \nExecute the following query to get all of the installed audits: \n \nSELECT name AS 'Audit Name', \nstatus_desc AS 'Audit Status', \naudit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status \n \nAll currently defined audits for the SQL server instance will be listed. If no audits are returned, this is a finding.  \n \nTo view the actions being audited by the audits, execute the following query: \n \nSELECT a.name AS 'AuditName', \ns.name AS 'SpecName', \nd.audit_action_name AS 'ActionName', \nd.audited_result AS 'Result' \nFROM sys.server_audit_specifications s \nJOIN sys.server_audits a ON s.audit_guid = a.audit_guid \nJOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id \nWHERE a.is_state_enabled = 1 \n \nCompare the documentation to the list of generated audit events. If there are any missing events, this is a finding.","fixText":"Add all required audit events to the STIG Compliant audit specification server documentation.","ccis":["CCI-000169"]},{"vulnId":"V-213937","ruleId":"SV-213937r960882_rule","severity":"medium","ruleTitle":"SQL Server must allow only the ISSM (or individuals or roles appointed by the ISSM) to select which auditable events are to be audited.","description":"Without the capability to restrict which roles and individuals can select which events are audited, unauthorized personnel may be able to prevent or interfere with the auditing of critical events. \n \nSuppression of auditing could permit an adversary to evade detection. \n \nMisconfigured audits can degrade the system's performance by overwhelming the audit log. Misconfigured audits may also make it more difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one.","checkContent":"Obtain the list of approved audit maintainers from the system documentation. \n \nReview the server roles and individual logins that have the following role memberships, all of which enable the ability to create and maintain audit definitions. \n \nsysadmin \ndbcreator \n \nReview the server roles and individual logins that have the following permissions, all of which enable the ability to create and maintain audit definitions. \n \nALTER ANY SERVER AUDIT  \nCONTROL SERVER  \nALTER ANY DATABASE  \nCREATE ANY DATABASE \n \nUse the following query to determine the roles and logins that have the listed permissions: \n \nSELECT-- DISTINCT \n    CASE \n        WHEN SP.class_desc IS NOT NULL THEN  \n            CASE \n                WHEN SP.class_desc = 'SERVER' AND S.is_linked = 0 THEN 'SERVER' \n                WHEN SP.class_desc = 'SERVER' AND S.is_linked = 1 THEN 'SERVER (linked)' \n                ELSE SP.class_desc \n            END \n        WHEN E.name IS NOT NULL THEN 'ENDPOINT' \n        WHEN S.name IS NOT NULL AND S.is_linked = 0 THEN 'SERVER' \n        WHEN S.name IS NOT NULL AND S.is_linked = 1 THEN 'SERVER (linked)' \n        WHEN P.name IS NOT NULL THEN 'SERVER_PRINCIPAL' \n        ELSE '???'  \n    END                    AS [Securable Class], \n    CASE \n        WHEN E.name IS NOT NULL THEN E.name \n        WHEN S.name IS NOT NULL THEN S.name  \n        WHEN P.name IS NOT NULL THEN P.name \n        ELSE '???'  \n    END                    AS [Securable], \n    P1.name                AS [Grantee], \n    P1.type_desc           AS [Grantee Type], \n    sp.permission_name     AS [Permission], \n    sp.state_desc          AS [State], \n    P2.name                AS [Grantor], \n    P2.type_desc           AS [Grantor Type], \nR.name    AS [Role Name] \nFROM \n    sys.server_permissions SP \n    INNER JOIN sys.server_principals P1 \n        ON P1.principal_id = SP.grantee_principal_id \n    INNER JOIN sys.server_principals P2 \n        ON P2.principal_id = SP.grantor_principal_id \n \n    FULL OUTER JOIN sys.servers S \n        ON  SP.class_desc = 'SERVER' \n        AND S.server_id = SP.major_id \n \n    FULL OUTER JOIN sys.endpoints E \n        ON  SP.class_desc = 'ENDPOINT' \n        AND E.endpoint_id = SP.major_id \n \n    FULL OUTER JOIN sys.server_principals P \n        ON  SP.class_desc = 'SERVER_PRINCIPAL'         \n        AND P.principal_id = SP.major_id \n \nFULL OUTER JOIN sys.server_role_members SRM \nON P.principal_id = SRM.member_principal_id \n \nLEFT OUTER JOIN sys.server_principals R \nON SRM.role_principal_id = R.principal_id \nWHERE sp.permission_name IN ('ALTER ANY SERVER AUDIT','CONTROL SERVER','ALTER ANY DATABASE','CREATE ANY DATABASE') \nOR R.name IN ('sysadmin','dbcreator') \n \nIf 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.","fixText":"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):   \n \nCREATE SERVER ROLE SERVER_AUDIT_MAINTAINERS; \nGO \n \nGRANT ALTER ANY SERVER AUDIT TO SERVER_AUDIT_MAINTAINERS; \nGO     \n \nUse 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:   \n \nALTER SERVER ROLE SERVER_AUDIT_MAINTAINERS ADD MEMBER; \nGO \n \nUse 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.","ccis":["CCI-000171"]},{"vulnId":"V-213939","ruleId":"SV-213939r1167477_rule","severity":"medium","ruleTitle":"SQL Server must generate audit records when attempts to access privileges, categorized information, and security objects occur.","description":"Under some circumstances, it may be useful to monitor who/what is reading privilege/permission/role information. Therefore, monitoring must be possible. DBMSs typically make such information available through views or functions.\n \nThis requirement addresses explicit requests for privilege/permission/role membership information. It does not refer to the implicit retrieval of privileges/permissions/role memberships that SQL Server continually performs to determine if any and every action on the database is permitted. \n \nTo aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.\n\nSatisfies: SRG-APP-000091-DB-000325, SRG-APP-000091-DB-000066, SRG-APP-000492-DB-000332, SRG-APP-000492-DB-000333, SRG-APP-000494-DB-000344, SRG-APP-000494-DB-000345, SRG-APP-000498-DB-000346, SRG-APP-000498-DB-000347, SRG-APP-000502-DB-000348, SRG-APP-000502-DB-000349, SRG-APP-000507-DB-000356, SRG-APP-000507-DB-000357","checkContent":"Review the system documentation to determine if SQL Server is required to audit when the following events occur:\n\n- Attempts to retrieve privilege/permission/role membership information.\n- Security objects are accessed, modified, or deleted.\n- Data classifications (e.g., classification levels/security levels) are accessed, modified, or deleted.\n- Any other specified objects are accessed, modified, or deleted as required by the site.\n\nIf SQL Server is not required to audit any of the above, this is not a finding. \n \nIf the documentation does not exist, this is a finding. \n \nDetermine if an audit is configured and started by executing the following query. If no records are returned, this is a finding. \n \nSELECT name AS 'Audit Name', \nstatus_desc AS 'Audit Status', \naudit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status \n \nIf 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: \n \nSELECT a.name AS 'AuditName', \ns.name AS 'SpecName', \nd.audit_action_name AS 'ActionName', \nd.audited_result AS 'Result' \nFROM sys.server_audit_specifications s \nJOIN sys.server_audits a ON s.audit_guid = a.audit_guid \nJOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id \nWHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_ACCESS_GROUP' \n \nIf the SCHEMA_OBJECT_ACCESS_GROUP is not returned in an active audit, this is a finding.","fixText":"Deploy an audit to audit the retrieval of privilege/permission/role membership information. See the supplemental file \"SQL 2016 Audit.sql\".","ccis":["CCI-000172"]},{"vulnId":"V-213940","ruleId":"SV-213940r960888_rule","severity":"medium","ruleTitle":"SQL Server must initiate session auditing upon startup.","description":"Session auditing is for use when a user's activities are under investigation. To be sure of capturing all activity during those periods when session auditing is in use, it needs to be in operation for the whole time SQL Server is running.","checkContent":"When Audits are enabled, they start up when the instance starts. \nhttps://msdn.microsoft.com/en-us/library/cc280386.aspx#Anchor_2 \n \nCheck if an audit is configured and enabled. \n \nExecute the following query: \n \nSELECT name AS 'Audit Name', \nstatus_desc AS 'Audit Status', \naudit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status \nWHERE status_desc = 'STARTED' \n \nAll currently defined audits for the SQL server instance will be listed. If no audits are returned, this is a finding.","fixText":"Configure the SQL Audit(s) to automatically start during system start-up.  \n \nALTER SERVER AUDIT [<Server Audit Name>] WITH STATE = ON \n \nExecute the following query: \n \nSELECT name AS 'Audit Name', \n  status_desc AS 'Audit Status', \n  audit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status \nWHERE status_desc = 'STARTED' \n \nEnsure the SQL STIG Audit is configured to initiate session auditing upon startup.","ccis":["CCI-001464"]},{"vulnId":"V-213941","ruleId":"SV-213941r960909_rule","severity":"medium","ruleTitle":"SQL Server must include additional, more detailed, organization-defined information in the audit records for audit events identified by type, location, or subject.","description":"Information system auditing capability is critical for accurate forensic analysis. Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. To support analysis, some types of events will need information to be logged that exceeds the basic requirements of event type, time stamps, location, source, outcome, and user identity. If additional information is not available, it could negatively impact forensic investigations into user actions or other malicious events. \n \nThe organization must determine what additional information is required for complete analysis of the audited events. The additional information required is dependent on the type of information (e.g., sensitivity of the data and the environment within which it resides). At a minimum, the organization must employ either full-text recording of privileged commands or the individual identities of users of shared accounts, or both. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.  \n \nExamples of detailed information the organization may require in audit records are full-text recording of privileged commands or the individual identities of shared account users.","checkContent":"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. \n \nReview system documentation to determine whether SQL Server is required to audit any events, and any fields, in addition to those in the standard audit.  \n \nIf there are none specified, this is not a finding.  \n \nIf SQL Server Audit is in use, compare the audit specification(s) with the documented requirements.  \n \nIf any such requirement is not satisfied by the audit specification(s) (or by supplemental, locally-deployed mechanisms), this is a finding.","fixText":"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. \n \nImplement additional custom audits to capture the additional organizational required information.","ccis":["CCI-000135"]},{"vulnId":"V-213942","ruleId":"SV-213942r1043188_rule","severity":"medium","ruleTitle":"SQL Server must by default shut down upon audit failure, to include the unavailability of space for more audit log records; or must be configurable to shut down upon audit failure.","description":"It is critical that when SQL Server is at risk of failing to process audit logs as required, it takes action to mitigate the failure. Audit processing failures include: software/hardware errors; failures in the audit capturing mechanisms; and audit storage capacity being reached or exceeded. Responses to audit failure depend upon the nature of the failure mode.  \n \nWhen the need for system availability does not outweigh the need for a complete audit trail, SQL Server should shut down immediately, rolling back all in-flight transactions. \n \nSystems where audit trail completeness is paramount will most likely be at a lower MAC level than MAC I; the final determination is the prerogative of the application owner, subject to Authorizing Official concurrence. In any case, sufficient auditing resources must be allocated to avoid a shutdown in all but the most extreme situations.","checkContent":"If the system documentation indicates that availability takes precedence over audit trail completeness, this is not applicable (NA).  \n \nIf SQL Server Audit is in use, review the defined server audits by running the statement:  \n \nSELECT * FROM sys.server_audits;  \n \nBy observing the [name] and [is_state_enabled] columns, identify the row or rows in use.  \n \nIf the [on_failure_desc] is \"SHUTDOWN SERVER INSTANCE\" on this/these row(s), this is not a finding. Otherwise, this is a finding.","fixText":"If SQL Server Audit is in use, configure SQL Server Audit to shut SQL Server down upon audit failure, to include running out of space for audit logs.  \n \nRun this T-SQL script for each identified audit:  \n \nALTER SERVER AUDIT [AuditNameHere] WITH (STATE = OFF);  \nGO  \nALTER SERVER AUDIT [AuditNameHere] WITH (ON_FAILURE = SHUTDOWN);  \nGO  \nALTER SERVER AUDIT [AuditNameHere] WITH (STATE = ON);  \nGO","ccis":["CCI-000140"]},{"vulnId":"V-213943","ruleId":"SV-213943r1043188_rule","severity":"medium","ruleTitle":"SQL Server must be configurable to overwrite audit log records, oldest first (First-In-First-Out - FIFO), in the event of unavailability of space for more audit log records.","description":"It is critical that when SQL Server is at risk of failing to process audit logs as required, it take action to mitigate the failure. Audit processing failures include; software/hardware errors; failures in the audit capturing mechanisms; and audit storage capacity being reached or exceeded. Responses to audit failure depend upon the nature of the failure mode.  \n \nWhen availability is an overriding concern, approved actions in response to an audit failure are as follows:  \n \n(i) If the failure was caused by the lack of audit record storage capacity, SQL Server must continue generating audit records, if possible (automatically restarting the audit service if necessary), overwriting the oldest audit records in a first-in-first-out manner.  \n \n(ii) If audit records are sent to a centralized collection server and communication with this server is lost or the server fails, SQL Server must queue audit records locally until communication is restored or until the audit records are retrieved manually. Upon restoration of the connection to the centralized collection server, action should be taken to synchronize the local audit data with the collection server.  \n \nSystems where availability is paramount will most likely be MAC I; the final determination is the prerogative of the application owner, subject to Authorizing Official concurrence. In any case, sufficient auditing resources must be allocated to avoid audit data loss in all but the most extreme situations.","checkContent":"If the system documentation indicates that availability does not take precedence over audit trail completeness, this is not applicable (NA). \n\nExecute the following query:\n\nSELECT a.name 'audit_name',\n    a.type_desc 'storage_type',\n    f.max_rollover_files\nFROM sys.server_audits a\nLEFT JOIN sys.server_file_audits f ON a.audit_id = f.audit_id\nWHERE a.is_state_enabled = 1\n\nIf no records are returned, this is a finding.\n\nIf the \"storage_type\" is \"APPLICATION LOG\" or \"SECURITY LOG\", this is not a finding.\n\nIf the \"storage_type\" is \"FILE\" and \"max_rollover_files\" is greater than zero, this is not a finding. Otherwise, this is a finding.","fixText":"If SQL Server Audit is in use, configure SQL Server Audit to continue to generate audit records, overwriting the oldest existing records, in the case of an auditing failure. \n \nRun this T-SQL script for each identified audit:  \n \nALTER SERVER AUDIT [AuditName] WITH (STATE = OFF);  \nGO  \nALTER SERVER AUDIT [AuditName] to file (max_rollover_files = IntegerValue);  \nGO  \nALTER SERVER AUDIT [AuditName] WITH (STATE = ON);  \nGO","ccis":["CCI-000140"]},{"vulnId":"V-213944","ruleId":"SV-213944r960930_rule","severity":"medium","ruleTitle":"The audit information produced by SQL Server must be protected from unauthorized access, modification, and deletion.","description":"If audit data were to become compromised, then competent forensic analysis and discovery of the true source of potentially malicious system activity is difficult, if not impossible, to achieve. In addition, access to audit records provides information an attacker could potentially use to his or her advantage.  \n\nTo ensure the veracity of audit data, the information system and/or the application must protect audit information from any and all unauthorized access. This includes read, write, copy, etc.  \n\nThis requirement can be achieved through multiple methods which will depend upon system architecture and design. Some commonly employed methods include ensuring log files enjoy the proper file system permissions utilizing file system protections and limiting log data location. \n\nAdditionally, applications with user interfaces to audit records should not allow for the unfettered manipulation of or access to those records via the application. If the application provides access to the audit data, the application becomes accountable for ensuring that audit information is protected from unauthorized access. SQL Server is an application that is able to view and manipulate audit file data. \n\nAudit information includes all information (e.g., audit records, audit settings, and audit reports) needed to successfully audit information system activity.\n\nSatisfies: SRG-APP-000118-DB-000059, SRG-APP-000119-DB-000060, SRG-APP-000120-DB-000061","checkContent":"If the database is setup to write audit logs using APPLICATION or SECURITY event logs rather than writing to a file, this is N/A.\n\nObtain the SQL Server audit file location(s) by running the following SQL script:  \n\nSELECT log_file_path AS \"Audit Path\"  \nFROM sys.server_file_audits  \n\nFor each audit, the path column will give the location of the file.  \n\nVerify 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.  \n\nRight-click the file/folder and click \"Properties\". On the \"Security\" tab, verify that at most the following permissions are applied:  \n\nAdministrator (read)  \nUsers (none)  \nAudit Administrator (Full Control)  \nAuditors group (Read)  \nSQL Server Service SID OR Service Account (Full Control)  \nSQL Server SQL Agent Service SID OR Service Account, if SQL Server Agent is in use. (Read, Execute, Write) \n\nIf any less restrictive permissions are present (and not specifically justified and approved), this is a finding.","fixText":"Modify audit file permissions to meet the requirement to protect against unauthorized access.  \n\nApplication event log and security log permissions are covered in the Windows Server STIGs. Be sure to reference these depending on the OS in use.\n\nNavigate to audit folder location(s) using a command prompt or Windows Explorer. Right-click the file and click \"Properties\".  \n\nOn the Security tab, modify the security permissions to:  \nAdministrator (read)  \nUsers (none)  \nAudit Administrator(Full Control)  \nAuditors group (Read)  \nSQL Server Service SID OR Service Account (Full Control) [Notes 1, 2]  \nSQL Server SQL Agent Service SID OR Service Account, if SQL Server Agent is in use. (Read, Execute, Write) [Notes 1, 2]  \n\n-----  \nNote 1: It is highly advisable to use a separate account for each service. When installing SQL Server in single-server mode, you can opt to have these provisioned for you. 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, see http://msdn.microsoft.com/en-us/library/ms143504(v=sql.130).aspx.  \n\nNote 2: Tips for adding a service SID/virtual account to a folder's permission list.  \n\n1) In Windows Explorer, right-click the folder and select \"Properties\".  \n2) Select the \"Security\" tab.  \n3) Click \"Edit\".  \n4) Click \"Add\".  \n5) Click \"Locations\".  \n6) Select the computer name.  \n7) Search for the name.  \n7.a) SQL Server Service  \n7.a.i) Type \"NT SERVICE\\MSSQL\" and click \"Check Names\". (What you have just typed in is the first 16 characters of the name. At least one character must follow \"NT SERVICE\\\"; you will be presented with a list of all matches. If you have typed in the full, correct name, step 7.a.ii is bypassed.)  \n7.a.ii) Select the \"MSSQL$\" user and click \"OK\".\n7.b) SQL Agent Service  \n7.b.i) Type \"NT SERVICE\\SQL\" and click \"Check Names\".  \n7.b.ii) Select the \"SQLAgent$\" user and click \"OK\". \n8) Click \"OK\".  \n9) Permission like a normal user from here.","ccis":["CCI-000162","CCI-000163","CCI-000164"]},{"vulnId":"V-213948","ruleId":"SV-213948r960942_rule","severity":"medium","ruleTitle":"SQL Server must protect its audit configuration from authorized and unauthorized access and modification.","description":"Protecting audit data also includes identifying and protecting the tools used to view and manipulate log data. Therefore, protecting audit tools is necessary to prevent unauthorized operation on audit data. \n \nApplications providing tools to interface with audit data will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys in order make access decisions regarding the modification of audit tools. SQL Server is an application that does provide access to audit data. \n \nAudit tools include, but are not limited to, vendor-provided and open source audit tools needed to successfully view and manipulate audit information system activity and records. Audit tools include custom queries and report generators.\n\nIf an attacker were to gain access to audit tools, they could analyze audit logs for system weaknesses or weaknesses in the auditing itself. An attacker could also manipulate logs to hide evidence of malicious activity.\n\nSatisfies: SRG-APP-000121-DB-000202, SRG-APP-000123-DB-000204","checkContent":"Check the server documentation for a list of approved users with access to SQL Server Audits.\n \nTo create, alter, or drop a server audit, principals require the ALTER ANY SERVER AUDIT or the CONTROL SERVER permission.\n \nReview the SQL Server permissions granted to principals. Look for permissions ALTER ANY SERVER AUDIT, ALTER ANY DATABASE AUDIT, CONTROL SERVER: \n \nSELECT login.name, perm.permission_name, perm.state_desc \nFROM sys.server_permissions perm \nJOIN sys.server_principals login \nON perm.grantee_principal_id = login.principal_id \nWHERE permission_name in ('ALTER ANY DATABASE AUDIT', 'ALTER ANY SERVER AUDIT', 'CONTROL SERVER') \nand login.name not like '##MS_%'; \n \nIf unauthorized accounts have these privileges, this is a finding.","fixText":"Remove audit-related permissions from individuals and roles not authorized to have them. \n \nUSE master;   \nDENY [ALTER ANY SERVER AUDIT] TO [User];   \nGO","ccis":["CCI-001494"]},{"vulnId":"V-213950","ruleId":"SV-213950r960960_rule","severity":"medium","ruleTitle":"SQL Server must limit privileges to change software modules and links to software external to SQL Server.","description":"If the system were to allow any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. \n \nAccordingly, only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. \n \nUnmanaged changes that occur to the database software libraries or configuration can lead to unauthorized or compromised installations.","checkContent":"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.  \n \nIf any unauthorized users are granted modify rights or the owner is incorrect, this is a finding. \n \nTo determine the location for these instance-specific binaries, Launch SQL Server Management Studio (SSMS) >> Connect to the instance to be reviewed >> Right-click server name in Object Explorer >> Click Facets >> Select the Server facet >> Record the value for the \"RootDirectory\" facet property. \n \nNavigate to the folder above, and review the \"Binn\" subdirectory.","fixText":"Change the ownership of all shared software libraries on disk to the authorized account. Remove any modify permissions granted to unauthorized users or groups.","ccis":["CCI-001499"]},{"vulnId":"V-213951","ruleId":"SV-213951r960960_rule","severity":"medium","ruleTitle":"SQL Server must limit privileges to change software modules, to include stored procedures, functions and triggers, and links to software external to SQL Server.","description":"If the system were to allow any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. \n \nAccordingly, only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. \n \nUnmanaged changes that occur to the database software libraries or configuration can lead to unauthorized or compromised installations.","checkContent":"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.\n\nIf alerts do not at least hash their value, this is a finding.\n\nTo determine the location for these instance-specific binaries:\n\nLaunch SQL Server Management Studio (SSMS) >> Connect to the instance to be reviewed >> Right-click server name in Object Explorer >> Click Facets >> Select the Server facet >> Record the value for the \"RootDirectory\" facet property\n\nTIP: Use the Get-FileHash cmdlet shipped with PowerShell 5.0 to get the SHA-2 hash of one or more files.","fixText":"Implement and document a process by which changes made to software libraries are monitored and alerted.\n\nA PowerShell based hashing solution is one such process. The Get-FileHash command (https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/get-filehash) can be used to compute the SHA-2 hash of one or more files.\n\nUsing the Export-Clixml command (https://msdn.microsoft.com/powershell/reference/5.1/microsoft.powershell.utility/Export-Clixml), a baseline can be established and exported to a file.\n\nUsing the Compare-Object command (https://technet.microsoft.com/en-us/library/ee156812.aspx), a comparison of the latest baseline versus the original baseline can be used to expose the differences.","ccis":["CCI-001499"]},{"vulnId":"V-213952","ruleId":"SV-213952r960960_rule","severity":"high","ruleTitle":"SQL Server software installation account must be restricted to authorized users.","description":"When dealing with change control issues, it should be noted any changes to the hardware, software, and/or firmware components of the information system and/or application can have significant effects on the overall security of the system. \n\nIf the system were to allow any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. Accordingly, only qualified and authorized individuals must be allowed access to information system components for purposes of initiating changes, including upgrades and modifications. \n\nDBA and other privileged administrative or application owner accounts are granted privileges that allow actions that can have a great impact on SQL Server security and operation. It is especially important to grant privileged access to only those persons who are qualified and authorized to use them.","checkContent":"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 2016 software and compare the list against those persons who are qualified and authorized to use the software. \n \nsl \"C:\\program files\\microsoft sql server\\130\\setup bootstrap\\Log\" \nGet-ChildItem -Recurse | Select-String -Pattern \"LogonUser = \" \n \nIf any accounts are shown that are not authorized in the system documentation, this is a finding.","fixText":"From a command prompt, open lusrmgr.msc. Navigate to Users and right-click Individual User. Select Properties >> Member Of. \n \nConfigure SQL Server and OS settings and access controls to restrict user access to objects and data that the user is authorized to view/use.","ccis":["CCI-001499"]},{"vulnId":"V-213953","ruleId":"SV-213953r960960_rule","severity":"medium","ruleTitle":"Database software, including DBMS configuration files, must be stored in dedicated directories, separate from the host OS and other applications.","description":"When dealing with change control issues, it should be noted any changes to the hardware, software, and/or firmware components of the information system and/or application can potentially have significant effects on the overall security of the system. \n \nMultiple applications can provide a cumulative negative effect. A vulnerability and subsequent exploit to one application can lead to an exploit of other applications sharing the same security context. For example, an exploit to a web server process that leads to unauthorized administrative access to host system directories can most likely lead to a compromise of all applications hosted by the same system. Database software not installed using dedicated directories both threatens and is threatened by other hosted applications. Access controls defined for one application may by default provide access to the other application's database objects or directories. Any method that provides any level of separation of security context assists in the protection between applications.","checkContent":"Determine the directory in which SQL Server has been installed:\n\nUsing SQL Server Management Studio's Object Explorer:\n- Right-click [SQL Server Instance]\n- Select \"Facets\"\n- Record the value of RootDirectory\n\nDetermine the Operating System directory:\n- Click \"Start\"\n- Type \"Run\"\n- Press \"Enter\"\n- Type \"%windir%\"\n- Click \"Ok\"\n- Record the value in the address bar\n\nVerify the SQL Server RootDirectory is not in the Operating System directory.\n\nCompare 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.\n\nVerify the SQL Server RootDirectory is not in another application's directory.\n\nNavigate to the SQL RootDirectory using Windows Explorer.\n\nExamine each directory for evidence another application is stored in it.\n\nIf evidence exists the SQL RootDirectory is in another application's directory, this is a finding.\n\nIf the SQL RootDirectory is not in the Operating System directory or another application's directory. This is not a finding.\n\nExamples:\n1) 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.\n\n2) The Operating System directory is \"C:\\Windows\". The SQL RootDirectory is \"C:\\Windows\\MSSQLSERVER\\MSSQL\". This is a finding.\n\n3) 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.","fixText":"Re-install SQL Server application components using dedicated directories that are separate from the operating system.  \n \nRelocate or reinstall other application software that currently shares directories with SQL Server components. \n \nSeparate from the operating system and/or temporary storage.","ccis":["CCI-001499"]},{"vulnId":"V-213954","ruleId":"SV-213954r960963_rule","severity":"medium","ruleTitle":"Default demonstration and sample databases, database objects, and applications must be removed.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n \nIt is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives. Examples include, but are not limited to, installing advertising software, demonstrations, or browser plugins not related to requirements or providing a wide array of functionality, not required for every mission, that cannot be disabled. \n \nDBMSs must adhere to the principles of least functionality by providing only essential capabilities. \n \nDemonstration and sample database objects and applications present publicly known attack points for malicious users. These demonstration and sample objects are meant to provide simple examples of coding specific functions and are not developed to prevent vulnerabilities from being introduced to SQL Server and host system.","checkContent":"Review the server documentation, if this system is identified as a development or test system, this check is Not Applicable. \n \nIf this system is identified as production, gather a listing of databases from the server and look for any matching the following general demonstration database names: \n \npubs \nNorthwind\nAdventureWorks \nWorldwideImporters \n \nIf any of these databases exist, this is a finding.","fixText":"Remove all demonstration or sample databases from production instances.","ccis":["CCI-000381"]},{"vulnId":"V-213955","ruleId":"SV-213955r960963_rule","severity":"medium","ruleTitle":"Unused database components, DBMS software, and database objects must be removed.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n \nIt is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives.  \n \nDBMSs must adhere to the principles of least functionality by providing only essential capabilities.","checkContent":"From the server documentation, obtain a listing of required components.  \n \nGenerate a listing of components installed on the server. \n \nClick Start >> Type \"SQL Server 2016 Installation Center\" >> Launch the program >> Click Tools >> Click \"Installed SQL Server features discovery report\" \n \nCompare the feature listing against the required components listing.  \n \nIf any features are installed, but are not required, this is a finding.","fixText":"Remove all features that are not required.","ccis":["CCI-000381"]},{"vulnId":"V-213956","ruleId":"SV-213956r960963_rule","severity":"medium","ruleTitle":"Unused database components that are integrated in SQL Server and cannot be uninstalled must be disabled.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions).  \n \nIt is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives.  \n \nDBMSs must adhere to the principles of least functionality by providing only essential capabilities. \n \nUnused, unnecessary DBMS components increase the attack vector for SQL Server by introducing additional targets for attack. By minimizing the services and applications installed on the system, the number of potential vulnerabilities is reduced. Components of the system that are unused and cannot be uninstalled must be disabled. The techniques available for disabling components will vary by DBMS product, OS, and the nature of the component and may include DBMS configuration settings, OS service settings, OS file access security, and DBMS user/role permissions.","checkContent":"From the server documentation, obtain a listing of required components. \n\nGenerate a listing of components installed on the server.\n\nClick Start >> Type \"SQL Server 2016 Installation Center\" >> Launch the program >> Click Tools >> Click \"Installed SQL Server features discovery report\"\n\nCompare the feature listing against the required components listing. Note any components that are installed, but not required.\n\nLaunch SQL Server Configuration Manager. \n\nIf any components that are installed but are not required are not disabled, this is a finding. \n\nIf any required components are not installed, this is a finding.","fixText":"Disable any unused components or features that cannot be uninstalled.","ccis":["CCI-000381"]},{"vulnId":"V-213957","ruleId":"SV-213957r960963_rule","severity":"medium","ruleTitle":"Access to xp_cmdshell must be disabled, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions).  \n \nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives.  \n \nApplications must adhere to the principles of least functionality by providing only essential capabilities. \n \nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system. \n \nThe xp_cmdshell extended stored procedure allows execution of host executables outside the controls of database access permissions. This access may be exploited by malicious users who have compromised the integrity of the SQL Server database process to control the host operating system to perpetrate additional malicious activity.","checkContent":"The xp_cmdshell extended stored procedure allows execution of host executables outside the controls of database access permissions. This access may be exploited by malicious users who have compromised the integrity of the SQL Server database process to control the host operating system to perpetrate additional malicious activity. \n \nTo determine if xp_cmdshell is enabled, execute the following commands:  \n \nEXEC SP_CONFIGURE 'show advanced options', '1';  \nRECONFIGURE WITH OVERRIDE;  \nEXEC SP_CONFIGURE 'xp_cmdshell';  \n \nIf the value of \"config_value\" is \"0\", this is not a finding.  \n \nReview the system documentation to determine whether the use of \"xp_cmdshell\" is required and approved. If it is not approved, this is a finding.","fixText":"Disable use of or remove any external application executable object definitions that are not authorized.\n\nTo disable the use of xp_cmdshell, from the query prompt: \n\nEXEC sp_configure 'show advanced options', 1; \nGO \nRECONFIGURE; \nGO \nEXEC sp_configure 'xp_cmdshell', 0; \nGO \nRECONFIGURE; \nGO??","ccis":["CCI-000381"]},{"vulnId":"V-213958","ruleId":"SV-213958r960963_rule","severity":"medium","ruleTitle":"Access to CLR code must be disabled or restricted, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions).  \n \nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives.  \n \nApplications must adhere to the principles of least functionality by providing only essential capabilities. \n \nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system. \n \nThe common language runtime (CLR) component of the .NET Framework for Microsoft Windows in SQL Server allows you to write stored procedures, triggers, user-defined types, user-defined functions, user-defined aggregates, and streaming table-valued functions, using any .NET Framework language, including Microsoft Visual Basic .NET and Microsoft Visual C#.  CLR packing assemblies can access resources protected by .NET Code Access Security when it runs managed code.  Specifying UNSAFE enables the code in the assembly complete freedom to perform operations in the SQL Server process space that can potentially compromise the robustness of SQL Server. UNSAFE assemblies can also potentially subvert the security system of either SQL Server or the common language runtime.","checkContent":"The common language runtime (CLR) component of the .NET Framework for Microsoft Windows in SQL Server allows you to write stored procedures, triggers, user-defined types, user-defined functions, user-defined aggregates, and streaming table-valued functions, using any .NET Framework language, including Microsoft Visual Basic .NET and Microsoft Visual C#. CLR packing assemblies can access resources protected by .NET Code Access Security when it runs managed code. Specifying UNSAFE enables the code in the assembly complete freedom to perform operations in the SQL Server process space that can potentially compromise the robustness of SQL Server. UNSAFE assemblies can also potentially subvert the security system of either SQL Server or the common language runtime.  \n\nTo determine if CLR is enabled, execute the following commands:  \n\nEXEC SP_CONFIGURE 'show advanced options', '1';  \nRECONFIGURE WITH OVERRIDE;  \nEXEC SP_CONFIGURE 'clr enabled';  \n\nIf the value of \"config_value\" is \"0\", this is not a finding.  \n\nIf the value of \"config_value\" is \"1\", review the system documentation to determine whether the use of CLR code is approved. If it is not approved, this is a finding. \n\nIf CLR code is approved, check the database for UNSAFE assembly permission using the following script: \n\nUSE [master]\nSELECT *  \nFROM sys.assemblies \nWHERE permission_set_desc != 'SAFE' \nAND is_user_defined = 1;\n\nIf any records are returned, review the system documentation to determine if the use of UNSAFE assemblies is approved. If it is not approved, this is a finding.","fixText":"Disable use of or remove any CLR code that is not authorized. \n \nTo disable the use of CLR, from the query prompt:  \n \nsp_configure 'show advanced options', 1; \nGO \nRECONFIGURE; \nGO \nsp_configure 'clr enabled', 0; \nGO \nRECONFIGURE; \nGO \n \nFor 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.","ccis":["CCI-000381"]},{"vulnId":"V-213959","ruleId":"SV-213959r960963_rule","severity":"medium","ruleTitle":"Access to Non-Standard extended stored procedures must be disabled or restricted, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions).  \n \nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives.  \n \nApplications must adhere to the principles of least functionality by providing only essential capabilities. \n \nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system. \n \nExtended 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.  Non-Standard extended stored procedures can compromise the integrity of the SQL Server process.  This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible.","checkContent":"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.   \n \nNon-Standard extended stored procedures can compromise the integrity of the SQL Server process.  This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible.  \n \nTo determine if non-standard extended stored procedures exist, run the following:\n\n------------------------------------------------------------------------\nUSE [master]\nGO\nDECLARE @xplist AS TABLE\n(\n       xp_name sysname,\n       source_dll nvarchar(255)\n)\nINSERT INTO @xplist\nEXEC sp_helpextendedproc\n\nSELECT 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\n------------------------------------------------------------------------\n \nIf any records are returned, review the system documentation to determine whether the use of Non-Standard extended stored procedures are required and approved.\n\nIf it is not approved, this is a finding.","fixText":"Remove any Non-Standard extended stored procedures that are not documented and approved. \n \nsp_dropextendedproc 'proc name'","ccis":["CCI-000381"]},{"vulnId":"V-213960","ruleId":"SV-213960r1018585_rule","severity":"medium","ruleTitle":"Access to linked servers must be disabled or restricted, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). It is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. Applications must adhere to the principles of least functionality by providing only essential capabilities. SQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system. 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.  This access may be exploited by malicious users who have compromised the integrity of the SQL Server.","checkContent":"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.\n \nTo obtain a list of linked servers, execute the following command:\n \nSELECT name\nFROM sys.servers s \nWHERE s.is_linked = 1 \n \nReview the system documentation to determine whether the linked servers listed are required and approved. If it is not approved, this is a finding. \n \nRun the following to get a linked server login mapping: \n \nSELECT s.name, p.principal_id, l.remote_name \nFROM sys.servers s \nJOIN sys.linked_logins l ON s.server_id = l.server_id \nLEFT JOIN sys.server_principals p ON l.local_principal_id = p.principal_id \nWHERE s.is_linked = 1 \n \nReview 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.","fixText":"Disable use of or remove any linked servers that are not authorized.  \n \nTo remove a linked server and all associated logins run the following: \n \nsp_dropserver 'LinkedServerName', 'droplogins'; \n \nTo remove a login from a linked server run the following: \n \nEXEC sp_droplinkedsrvlogin 'LoginName', NULL;","ccis":["CCI-000381"]},{"vulnId":"V-213961","ruleId":"SV-213961r1167480_rule","severity":"medium","ruleTitle":"SQL Server must be configured to prohibit or restrict the use of organization-defined protocols as defined in the Ports, Protocols, and Services Management (PPSM) Category Assurance List (CAL) and vulnerability assessments.","description":"To prevent unauthorized connection of devices, unauthorized transfer of information, or unauthorized tunneling (i.e., embedding of data types within data types), organizations must disable or restrict unused or unnecessary protocols on information systems. \n \nApplications are capable of providing a wide variety of functions and services. Some of the functions and services provided by default may not be necessary to support essential organizational operations. Additionally, it is sometimes convenient to provide multiple services from a single component (e.g., email and web services); however, doing so increases risk over limiting the services provided by any one component.  \n \nTo support the requirements and principles of least functionality, the application must support the organizational requirements providing only essential capabilities and limiting the use of protocols to only those required, authorized, and approved to conduct official business or to address authorized quality of life issues. \n \nSQL Server using protocols deemed unsafe is open to attack through those protocols. This can allow unauthorized access to the database and through the database to other components of the information system.\n\nSatisfies: SRG-APP-000142-DB-000094, SRG-APP-000383-DB-000364","checkContent":"To determine the protocol(s) enabled for SQL Server, open SQL Server Configuration Manager. In the left-hand pane, expand SQL Server Network Configuration. Click the entry for the SQL Server instance under review: \"Protocols for \". The right-hand pane displays the protocols enabled for the instance.  \n \nIf Named Pipes is enabled and not specifically required and authorized, this is a finding. \n \nIf any listed protocol is enabled but not authorized, this is a finding.","fixText":"In SQL Server Configuration Manager >> SQL Server Network Configuration >> Protocols, right-click each listed protocol that is enabled but not authorized and Select \"Disable\".","ccis":["CCI-000382"]},{"vulnId":"V-213964","ruleId":"SV-213964r1112499_rule","severity":"high","ruleTitle":"If DBMS authentication using passwords is employed, SQL Server must enforce the DOD standards for password complexity and lifetime.","description":"Windows Authentication is the default authentication mode and is much more secure than SQL Server Authentication. Windows Authentication uses Kerberos security protocol, provides password policy enforcement with regard to complexity validation for strong passwords, provides support for account lockout, and supports password expiration. A connection made using Windows Authentication is sometimes called a trusted connection, because SQL Server trusts the credentials provided by Windows.\n\nBy using Windows Authentication, Windows groups can be created at the domain level, and a login can be created on SQL Server for the entire group. Managing access at the domain level can simplify account administration.\n\nOS/enterprise authentication and identification must be used (SRG-APP-000023-DB-000001). Native SQL Server authentication may be used only when circumstances make it unavoidable and must be documented and Authorizing Official (AO)-approved. \n \nThe DOD standard for authentication is DOD-approved PKI certificates. Authentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate and requires AO approval. \n \nIn such cases, the DOD standards for password complexity and lifetime must be implemented. DBMS products that can inherit the rules for these from the operating system or access control program (e.g., Microsoft Active Directory) must be configured to do so. For other DBMSs, the rules must be enforced using available configuration parameters or custom code.","checkContent":"Check for use of SQL Server Authentication:\n\nSELECT CASE SERVERPROPERTY('IsIntegratedSecurityOnly') WHEN 1 THEN 'Windows Authentication' WHEN 0 THEN 'SQL Server Authentication' END as [Authentication Mode]\n\nIf the returned value in the \"Authentication Mode\" column is \"Windows Authentication\", this is not a finding.\n\nIf the returned value in the \"Authentication Mode\" column is \"SQL Server Authentication\", SQL Server should be configured to inherit password complexity and password lifetime rules from the operating system.\n\nReview SQL Server to ensure logons are created with respect to the complexity settings and password lifetime rules by running the statement:\n\nSELECT [name], is_expiration_checked, is_policy_checked\nFROM sys.sql_logins\n\nReview any accounts returned by the query other than the disabled SA account, ##MS_PolicyTsqlExecutionLogin##, ##MS_PolicyEventProcessingLogin##, ##MS_SSISServerCleanupJobLogin##, and other internal accounts that start with ##MS.\n\nIf any account does not have both \"is_expiration_checked\" and \"is_policy_checked\" equal to “1”, this is a finding.\n\nReview the operating system settings relating to password complexity.\n\nTo check the server operating system for password complexity:\n\nNavigate to Start >> All Programs >> Administrative Tools >> Local Security Policy, and to review the local policies on the machine, go to Account Policy >> Password Policy.\n\nEnsure the DISA Windows Password Policy is set on the SQL Server member server. If any are not, this is a finding.","fixText":"Configure the SQL Server operating system and SQL Server logins for compliance. \n\nReview the Operating System settings relating to password complexity.\n\nEnsure SQL Server is configured to inherit password complexity rules from the operating system for SQL logins. Ensure check of policy and expiration are enforced when SQL logins are created. \n\nCREATE LOGIN <login_name> WITH PASSWORD= <enterStrongPasswordHere>, CHECK_EXPIRATION = ON, CHECK_POLICY = ON;","ccis":["CCI-004066","CCI-000192"]},{"vulnId":"V-213965","ruleId":"SV-213965r1018610_rule","severity":"medium","ruleTitle":"Contained databases must use Windows principals.","description":"OS/enterprise authentication and identification must be used (SRG-APP-000023-DB-000001). Native DBMS authentication may be used only when circumstances make it unavoidable, and must be documented and Authorizing Official (AO)-approved.\n \nThe DOD standard for authentication is DOD-approved PKI certificates. Authentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate, and requires AO approval.\n \nIn such cases, the DOD standards for password complexity and lifetime must be implemented. DBMS products that can inherit the rules for these from the operating system or access control program (e.g., Microsoft Active Directory) must be configured to do so. For other DBMSs, the rules must be enforced using available configuration parameters or custom code.","checkContent":"Execute the following query to determine if contained databases are used: \n \nSELECT * FROM sys.databases WHERE containment = 1 \n \nIf any records are returned. Check the server documentation for a list of authorized contained database users. Ensure contained database users are not using SQL Authentication. \n \nEXEC sp_MSforeachdb 'USE [?]; SELECT DB_NAME() AS DatabaseName, * FROM sys.database_principals WHERE authentication_type = 2' \n \nIf any records are returned, this is a finding.","fixText":"Configure the SQL Server contained databases to have users originating from Windows principals. Remove any users not created from Windows principals.","ccis":["CCI-004066","CCI-000192"]},{"vulnId":"V-213966","ruleId":"SV-213966r1051304_rule","severity":"high","ruleTitle":"If passwords are used for authentication, SQL Server must transmit only encrypted representations of passwords.","description":"The DOD standard for authentication is DOD-approved PKI certificates. \n \nAuthentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate and requires AO approval. \n \nIn such cases, passwords need to be protected at all times, and encryption is the standard method for protecting passwords during transmission. \n \nSQL Server passwords sent in clear text format across the network are vulnerable to discovery by unauthorized users. Disclosure of passwords may easily lead to unauthorized access to the database.","checkContent":"1. Launch SSMS and connect to the SQL Server to be reviewed.\n\n2. Right-click the instance and select \"Properties\".\n\n3. Navigate to the \"Security\" tab.\n\nIf the value for \"Server authentication\" is \"Windows Authentication mode\", this requirement is Not Applicable.\n\nFrom a command prompt, open SQL Server Configuration Manager by typing \"sqlservermanager13.msc\" and pressing \"Enter\".\n\nNavigate 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\". \n\nOn the \"Flags\" tab, if \"Force Encryption\" is set to “NO\", this is a finding.\n\nOn the \"Flags\" tab, if \"Force Encryption\" is set to \"YES\", examine the certificate used on the \"Certificate\" tab.\n\nIf it is not a DOD approved certificate, or if no certificate is listed, this is a finding.\n\nFor clustered instances, the Certificate will NOT be shown in the SQL Server Configuration Manager.\n\n1. From a command prompt, navigate to the certificate store where the Full Qualified Domain Name (FQDN) certificate is stored by typing \"certlm.msc\" and pressing \"Enter\".\n\n2. In the left side of the window, expand the \"Personal\" folder, and click \"Certificates\".\n\n3. Verify that 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.\n\n4. Verify 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\".\n\n5. Run this on each node of the cluster.\n\nIf any nodes have a certificate in use by SQL that is not issued or approved by DOD, this is a finding.","fixText":"Configure SQL Server to encrypt authentication data for remote connections using DOD-approved cryptography.\n\nDeploy encryption to the SQL Server Network Connections.\n\nFrom a command prompt, open SQL Server Configuration Manager by typing \"sqlservermanager13.msc\" and pressing \"ENTER\".\n\nNavigate to SQL Server Configuration Manager >> SQL Server Network Configuration. Right-click on Protocols for, where is a placeholder for the SQL Server instance name, and click on \"Properties\".\n\nIn 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. Restart the SQL Server service.\n\nFor clustered instances, install the certificate after setting \"Force Encryption\" to \"Yes\" in SQL Server Configuration Manager.\n\n1. Navigate to the certificate store where the FQDN certificate is stored by typing \"certlm.msc\" and pressing \"ENTER\".\n\n2. On the \"Properties\" page for the certificate, go to the \"Details\" tab and copy the \"thumbprint\" value of the certificate to a \"Notepad\" window.\n\n3. Remove the spaces between the hex characters in the \"thumbprint\" value in Notepad.\n\n4. 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\n\n5. 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.\n\n6. Repeat this procedure on all the nodes.","ccis":["CCI-000197"]},{"vulnId":"V-213967","ruleId":"SV-213967r961029_rule","severity":"high","ruleTitle":"Confidentiality of information during transmission is controlled through the use of an approved TLS version.","description":"Transport Layer Security (TLS) encryption is a required security setting as a number of known vulnerabilities have been reported against Secure Sockets Layer (SSL) and earlier versions of TLS. Encryption of private information is essential to ensuring data confidentiality. If private information is not encrypted, it can be intercepted and easily read by an unauthorized party. SQL Server must use a FIPS-approved minimum TLS version 1.2, and all non-FIPS-approved SSL and TLS versions must be disabled. NIST SP 800-52 Rev.2 specifies the preferred configurations for government systems.\n\nReferences:\nTLS Support 1.2 for SQL Server: https://support.microsoft.com/en-us/kb/3135244 \nTLS Registry Settings:  https://docs.microsoft.com/en-us/windows-server/security/tls/tls-registry-settings","checkContent":"Access the SQL Server.\nAccess an administrator command prompt.\nType \"regedit\" to launch the Registry Editor.\n \nNavigate to:\nHKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols\\TLS 1.2\n\nIf this key does not exist, this is a finding.\n\nVerify a REG_DWORD value of \"0\" for \"DisabledByDefault\" and a value of \"1\" for \"Enabled\" for both Client and Server.\n \nNavigate to:\nHKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols\\TLS 1.0\nHKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols\\TLS 1.1\nHKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols\\SSL 2.0\nHKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols\\SSL 3.0\n\nUnder each key, verify a REG_DWORD value of \"1\" for \"DisabledByDefault\" and a value of \"0\" for \"Enabled\" for both Client and Server subkeys.\n \nIf 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 3.","fixText":"Important Note: Incorrectly modifying the Windows Registry can result in serious system errors. Before making any modifications, ensure you have a recent backup of the system and registry settings.\n\nAccess the SQL Server.\nAccess an administrator command prompt. \nType \"regedit\" to launch the Registry Editor.\n \nEnable TLS 1.2:\n  \n1.Navigate to the path HKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols.\n   a.If the \"TLS 1.2\" key does not exist, right-click \"Protocols\".\n   b.Click \"New\".\n   c.Click \"Key\".\n   d.Type the name \"TLS 1.2\".\n\n2.Navigate to the \"TLS 1.2\" subkey.\n   a.If the subkey \"Client\" does not exist, right-click \"TLS 1.2\"\n   b.Click \"New\".\n   c.Click \"Key\".\n   d.Type the name \"Client\".\n   e.Repeat steps A – D for the \"Server\" subkey.\n\n3.Navigate to the \"Client\" subkey.\n   a.If the value \"Enabled\" does not exist, right-click on \"Client\".\n   b.Click \"New\".\n   c.Click \"DWORD\".\n   d.Enter \"Enabled\" as the name.\n   e.Repeat steps A-D for the value \"DisabledByDefault\".\n\n4.Double-click \"Enabled\".\n\n5.In Value Data, enter \"1\".\n\n6.Click \"OK\".\n\n7.Double-click \"DisabledByDefault\".\n\n8.In Value Data, enter \"0\".\n\n9.Click \"OK\".\n\n10.Repeat steps 3 – 9 for the \"Server\" subkey.\n \n\nDisable unwanted SSL/TLS protocol versions:\n\n1.Navigate to the path HKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols.\n   a.If the \"TLS 1.0\" key does not exist, right-click \"Protocols\".\n   b.Click \"New\".\n   c.Click \"Key\".\n   d.Type the name \"TLS 1.0\".\n\n2.Navigate to the \"TLS 1.0\" subkey.\n   a.If the subkey \"Client\" does not exist, right-click \"TLS 1.0\".\n   b.Click \"New\".\n   c.Click \"Key\".\n   d.Type the name \"Client\".\n   e.Repeat steps A – D for the \"Server\" subkey.\n\n3.Navigate to the \"Client\" subkey.\n   a.If the value \"Enabled\" does not exist, right-click on \"Client\".\n   b.Click \"New\".\n   c.Click \"DWORD\".\n   d.Enter \"Enabled\" as the name.\n   e.Repeat steps A-D for the value \"DisabledByDefault\".\n\n4.Double-click \"Enabled\".\n\n5.In Value Data, enter \"0\".\n\n6.Click \"OK\".\n\n7.Double-click \"DisabledByDefault\".\n\n8.In Value Data, enter \"1\".\n\n9.Click \"OK\".\n\n10.Repeat steps 3 – 9 for the \"Server\" subkey.\n\n11.Repeat steps 1 – 10 for \"TLS 1.1\", \"SSL 2.0\", and \"SSL 3.0\".","ccis":["CCI-000197"]},{"vulnId":"V-213968","ruleId":"SV-213968r961041_rule","severity":"high","ruleTitle":"SQL Server must enforce authorized access to all PKI private keys stored/utilized by SQL Server.","description":"The DoD standard for authentication is DoD-approved PKI certificates. PKI certificate-based authentication is performed by requiring the certificate holder to cryptographically prove possession of the corresponding private key. \n \nIf the private key is stolen, an attacker can use the private key(s) to impersonate the certificate holder. In cases where SQL Server-stored private keys are used to authenticate SQL Server to the system’s clients, loss of the corresponding private keys would allow an attacker to successfully perform undetected man in the middle attacks against SQL Server system and its clients. \n \nBoth the holder of a digital certificate and the issuing authority must take careful measures to protect the corresponding private key. Private keys should always be generated and protected in FIPS 140-2 or FIPS 140-3 validated cryptographic modules. \n \nAll access to the private key(s) of SQL Server must be restricted to authorized and authenticated users. If unauthorized users have access to one or more of SQL Server's private keys, an attacker could gain access to the key(s) and use them to impersonate the database on the network or otherwise perform unauthorized actions.","checkContent":"Review system configuration to determine whether FIPS compliant support has been enabled. \n \nStart >> Control Panel >> Administrative Tools >> Local Security Policy >> Local Policies >> Security Options\n \nEnsure that \"System cryptography: Use FIPS-compliant algorithms for encryption, hashing, and signing\" is enabled. \n\nIf \"System cryptography: Use FIPS-compliant algorithms for encryption, hashing, and signing\" is not enabled, this is a finding. \n \nFor more information, see https://support.microsoft.com/en-us/kb/3141890.","fixText":"Enable use of FIPS-compliant algorithms. \n \nStart >> Control Panel >> Administrative Tools >> Local Security Policy >> Local Policies >> Security Options \n \nDouble-click \"System cryptography: Use FIPS-compliant algorithms for encryption, hashing, and signing.\" \n \nClick Enabled >> Apply.","ccis":["CCI-000186"]},{"vulnId":"V-213969","ruleId":"SV-213969r1167483_rule","severity":"high","ruleTitle":"SQL Server must use NIST FIPS 140-2/140-3-validated cryptographic operations for encryption, hashing, and signing.","description":"Use of weak or not validated cryptographic algorithms undermines the purposes of utilizing encryption and digital signatures to protect data. Weak algorithms can be easily broken, and not validated cryptographic modules may not implement algorithms correctly. Unapproved cryptographic modules or algorithms should not be relied on for authentication, confidentiality, or integrity. Weak cryptography could allow an attacker to gain access to, and modify data stored in, the database as well as the administration settings of SQL Server. \n \nApplications, including DBMSs, utilizing cryptography are required to use approved NIST FIPS 140-2/140-3 validated cryptographic modules that meet the requirements of applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance.   \n \nNSA Type- (where =1, 2, 3, 4) products are NSA-certified, hardware-based encryption modules.\n\nThe standard for validating cryptographic modules will transition to the NIST FIPS 140-3 publication.\n\nFIPS 140-2 modules can remain active for up to five years after validation or until September 21, 2026, when the FIPS 140-2 validations will be moved to the historical list. Even on the historical list, CMVP supports the purchase and use of these modules for existing systems. While federal agencies decide when they move to FIPS 140-3 only modules, purchasers are reminded that for several years there may be a limited selection of FIPS 140-3 modules from which to choose. CMVP recommends purchasers consider all modules that appear on the Validated Modules Search Page:\nhttps://csrc.nist.gov/projects/cryptographic-module-validation-program/validated-modules\n\nMore information on the FIPS 140-3 transition can be found here: \nhttps://csrc.nist.gov/Projects/fips-140-3-transition-effort/\n\nSatisfies: SRG-APP-000179-DB-000114, SRG-APP-000176-DB-000068, SRG-APP-000224-DB-000384, SRG-APP-000514-DB-000381, SRG-APP-000514-DB-000382, SRG-APP-000514-DB-000383","checkContent":"In Windows, open Administrative Tools >> Local Security Policy. \nExpand Local Policies >> Security Options. \nIn the right-side pane, find \"System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing\".  \n \nIf, in the \"Security Setting\" column, the value is \"Disabled,\" this is a finding. \n \nhttps://support.microsoft.com/en-us/kb/955720","fixText":"In Windows, open Administrative Tools >> Local Security Policy. Expand Local Policies >> Security Options. In the right-side pane, double-click \"System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing\".\n \nIn the dialog box that appears, if the radio buttons are active, click \"Enabled\", and then click \"Apply\". If the radio buttons are grayed out, use Group Policy Management (on the appropriate server for this domain) to enforce the Enabled policy, and deploy it to the server(s) running SQL Server.","ccis":["CCI-000803"]},{"vulnId":"V-213970","ruleId":"SV-213970r961053_rule","severity":"medium","ruleTitle":"SQL Server must uniquely identify and authenticate non-organizational users (or processes acting on behalf of non-organizational users).","description":"Non-organizational users include all information system users other than organizational users, which include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors, guest researchers, individuals from allied nations). \n \nNon-organizational users must be uniquely identified and authenticated for all accesses other than those accesses explicitly identified and documented by the organization when related to the use of anonymous access, such as accessing a web server. \n \nAccordingly, a risk assessment is used in determining the authentication needs of the organization. \n \nScalability, practicality, and security are simultaneously considered in balancing the need to ensure ease of use for access to federal information and information systems with the need to protect and adequately mitigate risk to organizational operations, organizational assets, individuals, other organizations, and the Nation.","checkContent":"Review documentation, SQL Server settings, and authentication system settings to determine if non-organizational users are individually identified and authenticated when logging onto the system.  \n \nExecute the following query to obtain a list of logins on the SQL Server and ensure all accounts are uniquely identifiable: \n \nSELECT name, type_desc FROM sys.server_principals WHERE type in ('S','U') \n \nIf accounts are determined to be shared, determine if individuals are first individually authenticated. Where an application connects to SQL Server using a standard, shared account, ensure that it also captures the individual user identification and passes it to SQL Server. \n \nIf the documentation indicates that this is a public-facing, read-only (from the point of view of public users) database that does not require individual authentication, this is not a finding.  \n \nIf non-organizational users are not uniquely identified and authenticated, this is a finding.","fixText":"Ensure all logins are uniquely identifiable and authenticate all non-organizational users who log onto the system. This likely would be done via a combination of the operating system with unique accounts and the SQL Server by ensuring mapping to individual accounts. Verify server documentation to ensure accounts are documented and unique.","ccis":["CCI-000804"]},{"vulnId":"V-213972","ruleId":"SV-213972r961128_rule","severity":"high","ruleTitle":"SQL Server must protect the confidentiality and integrity of all information at rest.","description":"This control is intended to address the confidentiality and integrity of information at rest in non-mobile devices and covers user information and system information. Information at rest refers to the state of information when it is located on a secondary storage device (e.g., disk drive, tape drive) within an organizational information system. Applications and application users generate information throughout the course of their application use.  \n \nUser data generated, as well as application-specific configuration data, needs to be protected. Organizations may choose to employ different mechanisms to achieve confidentiality and integrity protections, as appropriate.  \n \nIf the confidentiality and integrity of SQL Server data is not protected, the data will be open to compromise and unauthorized modification.","checkContent":"Review system documentation to determine whether the system handles classified information. If the system does not handle classified information, the severity of this check should be downgraded to Category II.  \n \nIf the application owner and Authorizing Official have determined that encryption of data at rest is required, ensure the data on secondary devices is encrypted.  \n \nIf full-disk encryption is being used, this is not a finding.  \n \nIf data encryption is required, ensure the data is encrypted before being put on the secondary device by executing:  \n \nSELECT  \nd.name AS [Database Name],  \nCASE e.encryption_state  \nWHEN 0 THEN 'No database encryption key present, no encryption'  \nWHEN 1 THEN 'Unencrypted'  \nWHEN 2 THEN 'Encryption in progress'  \nWHEN 3 THEN 'Encrypted'  \nWHEN 4 THEN 'Key change in progress'  \nWHEN 5 THEN 'Decryption in progress'  \nWHEN 6 THEN 'Protection change in progress'  \nEND AS [Encryption State]  \nFROM sys.dm_database_encryption_keys e  \nRIGHT JOIN sys.databases d ON DB_NAME(e.database_id) = d.name  \nWHERE d.name NOT IN ('master','model','msdb')  \nORDER BY [Database Name] ;  \n \nFor each user database where encryption is required, verify that encryption is in effect. If not, this is a finding. \n \nVerify 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.","fixText":"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. \n\nTo enable database encryption, create a master key, create a database encryption key, and protect it by using mechanisms tied to the master key, and then set encryption on.\n\nImplement physical security measures, operating system access control lists and organizational controls appropriate to the sensitivity level of the data in the database(s).","ccis":["CCI-001199"]},{"vulnId":"V-213973","ruleId":"SV-213973r961128_rule","severity":"medium","ruleTitle":"The Service Master Key must be backed up and stored in a secure location that is not on the SQL Server.","description":"Backup and recovery of the Service Master Key may be critical to the complete recovery of the database. Creating this backup should be one of the first administrative actions performed on the server. Not having this key can lead to loss of data during recovery.","checkContent":"Review procedures for and evidence of backup of the Server Service Master Key in the System Security Plan.  \n \nIf the procedures or evidence does not exist, this is a finding.\n \nIf 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. \n\nIf procedures do not indicate access restrictions to the Service Master Key backup, this is a finding.","fixText":"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. Include in the procedures methods to establish evidence of backup and storage, and careful, restricted access and restoration of the Service Master Key.\n \nBACKUP SERVICE MASTER KEY TO FILE = 'path_to_file'  \nENCRYPTION BY PASSWORD = 'password';  \n \nAs this requires a password, take care to ensure it is not exposed to unauthorized persons or stored as plain text.","ccis":["CCI-001199"]},{"vulnId":"V-213974","ruleId":"SV-213974r961128_rule","severity":"medium","ruleTitle":"The Master Key must be backed up and stored in a secure location that is not on the SQL Server.","description":"Backup and recovery of the Master Key may be critical to the complete recovery of the database. Not having this key can lead to loss of data during recovery.","checkContent":"If the application owner and authorizing official have determined that encryption of data at rest is not required, this is not a finding. \n \nReview procedures for and evidence of backup of the Master Key in the System Security Plan.  \n \nIf the procedures or evidence does not exist, this is a finding.  \n \nIf 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.\n\nIf procedures do not indicate access restrictions to the Master Key backup, this is a finding.","fixText":"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.\n\nBACKUP MASTER KEY TO FILE = 'path_to_file'  \nENCRYPTION BY PASSWORD = 'password';  \n \nAs this requires a password, take care to ensure it is not exposed to unauthorized persons or stored as plain text.","ccis":["CCI-001199"]},{"vulnId":"V-213975","ruleId":"SV-213975r1137657_rule","severity":"medium","ruleTitle":"SQL Server must prevent unauthorized and unintended information transfer via shared system resources.","description":"The purpose of this control is to prevent information, including encrypted representations of information, produced by the actions of a prior user/role (or the actions of a process acting on behalf of a prior user/role) from being available to any current user/role (or current process) that obtains access to a shared system resource (e.g., registers, main memory, secondary storage) after the resource has been released back to the information system. Control of information in shared resources is also referred to as object reuse.","checkContent":"Review system documentation to determine if Common Criteria Compliance is not required due to potential impact on system performance. \n\nSQL 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. \n\nReview the Instance configuration: \n\n\nSELECT value_in_use\nFROM sys.configurations\nWHERE name = 'common criteria compliance enabled'\n\nIf \"value_in_use\" is set to \"1\" this is not a finding.\nIf \"value_in_use\" is set to \"0\" this is a finding. \n\nNOTE: Enabling this feature may impact performance on highly active SQL Server instances. If an exception justifying setting SQL Server Residual Information Protection (RIP) to disabled (value_in_use set to \"0\") has been documented and approved, then this may be downgraded to a CAT III finding.","fixText":"Configure SQL Server to effectively protect the private resources of one process or user from unauthorized access by another user or process. \n \nsp_configure 'show advanced options', 1;   \nGO   \nRECONFIGURE;   \nGO   \nsp_configure 'common criteria compliance enabled', 1;   \nGO   \nRECONFIGURE   \nGO","ccis":["CCI-001090"]},{"vulnId":"V-213976","ruleId":"SV-213976r1137657_rule","severity":"medium","ruleTitle":"SQL Server must prevent unauthorized and unintended information transfer via Instant File Initialization (IFI).","description":"The purpose of this control is to prevent information, including encrypted representations of information, produced by the actions of a prior user/role (or the actions of a process acting on behalf of a prior user/role) from being available to any current user/role (or current process) that obtains access to a shared system resource (e.g., registers, main memory, secondary storage) after the resource has been released back to the information system. Control of information in shared resources is also referred to as object reuse.\n\nWhen Instant File Initialization (IFI) is in use, the deleted disk content is overwritten only as new data is written to the files. For this reason, the deleted content might be accessed by an unauthorized principal until some other data writes on that specific area of the data file.","checkContent":"Review system configuration to determine whether IFI support has been enabled (by default in SQL Server 2016).\n\nStart >> Control Panel >> System and Security >> Administrative Tools >> Local Security Policy >> Local Policies >> User Rights Assignment >> Perform volume maintenance tasks\n\nThe default SQL service account for a default instance is NT SERVICE\\MSSQLSERVER or for a named instance is NT SERVICE\\MSSQL$InstanceName.\n\nIf the SQL service account or SQL service SID has been granted \"Perform volume maintenance tasks\" Local Rights Assignment, this means that Instant File Initialization (IFI) is enabled.\n\nReview the system documentation to determine if Instant File Initialization (IFI) is required.\n\nIf IFI is enabled but not documented as required, this is a finding.\n\nIf IFI is not enabled, this is not a finding.","fixText":"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.","ccis":["CCI-001090"]},{"vulnId":"V-213977","ruleId":"SV-213977r1137658_rule","severity":"medium","ruleTitle":"Access to database files must be limited to relevant processes and to authorized, administrative users.","description":"SQL Server must prevent unauthorized and unintended information transfer via shared system resources. Permitting only SQL Server processes and authorized, administrative users to have access to the files where the database resides helps ensure that those files are not shared inappropriately and are not open to backdoor access and manipulation.","checkContent":"Review the permissions granted to users by the operating system/file system on the database files, database log files, and database backup files. \n\nTo 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\".\n\nFor each of the directories returned by the above script, verify whether the correct permissions have been applied.\n\n1) Launch Windows Explorer.\n2) Navigate to the folder.\n3) Right-click the folder and click \"Properties\".\n4) Navigate to the \"Security\" tab.\n5) Review the listing of principals and permissions.\n\nAccount Type\t\t\tDirectory Type\t\tPermission\n-----------------------------------------------------------------------------------------------\nDatabase Administrators      \tALL                   \t\tFull Control\nSQL Server Service SID       \tData; Log; Backup;    \tFull Control\nSQL Server Agent Service SID \tBackup                \tFull Control\nSYSTEM                       \t\tALL                   \t\tFull Control\nCREATOR OWNER                \tALL                   \t\tFull Control\n\nFor information on how to determine a \"Service SID\", go to:\nhttps://aka.ms/sql-service-sids\n\nAdditional permission requirements, including full directory permissions and operating system rights for SQL Server, are documented at:\nhttps://aka.ms/sqlservicepermissions\n\nIf any additional permissions are granted but not documented as authorized, this is a finding.","fixText":"Remove any unauthorized permission grants from SQL Server data, log, and backup directories.\n\n1) On the \"Security\" tab, highlight the user entry.\n2) Click \"Remove\".","ccis":["CCI-001090"]},{"vulnId":"V-213978","ruleId":"SV-213978r1067807_rule","severity":"medium","ruleTitle":"SQL Server must reveal detailed error messages only to documented and approved individuals or roles.","description":"If SQL Server provides too much information in error logs and administrative messages to the screen, this could lead to compromise. The structure and content of error messages need to be carefully considered by the organization and development team. The extent to which the information system is able to identify and handle error conditions is guided by organizational policy and operational requirements. \n \nSome default DBMS error messages can contain information that could aid an attacker in, among others things, identifying the database type, host address, or state of the database. Custom errors may contain sensitive customer information. \n \nIt is important that detailed error messages be visible only to those who are authorized to view them; that general users receive only generalized acknowledgment that errors have occurred; and that these generalized messages appear only when relevant to the user's task. For example, a message along the lines of, \"An error has occurred. Unable to save your changes. If this problem persists, please contact your help desk.\" would be relevant. A message such as \"Warning: your transaction generated a large number of page splits\" would likely not be relevant. \"ABGQ is not a valid widget code.\" would be appropriate; but \"The INSERT statement conflicted with the FOREIGN KEY constraint \"WidgetTransactionFK\". The conflict occurred in database \"DB7\", table \"dbo.WidgetMaster\", column 'WidgetCode'\" would not, as it reveals too much about the database structure.","checkContent":"Error messages within applications, custom database code (stored procedures, triggers) must be enforced by guidelines and code reviews practices.  \n\nSQL 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: \n\nUSE master \nGO\nSELECT Name \nFROM syslogins \nWHERE (sysadmin = 1 or securityadmin = 1) \nand hasaccess = 1; \n\nIf 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. \n\nIn 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.  \n\nIf 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.\n\nOtherwise, verify if trace flag 3625 is enabled to mask certain system-level error information returned to nonadministrative users. \n \nLaunch SQL Server Configuration Manager: \nSelect SQL Server Services >> SQL Server. Select the SQL Server, then right-click and select \"Properties\". Select \"Startup Parameters\" tab and verify -T3625 exists in the dialogue window.\n\nOR\n\nRun the query:\nDBCC TRACESTATUS;\n\nIf 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.","fixText":"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. \n \nIf 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.   \n \nIf 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. \n \nConsider enabling trace flag 3625 to mask certain system-level error information returned to nonadministrative users. \n\nConfigure 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. \n \nIf 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.   \n \nIf 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. \n \nEnable trace flag 3625 to mask certain system-level error information returned to nonadministrative users. \n \nTo launch SQL Server Configuration Manager, select \"SQL Server Services\", select the \"SQL Server\", then right-click and select \"Properties\". Select \"Startup Parameters\" tab,  enter \"-T3625\", and then click \"Add\". Click \"OK\", then restart SQL instance.\n\nTo launch SQL Server Configuration Manager, click \"SQL Services\", open the instance properties, click the \"Service Parameters\" tab, enter \"-T3625\". Click \"Add\", click \"OK\", then restart SQL instance.","ccis":["CCI-001314"]},{"vulnId":"V-213979","ruleId":"SV-213979r961353_rule","severity":"medium","ruleTitle":"SQL Server must prevent non-privileged users from executing privileged functions, to include disabling, circumventing, or altering implemented security safeguards/countermeasures.","description":"Preventing non-privileged users from executing privileged functions mitigates the risk that unauthorized individuals or processes may gain unnecessary access to information or privileges.  \n \nSystem documentation should include a definition of the functionality considered privileged. \n \nDepending on circumstances, privileged functions can include, for example, establishing accounts, performing system integrity checks, or administering cryptographic key management activities. Non-privileged users are individuals that do not possess appropriate authorizations. Circumventing intrusion detection and prevention mechanisms or malicious code protection mechanisms are examples of privileged functions that require protection from non-privileged users. \n \nA privileged function in SQL Server/database context is any operation that modifies the structure of the database, its built-in logic, or its security settings. This would include all Data Definition Language (DDL) statements and all security-related statements. In an SQL environment, it encompasses, but is not necessarily limited to:  \nCREATE \nALTER \nDROP \nGRANT \nREVOKE \nDENY \n \nThere may also be Data Manipulation Language (DML) statements that, subject to context, should be regarded as privileged. Possible examples include: \n \nTRUNCATE TABLE; \nDELETE, or \nDELETE affecting more than n rows, for some n, or \nDELETE without a WHERE clause; \n \nUPDATE or \nUPDATE affecting more than n rows, for some n, or \nUPDATE without a WHERE clause; \n \nAny SELECT, INSERT, UPDATE, or DELETE to an application-defined security table executed by other than a security principal. \n \nDepending on the capabilities of SQL Server and the design of the database and associated applications, the prevention of unauthorized use of privileged functions may be achieved by means of DBMS security features, database triggers, other mechanisms, or a combination of these.","checkContent":"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. \n \nReview the system documentation to determine the required levels of protection for DBMS server securables, by type of login. \n \nReview the permissions in place on the server. If the actual permissions do not match the documented requirements, this is a finding. \n \nGet all permission assignments to logins and roles: \n \nSELECT DISTINCT \n    CASE \n        WHEN SP.class_desc IS NOT NULL THEN \n            CASE \n                WHEN SP.class_desc = 'SERVER' AND S.is_linked = 0 THEN 'SERVER' \n                WHEN SP.class_desc = 'SERVER' AND S.is_linked = 1 THEN 'SERVER (linked)' \n                ELSE SP.class_desc \n            END \n        WHEN E.name IS NOT NULL THEN 'ENDPOINT' \n        WHEN S.name IS NOT NULL AND S.is_linked = 0 THEN 'SERVER' \n        WHEN S.name IS NOT NULL AND S.is_linked = 1 THEN 'SERVER (linked)' \n        WHEN P.name IS NOT NULL THEN 'SERVER_PRINCIPAL' \n        ELSE '???' \n    END                    AS [Securable Class], \n    CASE \n        WHEN E.name IS NOT NULL THEN E.name \n        WHEN S.name IS NOT NULL THEN S.name \n        WHEN P.name IS NOT NULL THEN P.name \n        ELSE '???' \n    END                    AS [Securable], \n    P1.name                AS [Grantee], \n    P1.type_desc           AS [Grantee Type], \n    sp.permission_name     AS [Permission], \n    sp.state_desc          AS [State], \n    P2.name                AS [Grantor], \n    P2.type_desc           AS [Grantor Type] \nFROM \n    sys.server_permissions SP \n    INNER JOIN sys.server_principals P1 \n        ON P1.principal_id = SP.grantee_principal_id \n    INNER JOIN sys.server_principals P2 \n        ON P2.principal_id = SP.grantor_principal_id \n \n    FULL OUTER JOIN sys.servers S \n        ON  SP.class_desc = 'SERVER' \n        AND S.server_id = SP.major_id \n \n    FULL OUTER JOIN sys.endpoints E \n        ON  SP.class_desc = 'ENDPOINT' \n        AND E.endpoint_id = SP.major_id \n \n    FULL OUTER JOIN sys.server_principals P \n        ON  SP.class_desc = 'SERVER_PRINCIPAL'        \n        AND P.principal_id = SP.major_id \n \nGet all server role memberships: \n \nSELECT \n    R.name    AS [Role], \n    M.name    AS [Member] \nFROM \n    sys.server_role_members X \n    INNER JOIN sys.server_principals R ON R.principal_id = X.role_principal_id \n    INNER JOIN sys.server_principals M ON M.principal_id = X.member_principal_id \n \nThe 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.) \n \nEnsure only the documented and approved logins have privileged functions in SQL Server.  \n \nIf the current configuration does not match the documented baseline, this is a finding.","fixText":"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.","ccis":["CCI-002235"]},{"vulnId":"V-213980","ruleId":"SV-213980r961359_rule","severity":"medium","ruleTitle":"Use of credentials and proxies must be restricted to necessary cases only.","description":"In certain situations, to provide required functionality, a DBMS needs to execute internal logic (stored procedures, functions, triggers, etc.) and/or external code modules with elevated privileges. However, if the privileges required for execution are at a higher level than the privileges assigned to organizational users invoking the functionality applications/programs, those users are indirectly provided with greater privileges than assigned by organizations. \n \nPrivilege elevation must be utilized only where necessary and protected from misuse.","checkContent":"Review the server documentation to obtain a listing of accounts used for executing external processes. Execute the following query to obtain a listing of accounts currently configured for use by external processes. \n \nSELECT C.name AS credential_name, C.credential_identity \nFROM sys.credentials C \nGO \n \nSELECT P.name AS proxy_name, C.name AS credential_name, C.credential_identity \nFROM sys.credentials C  \nJOIN msdb.dbo.sysproxies P ON C.credential_id = P.credential_id \nWHERE P.enabled = 1 \nGO \n \nIf any Credentials or SQL Agent Proxy accounts are returned that are not documented and authorized, this is a finding.","fixText":"Remove any SQL Agent Proxy accounts and credentials that are not authorized. \n \nDROP CREDENTIAL <Credential Name> \nGO \n \nUSE [msdb] \nEXEC sp_delete_proxy @proxy_name = '<Proxy Name>' \nGO","ccis":["CCI-002233"]},{"vulnId":"V-213983","ruleId":"SV-213983r1018595_rule","severity":"medium","ruleTitle":"SQL Server must allocate audit record storage capacity in accordance with organization-defined audit record storage requirements.","description":"In order to ensure sufficient storage capacity for the audit logs, SQL Server must be able to allocate audit record storage capacity. Although another requirement (SRG-APP-000515-DB-000318) mandates that audit data be off-loaded to a centralized log management system, it remains necessary to provide space on the database server to serve as a buffer against outages and capacity limits of the off-loading mechanism. \n \nThe task of allocating audit record storage capacity is usually performed during initial installation of SQL Server and is closely associated with the DBA and system administrator roles. The DBA or system administrator will usually coordinate the allocation of physical drive space with the application owner/installer and the application will prompt the installer to provide the capacity information, the physical location of the disk, or both. \n \nIn determining the capacity requirements, consider such factors as: total number of users; expected number of concurrent users during busy periods; number and type of events being monitored; types and amounts of data being captured; the frequency/speed with which audit records are off-loaded to the central log management system; and any limitations that exist on SQL Server's ability to reuse the space formerly occupied by off-loaded records.","checkContent":"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.\n\nCheck the server documentation for the SQL Audit file size configurations. Locate the Audit file path and drive. \n \nSELECT max_file_size, max_rollover_files, log_file_path AS \"Audit Path\"  \nFROM sys.server_file_audits \n \nCalculate the space needed as the maximum file size and number of files from the SQL Audit File properties. \n \nIf the calculated product of the \"max_file_size\" times the \"max_rollover_files\" exceeds the size of the storage location, this is a finding; \n\nOR if \"max_file_size\" is set to \"0\" (Unlimited), this is a finding;\n\nOR if \"max_rollover_files\" are set to \"0\" (None) or \"2147483647\" (Unlimited), this is a finding.","fixText":"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. \n \nConfigure the maximum number of audit log files that are to be generated, staying within the number of logs the system was sized to support. \n \nUpdate the \"max_files\" or \"max_rollover_files\" parameter of the audits to ensure the correct number of files is defined.\n\nIf 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.","ccis":["CCI-001849"]},{"vulnId":"V-213984","ruleId":"SV-213984r961398_rule","severity":"medium","ruleTitle":"SQL Server must provide a warning to appropriate support staff when allocated audit record storage volume reaches 75% of maximum audit record storage capacity.","description":"Organizations are required to use a central log management system, so, under normal conditions, the audit space allocated to SQL Server on its own server will not be an issue. However, space will still be required on the server for SQL Server audit records in transit, and, under abnormal conditions, this could fill up. Since a requirement exists to halt processing upon audit failure, a service outage would result. \n \nIf support personnel are not notified immediately upon storage volume utilization reaching 75%, they are unable to plan for storage capacity expansion.  \n \nThe appropriate support staff include, at a minimum, the ISSO and the DBA/SA. \n \nMonitoring of free space can be accomplished using Microsoft System Center or a third-party monitoring tool.","checkContent":"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.  \n \nIf no alert exist to notify support staff in the event the SQL Audit drive reaches 75%, this is a finding.","fixText":"Utilize 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%.","ccis":["CCI-001855"]},{"vulnId":"V-213985","ruleId":"SV-213985r961401_rule","severity":"medium","ruleTitle":"SQL Server must provide an immediate real-time alert to appropriate support staff of all audit log failures.","description":"It is critical for the appropriate personnel to be aware if a system is at risk of failing to process audit logs as required. Without a real-time alert, security personnel may be unaware of an impending failure of the audit capability, and system operation may be adversely affected.  \n\nThe appropriate support staff include, at a minimum, the ISSO and the DBA/SA. \n\nA failure of database auditing will result in either the database continuing to function without auditing or in a complete halt to database operations. When audit processing fails, appropriate personnel must be alerted immediately to avoid further downtime or unaudited transactions\n\nAlerts provide organizations with urgent messages. Real-time alerts provide these messages immediately (i.e., the time from event detection to alert occurs in seconds or less). Alerts can be generated using tools like the SQL Server Agent Alerts and Database Mail.","checkContent":"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.\n\nIf real-time alerts are not sent upon auditing failure, this is a finding.","fixText":"Configure the system to provide immediate real-time alerts to appropriate support staff when an audit log failure occurs.","ccis":["CCI-001858"]},{"vulnId":"V-213986","ruleId":"SV-213986r961443_rule","severity":"medium","ruleTitle":"SQL Server must record time stamps in audit records and application data that can be mapped to Coordinated Universal Time (UTC, formerly GMT).","description":"If time stamps are not consistently applied and there is no common time reference, it is difficult to perform forensic analysis. \n \nTime stamps generated by SQL Server must include date and time. Time is commonly expressed in Coordinated Universal Time (UTC), a modern continuation of Greenwich Mean Time (GMT), or local time with an offset from UTC.","checkContent":"SQL Server audits store the timestamp in UTC time.  \n \nDetermine if the computer is joined to a domain. \n \nSELECT DEFAULT_DOMAIN()[DomainName]  \n \nIf this is not NULL, this is not a finding. \n \nIf the computer is not joined to a domain, determine what the time source is. (Run the following command in an elevated PowerShell session.) \n \n     w32tm /query /source \n \nIf the results of the command return \"Local CMOS Clock\" and is not documented with justification and AO authorization, this is a finding.  \n \nIf the OS does not synchronize with a time server, review the procedure for maintaining accurate time on the system.  \n \nIf such a procedure does not exist, this is a finding.  \n \nIf the procedure exists, review evidence that the correct time is actually maintained.  \n \nIf the evidence indicates otherwise, this is a finding.","fixText":"Where possible, configure the operating system to automatic synchronize with an official time server, using NTP. \n \nWhere 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.","ccis":["CCI-001890"]},{"vulnId":"V-213987","ruleId":"SV-213987r961461_rule","severity":"medium","ruleTitle":"SQL Server must enforce access restrictions associated with changes to the configuration of the instance.","description":"Failure to provide logical access restrictions associated with changes to configuration may have significant effects on the overall security of the system.  \n \nWhen dealing with access restrictions pertaining to change control, it should be noted that any changes to the hardware, software, and/or firmware components of the information system can potentially have significant effects on the overall security of the system.  \n \nAccordingly, only qualified and authorized individuals should be allowed to obtain access to system components for the purposes of initiating changes, including upgrades and modifications.","checkContent":"Obtain a list of logins who have privileged permissions and role memberships in SQL. \n \nExecute the following query to obtain a list of logins and roles and their respective permissions assignment: \n \nSELECT p.name AS Principal, \np.type_desc AS Type, \nsp.permission_name AS Permission,  \nsp.state_desc AS State \nFROM sys.server_principals p \nINNER JOIN sys.server_permissions sp ON p.principal_id = sp.grantee_principal_id \nWHERE sp.permission_name = 'CONTROL SERVER' \nOR sp.state = 'W' \n \nExecute the following query to obtain a list of logins and their role memberships. \n \nSELECT m.name AS Member, \nm.type_desc AS Type, \nr.name AS Role \nFROM sys.server_principals m \nINNER JOIN sys.server_role_members rm ON m.principal_id = rm.member_principal_id \nINNER JOIN sys.server_principals r ON rm.role_principal_id = r.principal_id \nWHERE r.name IN ('sysadmin','securityadmin','serveradmin') \n \nCheck 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.","fixText":"Revoke unauthorized permissions from principals. \n \nhttps://msdn.microsoft.com/en-us/library/ms186308.aspx \n \nRemove unauthorized logins from roles. \n \nALTER SERVER ROLE DROP MEMBER login; \n \nhttps://technet.microsoft.com/en-us/library/ee677634.aspx","ccis":["CCI-001813"]},{"vulnId":"V-213988","ruleId":"SV-213988r961461_rule","severity":"medium","ruleTitle":"Windows must enforce access restrictions associated with changes to the configuration of the SQL Server instance.","description":"Failure to provide logical access restrictions associated with changes to configuration may have significant effects on the overall security of the system.  \n \nWhen dealing with access restrictions pertaining to change control, it should be noted that any changes to the hardware, software, and/or firmware components of the information system can potentially have significant effects on the overall security of the system.  \n \nAccordingly, only qualified and authorized individuals should be allowed to obtain access to system components for the purposes of initiating changes, including upgrades and modifications.","checkContent":"Obtain a list of users who have privileged access to the server via the local Administrators group. \n \nLaunch lusrmgr.msc \nSelect Groups \nDouble-click Administrators \n \nAlternatively, execute the following command in PowerShell: \n\nnet localgroup administrators \n \nCheck the server documentation to verify the users returned are authorized.  \n \nIf the users are not documented and authorized, this is a finding.","fixText":"Remove users from the local Administrators group who are not authorized.","ccis":["CCI-001813"]},{"vulnId":"V-213989","ruleId":"SV-213989r1167485_rule","severity":"medium","ruleTitle":"SQL Server must produce audit records when attempts to modify SQL Server configuration and privileges occur within the database(s).","description":"Without auditing the enforcement of access restrictions against changes to configuration, it would be difficult to identify attempted attacks, and an audit trail would not be available for forensic investigation for after-the-fact actions.\n \nEnforcement actions are the methods or mechanisms used to prevent unauthorized changes to configuration settings. Enforcement action methods may be as simple as denying access to a file based on the application of file permissions (access restriction). Audit items may consist of lists of actions blocked by access restrictions or changes identified after the fact.\n\nChanges in the permissions, privileges, and roles granted to users and roles, as well as privileged activity, must be tracked. Without an audit trail, unauthorized elevation or restriction of privileges could go undetected. Elevated privileges give users access to information and functionality that they should not have; restricted privileges wrongly deny access to authorized users.\n \nA privileged function in this context is any operation that modifies the structure of the database, its built-in logic, or its security settings. This would include all Data Definition Language (DDL) statements and all security-related statements. In a SQL environment, it encompasses, but is not necessarily limited to, CREATE, ALTER, DROP, GRANT, REVOKE, and DENY. \n \nThere may also be Data Manipulation Language (DML) statements that, subject to context, should be regarded as privileged. Possible examples in SQL include TRUNCATE TABLE, SELECT, INSERT, UPDATE, or DELETE (to a security table executed by a user other than a security principal).\n \nDepending on the capabilities of SQL Server and the design of the database and associated applications, audit logging may be achieved by means of DBMS auditing features, database triggers, other mechanisms, or a combination of these. \n \nNote that it is particularly important to audit, and tightly control, any action that weakens the implementation of this requirement, since the objective is to have a complete audit trail of all administrative activity.\n \nTo aid in diagnosis, it is necessary to track failed attempts in addition to the successful ones.\n\nSatisfies: SRG-APP-000381-DB-000361, SRG-APP-000495-DB-000326, SRG-APP-000495-DB-000327, SRG-APP-000495-DB-000328, SRG-APP-000495-DB-000329, SRG-APP-000499-DB-000330, SRG-APP-000499-DB-000331, SRG-APP-000504-DB-000354, SRG-APP-000504-DB-000355","checkContent":"Determine if an audit is configured to capture denied actions and started by executing the following query:\n\nSELECT name AS 'Audit Name',\nstatus_desc AS 'Audit Status',\naudit_file_path AS 'Current Audit File'\nFROM sys.dm_server_audit_status\n\nIf no records are returned, this is a finding.\n\nExecute the following query to verify the following events are included in the server audit specification:\n\nAPPLICATION_ROLE_CHANGE_PASSWORD_GROUP,\nAUDIT_CHANGE_GROUP,\nBACKUP_RESTORE_GROUP,\nDATABASE_CHANGE_GROUP,\nDATABASE_OBJECT_ACCESS_GROUP,\nDATABASE_OBJECT_CHANGE_GROUP,\nDATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP,\nDATABASE_OBJECT_PERMISSION_CHANGE_GROUP,\nDATABASE_OWNERSHIP_CHANGE_GROUP,\nDATABASE_OPERATION_GROUP,\nDATABASE_PERMISSION_CHANGE_GROUP,\nDATABASE_PRINCIPAL_CHANGE_GROUP,\nDATABASE_PRINCIPAL_IMPERSONATION_GROUP,\nDATABASE_ROLE_MEMBER_CHANGE_GROUP,\nDBCC_GROUP,\nLOGIN_CHANGE_PASSWORD_GROUP,\nSCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP,\nSCHEMA_OBJECT_PERMISSION_CHANGE_GROUP,\nSERVER_OBJECT_CHANGE_GROUP,\nSERVER_OBJECT_OWNERSHIP_CHANGE_GROUP,\nSERVER_OBJECT_PERMISSION_CHANGE_GROUP,\nSERVER_OPERATION_GROUP,\nSERVER_PERMISSION_CHANGE_GROUP,\nSERVER_PRINCIPAL_IMPERSONATION_GROUP,\nSERVER_ROLE_MEMBER_CHANGE_GROUP,\nSERVER_STATE_CHANGE_GROUP,\nTRACE_CHANGE_GROUP\n\nSELECT a.name AS 'AuditName',\ns.name AS 'SpecName',\nd.audit_action_name AS 'ActionName',\nd.audited_result AS 'Result'\nFROM sys.server_audit_specifications s\nJOIN sys.server_audits a ON s.audit_guid = a.audit_guid\nJOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id\nWHERE a.is_state_enabled = 1\nAND d.audit_action_name IN (\n'APPLICATION_ROLE_CHANGE_PASSWORD_GROUP',\n'AUDIT_CHANGE_GROUP',\n'BACKUP_RESTORE_GROUP',\n'DATABASE_CHANGE_GROUP',\n'DATABASE_OBJECT_ACCESS_GROUP',\n'DATABASE_OBJECT_CHANGE_GROUP',\n'DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP',\n'DATABASE_OBJECT_PERMISSION_CHANGE_GROUP',\n'DATABASE_OWNERSHIP_CHANGE_GROUP',\n'DATABASE_OPERATION_GROUP',\n'DATABASE_PERMISSION_CHANGE_GROUP',\n'DATABASE_PRINCIPAL_CHANGE_GROUP',\n'DATABASE_PRINCIPAL_IMPERSONATION_GROUP',\n'DATABASE_ROLE_MEMBER_CHANGE_GROUP', \n'DBCC_GROUP',\n'LOGIN_CHANGE_PASSWORD_GROUP',\n'SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP',\n'SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP',\n'SERVER_OBJECT_CHANGE_GROUP',\n'SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP',\n'SERVER_OBJECT_PERMISSION_CHANGE_GROUP',\n'SERVER_OPERATION_GROUP',\n'SERVER_PERMISSION_CHANGE_GROUP',\n'SERVER_PRINCIPAL_IMPERSONATION_GROUP',\n'SERVER_ROLE_MEMBER_CHANGE_GROUP',\n'SERVER_STATE_CHANGE_GROUP',\n'TRACE_CHANGE_GROUP'\n)\nOrder by d.audit_action_name\n\nIf the identified groups are not returned, this is a finding.","fixText":"Add the required events to the server audit specification to audit denied actions.\n\nUSE [master]; \nGO  \n\nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = OFF);  \nGO  \n\nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (APPLICATION_ROLE_CHANGE_PASSWORD_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (AUDIT_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (BACKUP_RESTORE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_OBJECT_ACCESS_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_OBJECT_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_OBJECT_PERMISSION_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_OWNERSHIP_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_OPERATION_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_PERMISSION_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_PRINCIPAL_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_PRINCIPAL_IMPERSONATION_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (DATABASE_ROLE_MEMBER_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD \n(DBCC_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (LOGIN_CHANGE_PASSWORD_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SCHEMA_OBJECT_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SERVER_OBJECT_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SERVER_OBJECT_PERMISSION_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SERVER_OPERATION_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SERVER_PERMISSION_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SERVER_PRINCIPAL_IMPERSONATION_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SERVER_ROLE_MEMBER_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SERVER_STATE_CHANGE_GROUP ); \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (TRACE_CHANGE_GROUP ); \nGO \n\nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = ON);  \nGO","ccis":["CCI-003938","CCI-001814"]},{"vulnId":"V-213991","ruleId":"SV-213991r1137659_rule","severity":"medium","ruleTitle":"SQL Server must maintain a separate execution domain for each executing process.","description":"Database management systems can maintain separate execution domains for each executing process by assigning each process a separate address space.  \n \nEach process has a distinct address space so that communication between processes is controlled through the security functions, and one process cannot modify the executing code of another process.  \n \nMaintaining separate execution domains for executing processes can be achieved, for example, by implementing separate address spaces.","checkContent":"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: \n \nSELECT name, value, value_in_use \nFROM sys.configurations \nWHERE name = 'clr enabled' \n \nIf \"value_in_use\" is a \"1\" and CLR is not required, this is a finding.","fixText":"Disable CLR support in SQL Server by executing the following query: \n \nEXEC sp_configure 'clr enabled', 0 \nGO \n \nRECONFIGURE \nGO","ccis":["CCI-002530"]},{"vulnId":"V-213992","ruleId":"SV-213992r1137659_rule","severity":"medium","ruleTitle":"SQL Server services must be configured to run under unique dedicated user accounts.","description":"Database management systems can maintain separate execution domains for each executing process by assigning each process a separate address space. Each process has a distinct address space so that communication between processes is controlled through the security functions, and one process cannot modify the executing code of another process. Maintaining separate execution domains for executing processes can be achieved, for example, by implementing separate address spaces.","checkContent":"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. \n \nClick Start >> Type \"SQL Server Configuration Manager\" >> Launch the program >> Click SQL Server Services tree node. Review the \"Log On As\" column for each service. \n \nIf any services are configured with the same service account or are configured with an account that is not documented and authorized, this is a finding.","fixText":"Configure SQL Server services to have a documented, dedicated account.  \n \nFor non-domain servers, consider using virtual service accounts (VSA). See https://msdn.microsoft.com/en-us/library/ms143504.aspx#VA_Desc for more information. \n \nFor standalone, domain-joined servers, consider using managed service accounts. See https://msdn.microsoft.com/en-us/library/ms143504.aspx#MSA for more information. \n \nFor clustered instances, consider using group managed service accounts. See https://msdn.microsoft.com/en-us/library/ms143504.aspx#GMSA or https://blogs.msdn.microsoft.com/markweberblog/2016/05/25/group-managed-service-accounts-gmsa-and-sql-server-2016/ for more information.","ccis":["CCI-002530"]},{"vulnId":"V-213993","ruleId":"SV-213993r961677_rule","severity":"medium","ruleTitle":"When updates are applied to SQL Server software, any software components that have been replaced or made unnecessary must be removed.","description":"Previous versions of DBMS components that are not removed from the information system after updates have been installed may be exploited by adversaries.  \n \nSome DBMSs' installation tools may remove older versions of software automatically from the information system. In other cases, manual review and removal will be required. In planning installations and upgrades, organizations must include steps (automated, manual, or both) to identify and remove the outdated modules. \n \nA transition period may be necessary when both the old and the new software are required. This should be taken into account in the planning.","checkContent":"From the server documentation, obtain a listing of required components.  \n \nGenerate a listing of components installed on the server. \n \nClick Start >> Type \"SQL Server 2016 Installation Center\" >> Launch the program >> Click Tools >> Click \"Installed SQL Server features discovery report\" \n \nCompare the feature listing against the required components listing. If any features are installed, but are not required, this is a finding.","fixText":"Remove all features that are not required.","ccis":["CCI-002617"]},{"vulnId":"V-213994","ruleId":"SV-213994r1137667_rule","severity":"medium","ruleTitle":"Security-relevant software updates to SQL Server must be installed within the time period directed by an authoritative source (e.g. IAVM, CTOs, DTMs, and STIGs).","description":"Security flaws with software applications, including database management systems, are discovered daily. Vendors are constantly updating and patching their products to address newly discovered security vulnerabilities. Organizations (including any contractor to the organization) are required to promptly install security-relevant software updates (e.g., patches, service packs, and hot fixes). Flaws discovered during security assessments, continuous monitoring, incident response activities, or information system error handling must also be addressed expeditiously. \n \nOrganization-defined time periods for updating security-relevant software may vary based on a variety of factors including, for example, the security category of the information system or the criticality of the update (i.e., severity of the vulnerability related to the discovered flaw). \n \nThis requirement will apply to software patch management solutions that are used to install patches across the enclave and also to applications themselves that are not part of that patch management solution. For example, many browsers today provide the capability to install their own patch software. Patch criticality, as well as system criticality, will vary. Therefore, the tactical situations regarding the patch management process will also vary. This means that the time period utilized must be a configurable parameter. Time frames for application of security-relevant software updates may be dependent upon the Information Assurance Vulnerability Management (IAVM) process. \n \nSQL Server will be configured to check for and install security-relevant software updates within an identified time period from the availability of the update. The specific time period will be defined by an authoritative source (e.g. IAVM, CTOs, DTMs, and STIGs).","checkContent":"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\n \nCheck the SQL Server version by running the following script: Print @@version \n \nIf the SQL Server version is not shown as supported, this is a finding. \n \nIf such evidence cannot be obtained, or the evidence that is obtained indicates a pattern of noncompliance, this is a finding.","fixText":"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.","ccis":["CCI-002605"]},{"vulnId":"V-214000","ruleId":"SV-214000r961800_rule","severity":"medium","ruleTitle":"SQL Server must generate audit records when successful and unsuccessful attempts to add privileges/permissions occur.","description":"Changes in the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized elevation or restriction of privileges could go undetected. Elevated privileges give users access to information and functionality that they should not have; restricted privileges wrongly deny access to authorized users. \n \nIn an SQL environment, adding permissions is typically done via the GRANT command, or, in the negative, the DENY command.  \n \nTo aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.\n\nSatisfies: SRG-APP-000495-DB-000326","checkContent":"Check that SQL Server Audit is being used for the STIG compliant audit.\n\nDetermine if an audit is configured and started by executing the following query:\n\nSELECT name AS 'Audit Name', \nstatus_desc AS 'Audit Status', \naudit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status\n\nExecute the following query to verify the required audit actions are included in the server audit specification: \n\nSELECT a.name AS 'AuditName', \ns.name AS 'SpecName', \nd.audit_action_name AS 'ActionName', \nd.audited_result AS 'Result' \nFROM sys.server_audit_specifications s \nJOIN sys.server_audits a ON s.audit_guid = a.audit_guid \nJOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id \nWHERE a.is_state_enabled = 1\nAND d.audit_action_name IN ('DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'DATABASE_OBJECT_PERMISSION_CHANGE_GROUP'\n,'DATABASE_OWNERSHIP_CHANGE_GROUP'\n,'DATABASE_PERMISSION_CHANGE_GROUP'\n,'DATABASE_ROLE_MEMBER_CHANGE_GROUP'\n,'SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP'\n,'SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'SERVER_OBJECT_PERMISSION_CHANGE_GROUP'\n,'SERVER_PERMISSION_CHANGE_GROUP'\n,'SERVER_ROLE_MEMBER_CHANGE_GROUP')\n\nIf the any of the following audit actions are not returned in an active audit, this is a finding.\n\nDATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP \nDATABASE_OBJECT_PERMISSION_CHANGE_GROUP \nDATABASE_OWNERSHIP_CHANGE_GROUP \nDATABASE_PERMISSION_CHANGE_GROUP \nDATABASE_ROLE_MEMBER_CHANGE_GROUP \nSCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP \nSCHEMA_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_OBJECT_OWNERSHIP_CHANGE_GROUP \nSERVER_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_PERMISSION_CHANGE_GROUP \nSERVER_ROLE_MEMBER_CHANGE_GROUP \n\nIf no records are returned, this is a finding.","fixText":"Add the following events to the SQL Server Audit that is being used for the STIG compliant audit. \n \nDATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP \nDATABASE_OBJECT_PERMISSION_CHANGE_GROUP \nDATABASE_OWNERSHIP_CHANGE_GROUP \nDATABASE_PERMISSION_CHANGE_GROUP \nDATABASE_ROLE_MEMBER_CHANGE_GROUP \nSCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP \nSCHEMA_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_OBJECT_OWNERSHIP_CHANGE_GROUP \nSERVER_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_PERMISSION_CHANGE_GROUP \nSERVER_ROLE_MEMBER_CHANGE_GROUP \n \nSee the supplemental file \"SQL 2016 Audit.sql\". \n\nReference: \nhttps://msdn.microsoft.com/en-us/library/cc280663.aspx","ccis":["CCI-000172"]},{"vulnId":"V-214002","ruleId":"SV-214002r961800_rule","severity":"medium","ruleTitle":"SQL Server must generate audit records when successful and unsuccessful attempts to modify privileges/permissions occur.","description":"Changes in the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized elevation or restriction of privileges could go undetected. Elevated privileges give users access to information and functionality that they should not have; restricted privileges wrongly deny access to authorized users. \n \nIn an SQL environment, modifying permissions is typically done via the GRANT, REVOKE, and DENY commands.  \n \nTo aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.\n\nSatisfies: SRG-APP-000495-DB-000328","checkContent":"Check that SQL Server Audit is being used for the STIG compliant audit.\n\nDetermine if an audit is configured and started by executing the following query:\n\nSELECT name AS 'Audit Name', \nstatus_desc AS 'Audit Status', \naudit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status\n\nExecute the following query to verify the required audit actions are included in the server audit specification:\n\nSELECT a.name AS 'AuditName', \ns.name AS 'SpecName', \nd.audit_action_name AS 'ActionName', \nd.audited_result AS 'Result' \nFROM sys.server_audit_specifications s \nJOIN sys.server_audits a ON s.audit_guid = a.audit_guid \nJOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id \nWHERE a.is_state_enabled = 1\nAND d.audit_action_name IN ('DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'DATABASE_OBJECT_PERMISSION_CHANGE_GROUP'\n,'DATABASE_OWNERSHIP_CHANGE_GROUP'\n,'DATABASE_PERMISSION_CHANGE_GROUP'\n,'DATABASE_ROLE_MEMBER_CHANGE_GROUP'\n,'SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP'\n,'SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'SERVER_OBJECT_PERMISSION_CHANGE_GROUP'\n,'SERVER_PERMISSION_CHANGE_GROUP'\n,'SERVER_ROLE_MEMBER_CHANGE_GROUP')\n\nIf the any of the following audit actions are not returned in an active audit, this is a finding.\n\nDATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP \nDATABASE_OBJECT_PERMISSION_CHANGE_GROUP \nDATABASE_OWNERSHIP_CHANGE_GROUP \nDATABASE_PERMISSION_CHANGE_GROUP \nDATABASE_ROLE_MEMBER_CHANGE_GROUP \nSCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP \nSCHEMA_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_OBJECT_OWNERSHIP_CHANGE_GROUP \nSERVER_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_PERMISSION_CHANGE_GROUP \nSERVER_ROLE_MEMBER_CHANGE_GROUP \n\nIf no records are returned, this is a finding.","fixText":"Add the following events to the SQL Server Audit that is being used for the STIG compliant audit. \n \nDATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP \nDATABASE_OBJECT_PERMISSION_CHANGE_GROUP \nDATABASE_OWNERSHIP_CHANGE_GROUP \nDATABASE_PERMISSION_CHANGE_GROUP \nDATABASE_ROLE_MEMBER_CHANGE_GROUP \nSCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP \nSCHEMA_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_OBJECT_OWNERSHIP_CHANGE_GROUP \nSERVER_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_PERMISSION_CHANGE_GROUP \nSERVER_ROLE_MEMBER_CHANGE_GROUP \n \nSee the supplemental file \"SQL 2016 Audit.sql\". \n\nReference: \nhttps://msdn.microsoft.com/en-us/library/cc280663.aspx","ccis":["CCI-000172"]},{"vulnId":"V-214004","ruleId":"SV-214004r1167486_rule","severity":"medium","ruleTitle":"SQL Server must generate audit records when successful and unsuccessful attempts to modify security objects occur.","description":"Changes in the database objects (tables, views, procedures, functions) that record and control permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized changes to the security subsystem could go undetected. The database could be severely compromised or rendered inoperative. \n \nTo aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.\n\nSatisfies: SRG-APP-000496-DB-000334, SRG-APP-000496-DB-000335, SRG-APP-000501-DB-000336, SRG-APP-000501-DB-000337","checkContent":"Determine if an audit is configured and started by executing the following query: \n \nSELECT name AS 'Audit Name', \n  status_desc AS 'Audit Status', \n  audit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status \n \nIf no records are returned, this is a finding. \n \nExecute the following query to verify the \"SCHEMA_OBJECT_CHANGE_GROUP\" is included in the server audit specification. \n \nSELECT a.name AS 'AuditName', \n  s.name AS 'SpecName', \n  d.audit_action_name AS 'ActionName', \n  d.audited_result AS 'Result' \nFROM sys.server_audit_specifications s \nJOIN sys.server_audits a ON s.audit_guid = a.audit_guid \nJOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id \nWHERE a.is_state_enabled = 1 AND d.audit_action_name = 'SCHEMA_OBJECT_CHANGE_GROUP' \n \nIf the \"SCHEMA_OBJECT_CHANGE_GROUP\" is not returned in an active audit, this is a finding.","fixText":"Add the \"SCHEMA_OBJECT_CHANGE_GROUP\" to the server audit specification \nUSE [master]; \nGO  \n \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = OFF);  \nGO  \n \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SCHEMA_OBJECT_CHANGE_GROUP);  \nGO  \n \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = ON);  \nGO \n \nSee supplemental script \"SQL 2016 Audit.sql\".","ccis":["CCI-000172"]},{"vulnId":"V-214008","ruleId":"SV-214008r961812_rule","severity":"medium","ruleTitle":"SQL Server must generate audit records when successful and unsuccessful attempts to delete privileges/permissions occur.","description":"Changes in the permissions, privileges, and roles granted to users and roles must be tracked. Without an audit trail, unauthorized elevation or restriction of privileges could go undetected. Elevated privileges give users access to information and functionality that they should not have; restricted privileges wrongly deny access to authorized users. \n \nIn an SQL environment, deleting permissions is typically done via the REVOKE or DENY command.  \n \nTo aid in diagnosis, it is necessary to keep track of failed attempts in addition to the successful ones.","checkContent":"Check that SQL Server Audit is being used for the STIG compliant audit. \nDetermine if an audit is configured and started by executing the following query. If no records are returned, this is a finding. \n\nSELECT name AS 'Audit Name', \nstatus_desc AS 'Audit Status', \naudit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status\n\nExecute the following query to verify the required audit actions are included in the server audit specification: \n\nSELECT a.name AS 'AuditName', \ns.name AS 'SpecName', \nd.audit_action_name AS 'ActionName', \nd.audited_result AS 'Result' \nFROM sys.server_audit_specifications s \nJOIN sys.server_audits a ON s.audit_guid = a.audit_guid \nJOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id \nWHERE a.is_state_enabled = 1\nAND d.audit_action_name IN ('DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'DATABASE_OBJECT_PERMISSION_CHANGE_GROUP'\n,'DATABASE_OWNERSHIP_CHANGE_GROUP'\n,'DATABASE_PERMISSION_CHANGE_GROUP'\n,'DATABASE_ROLE_MEMBER_CHANGE_GROUP'\n,'SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP'\n,'SERVER_OBJECT_OWNERSHIP_CHANGE_GROUP'\n,'SERVER_OBJECT_PERMISSION_CHANGE_GROUP'\n,'SERVER_PERMISSION_CHANGE_GROUP'\n,'SERVER_ROLE_MEMBER_CHANGE_GROUP')\n\nIf the any of the following audit actions are not returned in an active audit, this is a finding.\n\nDATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP \nDATABASE_OBJECT_PERMISSION_CHANGE_GROUP \nDATABASE_OWNERSHIP_CHANGE_GROUP \nDATABASE_PERMISSION_CHANGE_GROUP \nDATABASE_ROLE_MEMBER_CHANGE_GROUP \nSCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP \nSCHEMA_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_OBJECT_OWNERSHIP_CHANGE_GROUP \nSERVER_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_PERMISSION_CHANGE_GROUP \nSERVER_ROLE_MEMBER_CHANGE_GROUP \n\nReference: \nhttps://msdn.microsoft.com/en-us/library/cc280663.aspx","fixText":"Add the following events to the SQL Server Audit that is being used for the STIG compliant audit. \n \nDATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP \nDATABASE_OBJECT_PERMISSION_CHANGE_GROUP \nDATABASE_OWNERSHIP_CHANGE_GROUP \nDATABASE_PERMISSION_CHANGE_GROUP \nDATABASE_ROLE_MEMBER_CHANGE_GROUP \nSCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP \nSCHEMA_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_OBJECT_OWNERSHIP_CHANGE_GROUP \nSERVER_OBJECT_PERMISSION_CHANGE_GROUP \nSERVER_PERMISSION_CHANGE_GROUP \nSERVER_ROLE_MEMBER_CHANGE_GROUP \n \nSee the supplemental file \"SQL 2016 Audit.sql\".\n\nReference: \nhttps://msdn.microsoft.com/en-us/library/cc280663.aspx","ccis":["CCI-000172"]},{"vulnId":"V-214014","ruleId":"SV-214014r1167488_rule","severity":"medium","ruleTitle":"SQL Server must generate audit records when successful and unsuccessful logons or connection attempts occur.","description":"For completeness of forensic analysis, it is necessary to track who/what (a user or other principal) logs on to SQL Server. It is also necessary to track failed attempts to log on to SQL Server. While positive identification may not be possible in a case of failed authentication, as much information as possible about the incident must be captured.\n\nSatisfies: SRG-APP-000503-DB-000350, SRG-APP-000503-DB-000351, SRG-APP-000506-DB-000353","checkContent":"Determine if an audit is configured and started by executing the following query: \n \nSELECT name AS 'Audit Name', \n  status_desc AS 'Audit Status', \n  audit_file_path AS 'Current Audit File' \nFROM sys.dm_server_audit_status \n \nExecute the following query to verify the SUCCESSFUL_LOGIN_GROUP and FAILED_LOGIN_GROUP are included in the server audit specification.\n \nSELECT a.name AS 'AuditName', \n  s.name AS 'SpecName', \n d.audit_action_name AS 'ActionName', \n  d.audited_result AS 'Result' \nFROM sys.server_audit_specifications s \nJOIN sys.server_audits a ON s.audit_guid = a.audit_guid \nJOIN sys.server_audit_specification_details d ON s.server_specification_id = d.server_specification_id \nWHERE a.is_state_enabled = 1 AND d.audit_action_name IN ('SUCCESSFUL_LOGIN_GROUP', 'FAILED_LOGIN_GROUP') \n\nIf both \"SUCCESSFUL_LOGIN_GROUP\" and \"FAILED_LOGIN_GROUP\" are returned in an active audit, this is not a finding.\n \nIf both \"SUCCESSFUL_LOGIN_GROUP\" and \"FAILED_LOGIN_GROUP\" are not in the active audit, determine whether \"Both failed and successful logins\" is enabled.\n \nIn SQL Management Studio: \nRight-click on the instance. \n- Select \"Properties\". \n- Select \"Security\" on the left hand side. \n- Check the setting for \"Login auditing\". \n \nIf \"Both failed and successful logins\" is not selected, this is a finding.","fixText":"Add both \"SUCCESSFUL_LOGIN_GROUP\" and \"FAILED_LOGIN_GROUP\" to the server audit specification. \nUSE [master];\nGO  \n \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = OFF);  \nGO  \n \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (SUCCESSFUL_LOGIN_GROUP);  \nGO  \n\nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION ADD (FAILED_LOGIN_GROUP);  \nGO  \n \nALTER SERVER AUDIT SPECIFICATION STIG_AUDIT_SERVER_SPECIFICATION WITH (STATE = ON);  \nGO \n \nAlternatively, enable \"Both failed and successful logins\".\n\nIn SQL Management Studio:\nRight-click on the instance.\n- Select \"Properties\".\n- Select \"Security\" on the left-hand side.\n- Select \"Both failed and successful logins\". \n- Click \"OK\".","ccis":["CCI-000172"]},{"vulnId":"V-214021","ruleId":"SV-214021r961839_rule","severity":"medium","ruleTitle":"SQL Server must generate audit records for all direct access to the database(s).","description":"In this context, direct access is any query, command, or call to SQL Server that comes from any source other than the application(s) that it supports. Examples would be the command line or a database management utility program. The intent is to capture all activity from administrative and non-standard sources.","checkContent":"Determine whether any Server Audits are configured to filter records. From SQL Server Management Studio execute the following query: \n \nSELECT name AS AuditName, predicate AS AuditFilter  \nFROM sys.server_audits  \nWHERE predicate IS NOT NULL \n \nIf any audits are returned, review the associated filters to determine whether administrative activities are being excluded.  \n \nIf any audits are configured to exclude administrative activities, this is a finding.","fixText":"Check the system documentation for required SQL Server Audits. Remove any Audit filters that exclude or reduce required auditing. Update filters to ensure administrative activity is not excluded.","ccis":["CCI-000172"]},{"vulnId":"V-214025","ruleId":"SV-214025r961860_rule","severity":"medium","ruleTitle":"The system SQL Server must off-load audit data to a separate log management facility; this must be continuous and in near real time for systems with a network connection to the storage facility and weekly or more often for stand-alone systems.","description":"Information stored in one location is vulnerable to accidental or incidental deletion or alteration. \n \nOff-loading is a common process in information systems with limited audit storage capacity. \n \nThe system SQL Server may write audit records to database tables, to files in the file system, to other kinds of local repository, or directly to a centralized log management system. Whatever the method used, it must be compatible with off-loading the records to the centralized system.","checkContent":"Review the system documentation for a description of how audit records are off-loaded. \n \nIf 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. \n \nIf 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.","fixText":"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.","ccis":["CCI-001851"]},{"vulnId":"V-214026","ruleId":"SV-214026r961863_rule","severity":"medium","ruleTitle":"SQL Server must configure Customer Feedback and Error Reporting.","description":"By default, Microsoft SQL Server enables participation in the customer experience improvement program (CEIP). This program collects information about how its customers are using the product. Specifically, SQL Server collects information about the installation experience, feature usage, and performance. This information helps Microsoft improve the product to better meet customer needs.","checkContent":"Launch \"Registry Editor\" \n \nNavigate to HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft SQL Server\\[InstanceId]\\CPE \nReview the following values:  CustomerFeedback, EnableErrorReporting \n \nNavigate to HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft SQL Server\\130 \nReview the following values:  CustomerFeedback, EnableErrorReporting \n \nIf this is a classified system, and any of the above values are not zero (0), this is a finding. \n \nIf this is an unclassified system, review the server documentation to determine whether CEIP participation is authorized. \n \nIf CEIP participation is not authorized, and any of the above values are one (1), this is a finding.","fixText":"To disable participation in the CEIP program, change the value of the following registry keys to zero (0). \n \nTo enable participation in the CEIP program, change the value of the following registry keys to one (1). \n \nHKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft SQL Server\\[InstanceId]\\CPE\\CustomerFeedback \nHKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft SQL Server\\[InstanceId]\\CPE\\EnableErrorReporting \nHKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft SQL Server\\130\\CustomerFeedback \nHKEY_LOCAL_MACHINE\\Software\\Microsoft\\Microsoft SQL Server\\130\\EnableErrorReporting","ccis":["CCI-000366"]},{"vulnId":"V-214027","ruleId":"SV-214027r961863_rule","severity":"medium","ruleTitle":"SQL Server must configure SQL Server Usage and Error Reporting Auditing.","description":"By default, Microsoft SQL Server enables participation in the customer experience improvement program (CEIP). This program collects information about how its customers are using the product. Specifically, SQL Server collects information about the installation experience, feature usage, and performance. This information helps Microsoft improve the product to better meet customer needs. The Local Audit component of SQL Server Usage Feedback collection writes data collected by the service to a designated folder, representing the data (logs) that will be sent to Microsoft. The purpose of the Local Audit is to allow customers to see all data Microsoft collects with this feature, for compliance, regulatory or privacy validation reasons.","checkContent":"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. \n \nIf auditing of telemetry data is required, determine the telemetry service user name by executing the following query: \n \nSELECT name \nFROM sys.server_principals \nWHERE name LIKE '%SQLTELEMETRY%' \n \nReview the values of the following registry key: \nNote: InstanceId refers to the type and instance of the feature. (e.g., MSSQL13.SqlInstance, MSAS13.SSASInstance, MSRS13.SSRSInstance) \n \nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SQL Server\\[InstanceId]\\CPE\\UserRequestedLocalAuditDirectory \n \nIf the registry key do not exist or the value is blank, this is a finding. \n \nNavigate the path defined in the \"UserRequestedLocalAuditDirectory\" registry key in file explorer. \n \nRight-click on the folder and choose \"Properties\". \nOpen the \"Security\" tab.\n \nVerify the SQLTELEMETRY account has the following permissions: \n \n- List folder contents \n- Read \n- Write \n \nIf the permissions are not set properly on the folder, this is a finding. \n \nOpen services.msc and find the telemetry service. \n- For Database Engine, use SQL Server CEIP service (<INSTANCENAME>). \n- For Analysis Services, use SQL Server Analysis Services CEIP (<INSTANCENAME>). \n \nRight-click on the service and choose \"Properties\". Verify the \"Startup type\" is \"Automatic.\"  \n \nIf the service is not configured to automatically start, this is a finding. \n \nReview 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. \n \nIf no processes and procedures exist for reviewing telemetry data, this is a finding.","fixText":"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. \n \nCreate a folder to store the telemetry audit data in. \n \nGrant the SQLTELEMETRY service the following permissions on the folder: \n \n- List folder contents \n- Read \n- Write \n \nCreate and configure the following registry key: \nNote: InstanceId refers to the type and instance of the feature. (e.g., MSSQL13.SqlInstance, MSAS13.SSASInstance, MSRS13.SSRSInstance) \n \nHKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SQL Server\\[InstanceId]\\CPE\\UserRequestedLocalAuditDirectory [string] \n \nSet the \"UserRequestedLocalAuditDirectory\" key value to the path of the telemetry audit folder. \n \nSet the telemetry service to start automatically. Restart the service. \n- For Database Engine, use SQL Server CEIP service (<INSTANCENAME>). \n- For Analysis Services, use SQL Server Analysis Services CEIP (<INSTANCENAME>).","ccis":["CCI-000366"]},{"vulnId":"V-214028","ruleId":"SV-214028r1137654_rule","severity":"high","ruleTitle":"The SQL Server default account [sa] must be disabled.","description":"SQL Server's [sa] account has special privileges required to administer the database. The [sa] account is a well-known SQL Server account and is likely to be targeted by attackers and thus more prone to providing unauthorized access to the database. \n\nThis [sa] default account is administrative and could lead to catastrophic consequences, including the complete loss of control over SQL Server. If the [sa] default account is not disabled, an attacker might be able to gain access through the account. SQL Server by default disables the [sa] account at installation. \n\nSome applications that run on SQL Server require the [sa] account to be enabled for the application to function properly. These applications that require the [sa] account to be enabled are usually legacy systems.","checkContent":"Check SQL Server settings to determine if the [sa] (system administrator) account has been disabled by executing the following query:\n\nUSE master;\nGO\nSELECT name, is_disabled\nFROM sys.sql_logins\nWHERE principal_id = 1;\nGO\n\nVerify that the \"name\" column contains the current name of the [sa] database server account.\n\nIf the \"is_disabled\" column is not set to \"1\", this is a finding.","fixText":"Modify the enabled flag of SQL Server's [sa] (system administrator) account by running the following script.\nUSE master; \nGO \nALTER LOGIN [sa] DISABLE; \nGO","ccis":["CCI-000213"]},{"vulnId":"V-214029","ruleId":"SV-214029r960963_rule","severity":"medium","ruleTitle":"SQL Server default account [sa] must have its name changed.","description":"SQL Server's [sa] account has special privileges required to administer the database. The [sa] account is a well-known SQL Server account name and is likely to be targeted by attackers, and is thus more prone to providing unauthorized access to the database. \n\nSince the SQL Server [sa] is administrative in nature, the compromise of a default account can have catastrophic consequences, including the complete loss of control over SQL Server. Since SQL Server needs for this account to exist and it should not be removed, one way to mitigate this risk is to change the [sa] account name.","checkContent":"Verify the SQL Server default [sa] (system administrator) account name has been changed by executing the following query: \n\nUSE master; \nGO \nSELECT * \nFROM sys.sql_logins \nWHERE [name] = 'sa' OR [principal_id] = 1; \nGO \n\nIf the login account name \"SA\" or \"sa\" appears in the query output, this is a finding.","fixText":"Modify the SQL Server's [sa] (system administrator) account by running the following script:\n\nUSE master; \nGO \nALTER LOGIN [sa] WITH NAME = <new name> \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214030","ruleId":"SV-214030r961359_rule","severity":"medium","ruleTitle":"Execution of startup stored procedures must be restricted to necessary cases only.","description":"In certain situations, to provide required functionality, a DBMS needs to execute internal logic (stored procedures, functions, triggers, etc.) and/or external code modules with elevated privileges. However, if the privileges required for execution are at a higher level than the privileges assigned to organizational users invoking the functionality applications/programs, those users are indirectly provided with greater privileges than assigned by organizations.\n\nWhen 'Scan for startup procs' is enabled, SQL Server scans for and runs all automatically run stored procedures defined on the server.  The execution of start-up stored procedures will be done under a high privileged context, therefore it is a commonly used post-exploitation vector.","checkContent":"Review the system documentation to obtain a listing of documented stored procedures used by SQL Server during start up. Execute the following query:\n\nSelect [name] as StoredProc\nFrom sys.procedures\nWhere OBJECTPROPERTY(OBJECT_ID, 'ExecIsStartup') = 1\n\nIf any stored procedures are returned that are not documented, this is a finding.","fixText":"To disable start up stored procedure(s), run the following in Master for each undocumented procedure:\n\nsp_procoption @procname = '<procedure name>', @OptionName = 'Startup', @optionValue = 'Off'","ccis":["CCI-002233"]},{"vulnId":"V-214031","ruleId":"SV-214031r961863_rule","severity":"medium","ruleTitle":"SQL Server Mirroring endpoint must utilize AES encryption.","description":"Information can be either unintentionally or maliciously disclosed or modified during preparation for transmission, including, for example, during aggregation, at protocol transformation points, and during packing/unpacking. These unauthorized disclosures or modifications compromise the confidentiality or integrity of the information.\n\nUse of this requirement will be limited to situations where the data owner has a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process. \n\nSQL Mirroring endpoints support different encryption algorithms, including no-encryption. Using a weak encryption algorithm or plaintext in communication protocols can lead to data loss, data manipulation and/or connection hijacking.","checkContent":"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.\n\nIf Database Mirroring is in use, run the following to check for encrypted transmissions:  \n\nSELECT name, type_desc, encryption_algorithm_desc\nFROM sys.database_mirroring_endpoints\nWHERE encryption_algorithm != 2\n\nIf any records are returned, this is a finding.","fixText":"Run the following to enable encryption on the mirroring endpoint:\n\nALTER ENDPOINT <Endpoint Name>\nFOR DATABASE_MIRRORING\n(ENCRYPTION = REQUIRED ALGORITHM AES)","ccis":["CCI-000366"]},{"vulnId":"V-214032","ruleId":"SV-214032r961863_rule","severity":"medium","ruleTitle":"SQL Server Service Broker endpoint must utilize AES encryption.","description":"Information can be either unintentionally or maliciously disclosed or modified during preparation for transmission, including, for example, during aggregation, at protocol transformation points, and during packing/unpacking. These unauthorized disclosures or modifications compromise the confidentiality or integrity of the information.\n\nUse of this requirement will be limited to situations where the data owner has a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process. \n\nSQL Server Service Broker endpoints support different encryption algorithms, including no-encryption. Using a weak encryption algorithm or plaintext in communication protocols can lead to data loss, data manipulation and/or connection hijacking.","checkContent":"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.\n\nIf SQL Service Broker is in use, run the following to check for encrypted transmissions:  \n\nSELECT name, type_desc, encryption_algorithm_desc\nFROM sys.service_broker_endpoints\nWHERE encryption_algorithm != 2\n\nIf any records are returned, this is a finding.","fixText":"Run the following to enable encryption on the Service Broker endpoint:\n\nALTER ENDPOINT <EndpointName>\nFOR SERVICE_BROKER\n(ENCRYPTION = REQUIRED ALGORITHM AES)","ccis":["CCI-000366"]},{"vulnId":"V-214033","ruleId":"SV-214033r960963_rule","severity":"medium","ruleTitle":"SQL Server execute permissions to access the registry must be revoked, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n\nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. \n\nApplications must adhere to the principles of least functionality by providing only essential capabilities.\n\nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system.\n\nThe registry contains sensitive information, including password hashes as well as clear text passwords. Registry extended stored procedures allow Microsoft SQL Server to access the machine's registry. The sensitivity of these procedures are exacerbated if Microsoft SQL Server is run under the Windows account LocalSystem. LocalSystem can read and write nearly all values in the registry, even those not accessible by the Administrator. Unlike the xp_cmdshell extended stored procedure, which runs under a separate context if executed by a login not in the sysadmin role, the registry extended stored procedures always execute under the security context of the MSSQLServer service. Because the sensitive information is stored in the registry, it is essential that access to that information be properly guarded.","checkContent":"To determine if permissions to execute registry extended stored procedures have been revoked from all users (other than dbo), execute the following command:\n\nSELECT OBJECT_NAME(major_id) AS [Stored Procedure]\n,dpr.NAME AS [Principal]\nFROM sys.database_permissions AS dp\nINNER JOIN sys.database_principals AS dpr ON dp.grantee_principal_id = dpr.principal_id\nWHERE major_id IN (\n OBJECT_ID('xp_regaddmultistring')\n,OBJECT_ID('xp_regdeletekey')\n,OBJECT_ID('xp_regdeletevalue')\n,OBJECT_ID('xp_regenumvalues')\n,OBJECT_ID('xp_regenumkeys')\n,OBJECT_ID('xp_regremovemultistring')\n,OBJECT_ID('xp_regwrite')\n,OBJECT_ID('xp_instance_regaddmultistring')\n,OBJECT_ID('xp_instance_regdeletekey')\n,OBJECT_ID('xp_instance_regdeletevalue')\n,OBJECT_ID('xp_instance_regenumkeys')\n,OBJECT_ID('xp_instance_regenumvalues')\n,OBJECT_ID('xp_instance_regremovemultistring')\n,OBJECT_ID('xp_instance_regwrite')\n)\nAND dp.[type] = 'EX'\nORDER BY dpr.NAME;\n\nIf any records are returned, review the system documentation to determine whether the accessing of the registry via  extended stored procedures are required and authorized. If it is not authorized, this is a finding.","fixText":"Remove execute permissions to any registry extended stored procedure from all users (other than dbo).\n\nUSE master\nGO\nREVOKE EXECUTE ON [<procedureName>] FROM [<principal>]\nGO","ccis":["CCI-000381"]},{"vulnId":"V-214034","ruleId":"SV-214034r960963_rule","severity":"medium","ruleTitle":"Filestream must be disabled, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n\nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. \n\nApplications must adhere to the principles of least functionality by providing only essential capabilities.\n\nThe most significant potential for attacking an instance is through the use of features that expose an external interface or ad hoc execution capability. FILESTREAM integrates the SQL Server Database Engine with an NTFS file system by storing varbinary(max) binary large object (BLOB) data as files on the file system. Transact-SQL statements can insert, update, query, search, and back up FILESTREAM data.","checkContent":"Review the system documentation to see if FileStream is in use.  If in use authorized, this is not a finding.   \n\nIf FileStream is not documented as being authorized, execute the following query.\nEXEC sp_configure 'filestream access level'\n\nIf \"run_value\" is greater than \"0\", this is a finding.\n\n\n\nThis rule checks that Filestream SQL specific option is disabled.\n\nSELECT CASE \n        WHEN EXISTS (SELECT * \n                     FROM sys.configurations \n                     WHERE Name = 'filestream access level' \n                            AND Cast(value AS INT) = 0) THEN 'No' \n        ELSE 'Yes'\n      END AS TSQLFileStreamAccess;\n\nIf the above query returns \"Yes\" in the \"FileStreamEnabled\" field, this is a finding.","fixText":"Disable the use of Filestream.\n\n1. Delete all FILESTREAM columns from all tables. ALTER TABLE <name> DROP COLUMN <column name>\n2. Disassociate tables from the FILESTREAM filegroups. ALTER TABLE <name> SET (FILESTREAM_ON = 'NULL'\n3. Remove all FILESTREAM data containers. ALTER DATABASE <name> REMOVE FILE <file name>\n4. Remove all FILESTREAM filegroups. ALTER DATABASE <name> REMOVE FILEGROUP <file name>.\n5. Disable FILESTREAM.\nEXEC sp_configure filestream_access_level, 0 \n    RECONFIGURE \n6. Restart the SQL Service","ccis":["CCI-000381"]},{"vulnId":"V-214035","ruleId":"SV-214035r960963_rule","severity":"medium","ruleTitle":"Ole Automation Procedures feature must be disabled, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n\nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. \n\nApplications must adhere to the principles of least functionality by providing only essential capabilities.\n\nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system.\n\nSQL Server is capable of providing a wide range of features and services. Some of the features and services, provided by default, may not be necessary, and enabling them could adversely affect the security of the system.\n\nThe Ole Automation Procedures option controls whether OLE Automation objects can be instantiated within Transact-SQL batches. These are extended stored procedures that allow SQL Server users to execute functions external to SQL Server in the security context of SQL Server.\n\nThe Ole Automation Procedures extended stored procedure allows execution of host executables outside the controls of database access permissions. This access may be exploited by malicious users who have compromised the integrity of the SQL Server database process to control the host operating system to perpetrate additional malicious activity.","checkContent":"To determine if \"Ole Automation Procedures\" option is enabled, execute the following query: \n\nEXEC SP_CONFIGURE 'show advanced options', '1'; \nRECONFIGURE WITH OVERRIDE; \nEXEC SP_CONFIGURE 'Ole Automation Procedures'; \n\nIf the value of \"config_value\" is \"0\", this is not a finding. \n\nIf 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.","fixText":"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: \n\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'Ole Automation Procedures', 0;  \nGO  \nRECONFIGURE;  \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214036","ruleId":"SV-214036r960963_rule","severity":"medium","ruleTitle":"SQL Server User Options feature must be disabled, unless specifically required and approved.","description":"SQL Server is capable of providing a wide range of features and services. Some of the features and services, provided by default, may not be necessary, and enabling them could adversely affect the security of the system.\n\nThe user options option specifies global defaults for all users. A list of default query processing options is established for the duration of a user's work session. The user options option allows you to change the default values of the SET options (if the server's default settings are not appropriate).","checkContent":"To determine if \"User Options\" option is enabled, execute the following query:\n\nEXEC SP_CONFIGURE 'show advanced options', '1'; \nRECONFIGURE WITH OVERRIDE; \nEXEC SP_CONFIGURE 'user options'; \n\nIf the value of \"config_value\" is \"0\", this is not a finding. \n\nIf 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.","fixText":"Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of \"User Options\" option, from the query prompt: \n\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'user options', 0;  \nGO  \nRECONFIGURE;  \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214037","ruleId":"SV-214037r960963_rule","severity":"medium","ruleTitle":"Remote Access feature must be disabled, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n\nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. \n\nApplications must adhere to the principles of least functionality by providing only essential capabilities.\n\nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system.\n\nSQL Server is capable of providing a wide range of features and services. Some of the features and services, provided by default, may not be necessary, and enabling them could adversely affect the security of the system.\n\nThe Remote Access option controls the execution of local stored procedures on remote servers or remote stored procedures on local server.  'Remote access' functionality can be abused to launch a Denial-of-Service (DoS) attack on remote servers by off-loading query processing to a target.","checkContent":"To determine if \"Remote Access\" option is enabled, execute the following query: \n\nEXEC SP_CONFIGURE 'show advanced options', '1'; \nRECONFIGURE WITH OVERRIDE; \nEXEC SP_CONFIGURE 'remote access'; \n\nIf the value of \"config_value\" is \"0\", this is not a finding. \n\nIf the value of \"config_value\" is \"1\", review the system documentation to determine whether the use of \"Remote Access\" is required (linked servers) and authorized. If it is not authorized, this is a finding.","fixText":"Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of \"Remote Access\" option, from the query prompt: \n\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'remote access', 0;  \nGO  \nRECONFIGURE;  \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214038","ruleId":"SV-214038r960963_rule","severity":"medium","ruleTitle":"Hadoop Connectivity feature must be disabled, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n\nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. \n\nApplications must adhere to the principles of least functionality by providing only essential capabilities.\n\nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system.\n\nSQL Server is capable of providing a wide range of features and services. Some of the features and services, provided by default, may not be necessary, and enabling them could adversely affect the security of the system.\n\nThe Hadoop Connectivity feature allows multiple types of external data sources to be created and used across all sessions on the server.  An exploit to the SQL Server instance could result in a compromise of the host system and external SQL Server resources.","checkContent":"To determine if \"Hadoop Connectivity\" option is enabled, execute the following query: \n\nEXEC SP_CONFIGURE 'show advanced options', '1'; \nRECONFIGURE WITH OVERRIDE; \nEXEC SP_CONFIGURE 'hadoop connectivity'; \n\nIf the value of \"config_value\" is \"0\", this is not a finding.\n\nIf the value of \"config_value\" is \"1\", review the system documentation to determine whether the use of \"Hadoop Connectivity\" option is required and authorized. If it is not authorized, this is a finding.","fixText":"Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of \"Hadoop Connectivity\" option, from the query prompt: \n\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'hadoop connectivity', 0;  \nGO  \nRECONFIGURE;  \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214039","ruleId":"SV-214039r960963_rule","severity":"medium","ruleTitle":"Allow Polybase Export feature must be disabled, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n\nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. \n\nApplications must adhere to the principles of least functionality by providing only essential capabilities.\n\nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system.\n\nSQL Server is capable of providing a wide range of features and services. Some of the features and services, provided by default, may not be necessary, and enabling them could adversely affect the security of the system.\n\nThe Allow Polybase Export feature allows an export of data to an external data source such as Hadoop File System or Azure Data Lake. An exploit to the SQL Server instance could result in a compromise of the host system and external SQL Server resources.","checkContent":"To determine if \"Allow Polybase Export\" option is enabled, execute the following query: \n\nEXEC SP_CONFIGURE 'show advanced options', '1'; \nRECONFIGURE WITH OVERRIDE; \nEXEC SP_CONFIGURE 'allow polybase export'; \n\nIf the value of \"config_value\" is \"0\", this is not a finding.\n\nIf the value of \"config_value\" is \"1\", review the system documentation to determine whether the use of \"Allow Polybase Export\" is required and authorized. If it is not authorized, this is a finding.","fixText":"Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of \"Allow Polybase Export\" option, from the query prompt: \n\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'allow polybase export', 0;  \nGO  \nRECONFIGURE;  \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214040","ruleId":"SV-214040r960963_rule","severity":"medium","ruleTitle":"Remote Data Archive feature must be disabled, unless specifically required and approved.","description":"Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). \n\nIt is detrimental for applications to provide, or install by default, functionality exceeding requirements or mission objectives. \n\nApplications must adhere to the principles of least functionality by providing only essential capabilities.\n\nSQL Server may spawn additional external processes to execute procedures that are defined in the SQL Server but stored in external host files (external procedures). The spawned process used to execute the external procedure may operate within a different OS security context than SQL Server and provide unauthorized access to the host system.\n\nSQL Server is capable of providing a wide range of features and services. Some of the features and services, provided by default, may not be necessary, and enabling them could adversely affect the security of the system.\n\nThe Remote Data Archive feature allows an export of local SQL Server data to an Azure SQL Database. An exploit to the SQL Server instance could result in a compromise of the host system and external SQL Server resources.","checkContent":"To determine if \"Remote Data Archive\" option is enabled, execute the following query: \n\nEXEC SP_CONFIGURE 'show advanced options', '1'; \nRECONFIGURE WITH OVERRIDE; \nEXEC SP_CONFIGURE 'remote data archive'; \n\nIf the value of \"config_value\" is \"0\", this is not a finding. \n\nIf the value of \"config_value\" is \"1\", review the system documentation to determine whether the use of \"Remote Data Archive\" is required and authorized. If it is not authorized, this is a finding.","fixText":"Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of \"Remote Data Archive\" option, from the query prompt: \n\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'remote data archive', 0;  \nGO  \nRECONFIGURE;  \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214041","ruleId":"SV-214041r960963_rule","severity":"medium","ruleTitle":"SQL Server External Scripts Enabled feature must be disabled, unless specifically required and approved.","description":"SQL Server is capable of providing a wide range of features and services. Some of the features and services, provided by default, may not be necessary, and enabling them could adversely affect the security of the system.\n\nThe External Scripts Enabled feature allows scripts external to SQL such as files located in an R library to be executed.","checkContent":"To determine if \"External Scripts Enabled\" option is enabled, execute the following query: \n\nEXEC SP_CONFIGURE 'show advanced options', '1'; \nRECONFIGURE WITH OVERRIDE; \nEXEC SP_CONFIGURE 'external scripts enabled'; \n\nIf the value of \"config_value\" is \"0\", this is not a finding. \n\nIf the value of \"config_value\" is \"1\", review the system documentation to determine whether the use of \"External Scripts Enabled\" is required and authorized. If it is not authorized, this is a finding.","fixText":"Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of \"External Scripts Enabled\" option, from the query prompt: \n\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'external scripts enabled', 0;  \nGO  \nRECONFIGURE;  \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214042","ruleId":"SV-214042r961863_rule","severity":"low","ruleTitle":"The SQL Server Browser service must be disabled unless specifically required and approved.","description":"The SQL Server Browser simplifies the administration of SQL Server, particularly when multiple instances of SQL Server coexist on the same computer. It avoids the need to hard-assign port numbers to the instances and to set and maintain those port numbers in client systems. It enables administrators and authorized users to discover database management system instances, and the databases they support, over the network. SQL Server uses the SQL Server Browser service to enumerate instances of the Database Engine installed on the computer. This enables client applications to browse for a server, and helps clients distinguish between multiple instances of the Database Engine on the same computer.\n\nThis convenience also presents the possibility of unauthorized individuals gaining knowledge of the available SQL Server resources. Therefore, it is necessary to consider whether the SQL Server Browser is needed. Typically, if only a single instance is installed, using the default name (MSSQLSERVER) and port assignment (1433), the Browser is not adding any value. The more complex the installation, the more likely SQL Server Browser is to be helpful. \n\nThis requirement is not intended to prohibit use of the Browser service in any circumstances.  It calls for administrators and management to consider whether the benefits of its use outweigh the potential negative consequences of it being used by an attacker to browse the current infrastructure and retrieve a list of running SQL Server instances.","checkContent":"If the need for the SQL Server Browser service is documented and authorized, this is not a finding. \n\nOpen the Services tool. \n\nEither navigate, via the Windows Start Menu and/or Control Panel, to \"Administrative Tools\", and select \"Services\"; or at a command prompt, type \"services.msc\" and press the \"Enter\" key. \n\nScroll to \"SQL Server Browser\". \n\nIf its Startup Type is not shown as \"Disabled\", this is a finding.","fixText":"If SQL Server Browser is needed, document the justification and obtain the appropriate authorization. \n\nWhere SQL Server Browser is judged unnecessary, the Service can be disabled. \n\nTo disable, in the Services tool, double-click \"SQL Server Browser\". Set \"Startup Type\" to \"Disabled\". If \"Service Status\" is \"Running\", click on \"Stop\". Click on \"OK\".","ccis":["CCI-000366"]},{"vulnId":"V-214043","ruleId":"SV-214043r960963_rule","severity":"medium","ruleTitle":"SQL Server Replication Xps feature must be disabled, unless specifically required and approved.","description":"SQL Server is capable of providing a wide range of features and services. Some of the features and services, provided by default, may not be necessary, and enabling them could adversely affect the security of the system.\n\nEnabling the replication XPs opens a significant attack surface area that can be used by an attacker to gather information about the system and potentially abuse the privileges of SQL Server.","checkContent":"To determine if the \"Replication Xps\" option is enabled, execute the following query: \n\nEXEC SP_CONFIGURE 'show advanced options', '1'; \nRECONFIGURE WITH OVERRIDE; \nEXEC SP_CONFIGURE 'replication xps'; \n\nIf the value of \"config_value\" is \"0\", this is not a finding. \n\nIf the value of \"config_value\" is \"1\", review the system documentation to determine whether the use of \"Replication Xps\" is required and authorized. If it is not authorized, this is a finding.","fixText":"Disable use of or remove any external application executable object definitions that are not authorized. To disable the use of \"Replication Xps\" option, from the query prompt: \n\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'replication xps', 0;  \nGO  \nRECONFIGURE;  \nGO","ccis":["CCI-000381"]},{"vulnId":"V-214044","ruleId":"SV-214044r961863_rule","severity":"low","ruleTitle":"If the SQL Server Browser Service is specifically required and approved, SQL instances must be hidden.","description":"The SQL Server Browser simplifies the administration of SQL Server, particularly when multiple instances of SQL Server coexist on the same computer. It avoids the need to hard-assign port numbers to the instances and to set and maintain those port numbers in client systems. It enables administrators and authorized users to discover database management system instances, and the databases they support, over the network. SQL Server uses the SQL Server Browser service to enumerate instances of the Database Engine installed on the computer. This enables client applications to browse for a server, and helps clients distinguish between multiple instances of the Database Engine on the same computer.\n\nThis convenience also presents the possibility of unauthorized individuals gaining knowledge of the available SQL Server resources. Therefore, it is necessary to consider whether the SQL Server Browser is needed. Typically, if only a single instance is installed, using the default name (MSSQLSERVER) and port assignment (1433), the Browser is not adding any value. The more complex the installation, the more likely SQL Server Browser is to be helpful. \n\nThis requirement is not intended to prohibit use of the Browser service in any circumstances.  It calls for administrators and management to consider whether the benefits of its use outweigh the potential negative consequences of it being used by an attacker to browse the current infrastructure and retrieve a list of running SQL Server instances.  In order to prevent this, the SQL instance(s) can be hidden.","checkContent":"If the need for the SQL Server Browser service is documented and authorized, check to make sure the SQL Instances that do not require use of the SQL Browser Service are hidden with the following query: \n\nDECLARE @HiddenInstance INT \nEXEC master.dbo.Xp_instance_regread \n N'HKEY_LOCAL_MACHINE', \n N'Software\\Microsoft\\MSSQLServer\\MSSQLServer\\SuperSocketNetLib', \n N'HideInstance', \n @HiddenInstance output \n\nSELECT CASE \n        WHEN @HiddenInstance = 0 \n             AND Serverproperty('IsClustered') = 0 THEN 'No' \n        ELSE 'Yes' \n      END AS [Hidden]\n\nIf the value of \"Hidden\" is \"Yes\", this is not a finding.\n\nIf the value of \"Hidden\" is \"No\" and the startup type of the \"SQL Server Browser\" service is not \"Disabled\", this is a finding.","fixText":"If SQL Server Browser is needed, document the justification and obtain the appropriate authorization. \n\nTo hide the SQL instance, in SQL Server Configuration Manager, expand SQL Server Network Configuration, right-click Protocols for <server instance>, select \"Properties\", on the \"Flags\" tab, select \"Yes\" in the \"HideInstance\" box, then click \"OK\".  The change takes effect immediately for new connections.","ccis":["CCI-000366"]},{"vulnId":"V-214045","ruleId":"SV-214045r961047_rule","severity":"high","ruleTitle":"When using command-line tools such as SQLCMD in a mixed-mode authentication environment, users must use a logon method that does not expose the password.","description":"To prevent the compromise of authentication information, such as passwords and PINs, during the authentication process, the feedback from the information system must not provide any information that would allow an unauthorized user to compromise the authentication mechanism.\n\nObfuscation of user-provided information when typed into the system is a method used in addressing this risk.\n\nFor example, displaying asterisks when a user types in a password or PIN, is an example of obscuring feedback of authentication information.\n\nThis requirement is applicable when mixed-mode authentication is enabled.  When this is the case, password-authenticated accounts can be created in and authenticated by SQL Server.  Other STIG requirements prohibit the use of mixed-mode authentication except when justified and approved.  This deals with the exceptions.\n\nSQLCMD and other command-line tools are part of any SQL Server installation. These tools can accept a plain-text password, but do offer alternative techniques. Since the typical user of these tools is a database administrator, the consequences of password compromise are particularly serious. Therefore, the use of plain-text passwords must be prohibited, as a matter of practice and procedure.","checkContent":"Run this query to determine whether SQL Server authentication is enabled:\nEXEC master.sys.xp_loginconfig 'login mode'; \n\nIf the config_value returned is \"Windows NT Authentication\", this is not a finding.\n\nFor 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 AO approval has been obtained; if not, this is a finding.\n\nRequest evidence that all users of the tool are trained in the importance of not using the plain-text password option and in how to keep the password hidden; and that they adhere to this practice; if not, this is a finding.","fixText":"Where possible, change the login mode to Windows-only:\nUSE [master]\nGO\nEXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\\Microsoft\\MSSQLServer\\MSSQLServer', N'LoginMode', REG_DWORD, 1;\nGO\n\nIf 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:\n1) Document the need for it, who uses it, and any relevant mitigations, and obtain AO approval.\n2) 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.","ccis":["CCI-000206"]},{"vulnId":"V-214046","ruleId":"SV-214046r961047_rule","severity":"high","ruleTitle":"Applications must obscure feedback of authentication information during the authentication process to protect the information from possible exploitation/use by unauthorized individuals.","description":"To prevent the compromise of authentication information, such as passwords and PINs, during the authentication process, the feedback from the information system must not provide any information that would allow an unauthorized user to compromise the authentication mechanism.\n\nObfuscation of user-provided information when typed into the system is a method used in addressing this risk.\n\nFor example, displaying asterisks when a user types in a password or PIN, is an example of obscuring feedback of authentication information.\n\nDatabase applications may allow for entry of the account name and password as a visible parameter of the application execution command. This practice must be prohibited and disabled to prevent shoulder surfing.","checkContent":"Determine whether any applications that access the database allow for entry of the account name and password, or PIN.\n\nIf any do, determine whether these applications obfuscate authentication data; if they do not, this is a finding.","fixText":"Configure or modify applications to prohibit display of passwords in clear text.","ccis":["CCI-000206"]},{"vulnId":"V-265870","ruleId":"SV-265870r1138543_rule","severity":"high","ruleTitle":"Microsoft SQL Server products must be a version supported by the vendor.","description":"Unsupported commercial and database systems should not be used because fixes to newly identified bugs will not be implemented by the vendor. The lack of support can result in potential vulnerabilities.\n\nSystems at unsupported servicing levels or releases will not receive security updates for new vulnerabilities, which leaves them subject to exploitation.\n\nWhen maintenance updates and patches are no longer available, the database software is no longer considered supported and should be upgraded or decommissioned.","checkContent":"Review the system documentation and interview the database administrator.\n\nIdentify all database software components.\n\nReview the version and release information.\n\nVerify the SQL Server version via one of the following methods: \nConnect 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, together with the user name that is used to connect to the specific instance of SQL Server.\n\nOr, from SQL Server Management Studio:\n\nSELECT @@VERSION;\n\nMore information for finding the version is available at the following link:\nhttps://learn.microsoft.com/en-us/troubleshoot/sql/releases/find-my-sql-version\n\nAccess the vendor website or use other means to verify the version is still supported.\nhttps://learn.microsoft.com/en-us/lifecycle/products/sql-server-2016\n\nIf the installed version or any of the software components are not supported by the vendor, this is a finding.","fixText":"Remove or decommission all unsupported software products.\n\nUpgrade unsupported DBMS or unsupported components to a supported version of the product.","ccis":["CCI-003376"]}]}