SV-235158r638812_rule
V-235158
SRG-APP-000251-DB-000392
MYS8-00-007500
CAT II
10
Where dynamic code execution is used, modify the code to implement protections against code injection.
Enable the MySQL Enterprise Firewall by running this script, which is located in the mysql home share sub directory.
mysql -u root -p mysql < linux_install_firewall.sql
Train the firewall for users where dynamic code injection is possible, for examples applications that allow user input.
CALL mysql.sp_set_firewall_mode('fwuser@localhost', 'RECORDING');
Once the allowlist for the user/host has been captured, the firewall can be placed in PROTECTING (active blocking) or DETECTING(logging) mode.
CALL mysql.sp_set_firewall_mode('fwuser@localhost', 'PROTECTING');
CALL mysql.sp_set_firewall_mode('fwuser@localhost', 'DETECTING');
Review MySQL Database Server 8.0 source code (stored procedures, functions, and triggers) and application source code to identify cases of dynamic code execution.
Determine if the MySQL Enterprise Firewall is installed and trained to recognize normal behavior and block or alert of abnormal requests. Run the following command:
SHOW GLOBAL VARIABLES LIKE 'mysql_firewall_mode';
Review firewall users and Mode.
SELECT * FROM INFORMATION_SCHEMA.MYSQL_FIREWALL_USERS;
If no rows are returned and no firewall allow lists are active, this is a finding.
If LEARNING is returned, the firewall is building an allow list for the userhost user.
If PROTECTING is returned, the firewall will only permit SQL on the allow list for the userhost user to execute.
If DETECTING is returned, the firewall will write to the firewall log SQL not on the allow list for the userhost user to execute.
If dynamic code execution is employed without protective measures against code injection, this is a finding.
V-235158
False
MYS8-00-007500
Review MySQL Database Server 8.0 source code (stored procedures, functions, and triggers) and application source code to identify cases of dynamic code execution.
Determine if the MySQL Enterprise Firewall is installed and trained to recognize normal behavior and block or alert of abnormal requests. Run the following command:
SHOW GLOBAL VARIABLES LIKE 'mysql_firewall_mode';
Review firewall users and Mode.
SELECT * FROM INFORMATION_SCHEMA.MYSQL_FIREWALL_USERS;
If no rows are returned and no firewall allow lists are active, this is a finding.
If LEARNING is returned, the firewall is building an allow list for the userhost user.
If PROTECTING is returned, the firewall will only permit SQL on the allow list for the userhost user to execute.
If DETECTING is returned, the firewall will write to the firewall log SQL not on the allow list for the userhost user to execute.
If dynamic code execution is employed without protective measures against code injection, this is a finding.
M
5277