SQL6-D0-003600 - SQL Server must limit the number of concurrent sessions to an organization-defined number per user for all accounts and/or account types.

Information

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 per user is helpful in reducing these risks.

This requirement addresses concurrent session control for a single account. It does not address concurrent sessions by a single user via multiple system accounts; and it does not deal with the total number of sessions across all accounts.

The 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.

The 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.

(Sessions may also be referred to as connections or logons, which for the purposes of this requirement are synonyms.)

NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance.

Solution

Establish the limit(s) appropriate to the type(s) of user account accessing the SQL Server instance, and record them in the system documentation. Implement one or more logon triggers to enforce the limit(s), without exposing the dynamic management views to general users.

Example script below:

CREATE TRIGGER SQL_STIG_Connection_Limit
ON ALL SERVER WITH EXECUTE AS 'renamed_sa' /*Make sure to use the renamed SA account here*/
FOR LOGON
AS
BEGIN
If (Select COUNT(1) from sys.dm_exec_sessions WHERE is_user_process = 1 AND original_login_name = ORIGINAL_LOGIN() ) >
(CASE ORIGINAL_LOGIN()
WHEN 'renamed_sa' THEN 40 /*i.e. the renamed system administrator SQL Login can have up to 40 concurrent logins... */
WHEN 'domain\ima.dba' THEN 150 /*this is a busy DBA's domain account */
WHEN 'application1_login' THEN 6 /* this is a SQL login for an application */
WHEN 'application2_login' THEN 20 /* this is a SQL login for another application */
...
ELSE 1 /* All unspecified users are restricted to a single login */
END)
BEGIN
PRINT 'The login [' + ORIGINAL_LOGIN() + '] has exceeded its concurrent session limit.'
ROLLBACK;
END
END;

Reference: https://msdn.microsoft.com/en-us/library/ms189799.aspx

See Also

https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_MS_SQL_Server_2016_Y24M07_STIG.zip

Item Details

Category: ACCESS CONTROL

References: 800-53|AC-10, CAT|II, CCI|CCI-000054, Rule-ID|SV-213929r960735_rule, STIG-ID|SQL6-D0-003600, STIG-Legacy|SV-93825, STIG-Legacy|V-79119, Vuln-ID|V-213929

Plugin: MS_SQLDB

Control ID: 8dad2a957e092526818c8a33308cdbd009f7714724dee06794186c4502001631