Rule ID
SV-289280r1319183_rule
Version
V1R1
CCIs
Without tracking privileged activity, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. System documentation should include a definition of the functionality considered privileged. A 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 DENY There may also be Data Manipulation Language (DML) statements that, subject to context, should be regarded as privileged. Possible examples in SQL include: TRUNCATE TABLE; DELETE, or DELETE affecting more than n rows, for some n, or DELETE without a WHERE clause; UPDATE or UPDATE affecting more than n rows, for some n, or UPDATE without a WHERE clause; Any "SELECT", "INSERT", "UPDATE", or "DELETE" to an application-defined security table executed by other than a security principal. Depending on the capabilities of the database management system (DBMS) 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. Note that it is particularly important to audit, and tightly control, any action that weakens the implementation of this requirement itself, since the objective is to have a complete audit trail of all administrative activity.
Review the system documentation to determine if MySQL Server is required to audit for all privileged activities or other system-level access. 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. Determine if rules are in place to capture the following types of commands related to permissions by running: SELECT * FROM mysql.audit_log_filter; If the template SQL filter was used, it will have the name "log_stig". Review the filter values. Ensure filters for events based on the "general_sql_command.str" field capture the following SQL statement types: grant grant_roles revoke revoke_all revoke_roles drop_role alter_user_default_role create_role set_role create_user alter_user drop_user rename_user show_create_user
Configure the MySQL Database Server to audit all privileged activities or other system-level access.
Modify the existing audit filter to include the required privileged operations, or create an audit filter for these events.
For example, the following creates a filter named "log_stig" that records the privileged account and role management operations required by this check:
SET @filter = '{
"filter": {
"class": {
"name": "general",
"event": {
"name": "status",
"log": {
"or": [
{ "field": { "name": "general_sql_command.str", "value": "grant" } },
{ "field": { "name": "general_sql_command.str", "value": "grant_roles" } },
{ "field": { "name": "general_sql_command.str", "value": "revoke" } },
{ "field": { "name": "general_sql_command.str", "value": "revoke_all" } },
{ "field": { "name": "general_sql_command.str", "value": "revoke_roles" } },
{ "field": { "name": "general_sql_command.str", "value": "create_role" } },
{ "field": { "name": "general_sql_command.str", "value": "drop_role" } },
{ "field": { "name": "general_sql_command.str", "value": "set_role" } },
{ "field": { "name": "general_sql_command.str", "value": "create_user" } },
{ "field": { "name": "general_sql_command.str", "value": "alter_user" } },
{ "field": { "name": "general_sql_command.str", "value": "alter_user_default_role" } },
{ "field": { "name": "general_sql_command.str", "value": "drop_user" } },
{ "field": { "name": "general_sql_command.str", "value": "rename_user" } },
{ "field": { "name": "general_sql_command.str", "value": "show_create_user" } }
]
}
}
}
}
}';
SELECT audit_log_filter_set_filter('log_stig', @filter);
Assign the filter to the applicable MySQL account:
SELECT audit_log_filter_set_user(
'<user>@<host>',
'log_stig'
);
If the filter is intended to apply as the default to accounts without a specific filter assignment, use "%" as the account:
SELECT audit_log_filter_set_user('%', 'log_stig');
Do not replace an existing audit filter that records additional events required by the organization. Instead, incorporate these privileged operation rules into the existing audit policy as appropriate.
Refer to the MySQL Reference Manual, Audit Log Component Filtering, and Writing Audit Log Component Filter Definitions, for additional configuration information.