Overview:
Title: The DBMS must recognize only system-generated session identifiers.
Vulnerability ID: V-32526
STIG ID: SRG-APP-000223-DB-000168
IA Controls: None
Severity: High
Description: This requirement focuses on communications protection at the application session, versus network packet level. The intent of this control is to establish grounds for confidence at each end of a communications session in the ongoing identity of the other party and in the validity of the information being transmitted. Unique session IDs are the opposite of sequentially generated session IDs which can be easily guessed by an attacker. Unique session identifiers help to reduce predictability of said identifiers. Unique session IDs address man-in-the-middle attacks including session hijacking or insertion of false information into a session. If the attacker is unable to identify or guess the session information related to pending application traffic, they will have more difficulty in hijacking the session or otherwise manipulating valid sessions. The DBMS must only recognize only system generated session identifiers. If an attacker was able to generate a session with a non-system generated session identifier and have it be recognized by the system, the attacker could potentially gain access to the system without passing through access controls designed to limit database sessions to authorized users.
Check Text: Review DBMS settings and vendor documentation to determine whether the DBMS will recognize session identifiers that are not system generated. If the DBMS will recognize session identifiers that are not system generated, this is a finding.
Fix Text: Utilize a DBMS product that will only recognize session identifiers that are system generated.
Interpreting V-32526:
SQL Server is a DBMS product that only recognizes session identifiers that are system generated.
In SQl Server sessions ids can be identified through the DMV sys.dm_exec_sessions. This DMV returns one row per authenticated session on SQL Server. The DMV is a server-scope view that shows information about all active user connections as well as internal tasks. In general any session ID that is less than 50 is considered a system sessions, but a more reliable check is the value of is_user_process in the DMV. This will identify any outlying system sessions that may have a value greater than 50.
You can use the following query to filter the SQL Server DMV to show just the active server sessions. There is a lot of detailed information returned for each sessions, including the host name, client net address, login name and the program name being executed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | SELECT S.SESSION_ID , S.STATUS , S.HOST_NAME , C.CLIENT_NET_ADDRESS , CASE WHEN S.LOGIN_NAME = S.ORIGINAL_LOGIN_NAME THEN S.LOGIN_NAME ELSE S.LOGIN_NAME + ' (' + S.ORIGINAL_LOGIN_NAME + ')' END AS LOGIN_NAME , S.PROGRAM_NAME , C.CONNECT_TIME , -- DIFFRENT BETWEEN CONNECT & LOGIN TIME IS TIME TAKEN BY PRELOGON ACTIVITIES S.LOGIN_TIME , CASE S.TRANSACTION_ISOLATION_LEVEL WHEN 0 THEN 'UNSPECIFIED' WHEN 1 THEN 'READUNCOMITTED' WHEN 2 THEN 'READCOMMITTED' WHEN 3 THEN 'REPEATABLE' WHEN 4 THEN 'SERIALIZABLE' WHEN 5 THEN 'SNAPSHOT' ELSE CAST(S.TRANSACTION_ISOLATION_LEVEL AS VARCHAR(32)) END AS TRANSACTION_ISOLATION_LEVEL_NAME , S.LAST_SUCCESSFUL_LOGON , -- REQUIRES 'COMMON CRITERIA COMPLIANCE ENABLED' OPTION VIA SP_CONFIGURE. S.LAST_UNSUCCESSFUL_LOGON , -- REQUIRES 'COMMON CRITERIA COMPLIANCE ENABLED' OPTION VIA SP_CONFIGURE. S.UNSUCCESSFUL_LOGONS , --REQUIRES 'COMMON CRITERIA COMPLIANCE ENABLED' OPTION VIA SP_CONFIGURE. S.CPU_TIME AS CPU_TIME_MS , S.MEMORY_USAGE AS MEMORY_USAGE_PAGES , S.ROW_COUNT , S.PREV_ERROR , S.LAST_REQUEST_START_TIME , S.LAST_REQUEST_END_TIME , C.NET_TRANSPORT , C.PROTOCOL_TYPE , S.LANGUAGE , S.DATE_FORMAT , ST.TEXT AS QUERY_TEXT FROM SYS.DM_EXEC_SESSIONS S FULL OUTER JOIN SYS.DM_EXEC_CONNECTIONS C ON C.SESSION_ID = S.SESSION_ID CROSS APPLY SYS.DM_EXEC_SQL_TEXT(C.MOST_RECENT_SQL_HANDLE) ST WHERE S.SESSION_ID IS NULL OR S.is_user_process = 0 -- Yu can change this value to 1 to show all user sessions ORDER BY S.SESSION_ID |
Return to the DoD STIGs – Database Security Requirements Guide