STIGhubSTIGhub
STIGhub— A free STIG search and compliance tool·STIGs updated 1 hour ago
Powered by Pylon·Privacy·Terms·Feedback·© 2026 Beacon Cloud Solutions, Inc.
← Back to Oracle MySQL 9.x Security Technical Implementation Guide

V-289282

CAT II (Medium)

The MySQL Database Server 9.x must generate audit records showing starting and ending time for user access to the database(s).

Rule ID

SV-289282r1319414_rule

STIG

Oracle MySQL 9.x Security Technical Implementation Guide

Version

V1R1

CCIs

CCI-000172

Discussion

For completeness of forensic analysis, it is necessary to know how long a user's (or other principal's) connection to the database management system (DBMS) lasts. This can be achieved by recording disconnections, in addition to logons/connections, in the audit logs. Disconnection may be initiated by the user or forced by the system (as in a timeout) or result from a system or network failure. To the greatest extent possible, all disconnections must be logged.

Check Content

Verify the MySQL Enterprise Audit component is installed:
SELECT *
FROM mysql.component
WHERE component_urn = 'file://component_audit_log';

If no row is returned, this is a finding.

Verify audit logging has not been disabled:
SHOW GLOBAL VARIABLES LIKE 'audit_log.disable';

If "audit_log.disable" is "ON", this is a finding.

Review audit filters and associated users by running the following queries:
SELECT `audit_log_filter`.`NAME`,
   `audit_log_filter`.`FILTER`
FROM `mysql`.`audit_log_filter`;

SELECT `audit_log_user`.`USER`,
   `audit_log_user`.`HOST`,
   `audit_log_user`.`FILTERNAME`
FROM `mysql`.`audit_log_user`;

All currently defined audits for the MySQL server instance will be listed. If no audits are returned, this is a finding.

To check if the audit filters that are in place are generating records when successful logons or connections occur, log in to MySQL and then log out. 

Below is an example using MySQL Shell:
% mysqlsh —sql
 MySQL  SQL > \connect newuser@localhost
Creating a session to 'newuser@localhost'
 MySQL  localhost:33060+ ssl  SQL > \quit
Bye!

Review the audit log by running the Linux command:
sudo cat  <directory where audit log files are located>/audit.log | egrep  "\"event\": \"connect\""

Note:
- A "status" of "0" for each indicates successful.
- A "connection_id" of "19" is the same as the connections process ID and there will be a matching disconnect event with the same "connection_id" number. This can be used to differentiate multiple connections using the same login.
- Each connect and disconnect has a time stamp tag with the time in Coordinated Universal Time (UTC).

For example, if the values returned by the configured "audit_log.file" and "datadir" values are "/usr/local/mysql/data/" and "audit.log", run:
sudo cat  /usr/local/mysql/data/audit.log |egrep "\"event\": \"connect\""

The audit data will look similar to the examples below:

Logging in - connecting:
{ "timestamp": "2020-08-21 17:47:09", "id": 0, "class": "connection", "event": "connect", "connection_id": 19, "account": { "user": "newuser", "host": "localhost" }, "login": { "user": "newuser", "os": "", "ip": "::1", "proxy": "" }, "connection_data": { "connection_type": "plugin", "status": 0, "db": "" } },

Logging out - disconnecting:
sudo cat  <directory where audit log files are located>/audit.log | egrep  "\"event\": \"disconnect\""

{ "timestamp": "2020-08-21 17:47:11", "id": 1, "class": "connection", "event": "disconnect", "connection_id": 19, "account": { "user": "newuser", "host": "localhost" }, "login": { "user": "newuser", "os": "", "ip": "::1", "proxy": "" }, "connection_data": { "connection_type": "plugin" } },

Fix Text

If currently required, configure the MySQL Database Server to produce audit records when successful logons or connections occur.

Refer to the following link for more information: https://dev.mysql.com/doc/refman/9.7/en/audit-log-component.html.