MADB-10-006300 - MariaDB must provide logout functionality to allow the user to manually terminate a session initiated by that user.

Information

If a user cannot explicitly end a DBMS session, the session may remain open and be exploited by an attacker; this is referred to as a zombie session.

Such logout may be explicit or implicit. Examples of explicit are clicking on a Log Out link or button in the application window; clicking the Windows Start button and selecting Log Out or Shut Down. Examples of implicit logout are closing the application's (main) window and powering off the workstation without invoking the OS shutdown.

Both the explicit and implicit logouts must be detected by the DBMS.

In all cases, the DBMS must ensure that the user's DBMS session and all processes owned by the session are terminated.

This should not, however, interfere with batch processes/jobs initiated by the user during his/her online session; these should be permitted to run to completion.

As a good programming practice, all applications should close the database connection when they finish using the resource. MariaDB will close the session when the connection is closed and release all resources associated with the session. If the connection cannot be closed, MariaDB has the five global variables to allow timeouts to occur and automatically close the connection and release all associated resources.

NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance.

Solution

As an authorized user locate the session to be terminated and terminate that session.

To locate a session and terminate the session follow the following steps:

1. Connect to the MariaDB database using an authorized user:

mariadb -u admin_user -p

2. At the MariaDB prompt run either of the following commands:

MariaDB> SHOW PROCESSLIST;
MariaDB> SELECT id, user, host, db, command, time, state, info, progress FROM information_schema.processlist;

3. Identify the session to be terminated and issue kill process number from display. (**This will kill the session.**) Example:

MariaDB> KILL 192;

4. A kill query process number can be issued from display. (**This will kill the active query but leave the session active for run-away queries. **)

Configure MariaDB to automatically terminate a user session based on security procedures requirements regarding conditions or trigger events that require session termination.

To change the values of the following timeout variables to conform to organization-defined values for triggering conditions or events requiring session termination, select the appropriate variable to change as the database administrator.

As the administrator locate the MariaDB Enterprise Server configuration file to change. For Centos, RedHat, and similar distributions this will be in /etc/my.cnf.d/.

In the [mariadb] section add the lines:

interactive_timeout = value
wait_timeout = value
idle_transaction_timeout = value
idle_write_transaction_timeout = value
idle_readonly_transaction_timeout = value

Where value is in seconds and corresponds to the company defined value. Restart MariaDB Enterprise Server for these changes to take effect.

See Also

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

Item Details

Category: ACCESS CONTROL

References: 800-53|AC-12(1), CAT|II, CCI|CCI-002363, Rule-ID|SV-253718r961224_rule, STIG-ID|MADB-10-006300, Vuln-ID|V-253718

Plugin: MySQLDB

Control ID: 298e6c7737bf30d9c077b70d39940ebce54e543e179d858169f9a43753e606fd