Rule ID
SV-286226r1292161_rule
Version
V1R1
A common vulnerability is unplanned behavior when invalid inputs are received. This requirement guards against adverse or unintended system behavior caused by invalid inputs, where information system responses to the invalid input may be disruptive or cause the system to fail into an unsafe state. The behavior will be derived from the organizational and system requirements and includes, but is not limited to, notification of the appropriate personnel, creating an audit record, and rejecting invalid input. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the DBA is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed and must document what has been discovered. Satisfies: SRG-APP-000251-DB-000392, SRG-APP-000447-DB-000393
As the DBA (shown here as root), generate a SQL syntax error by running the following command: CREAT TABLE incorrect_syntax(id INT); ERROR 1064 (42000): An error in SQL syntax is returned. The message indicates the syntax error near 'CREAT TABLE incorrect_syntax(id INT)'. Verify the syntax error was logged (adjust the log file name and path as appropriate for the environment): $ sudo su - root $ cat $DATADIR/sql_errors.log Example log entry: YYYY-MM-DD HH:MM:SS root[root] @ localhost [] ERROR 1064: An error in SQL syntax near 'CREAT TABLE incorrect_syntax(id INT)' at line 1 Review the security guidance to determine how input errors from applications to MariaDB are required to be handled and whether special handling is defined for specific circumstances. If the system does not implement the documented behavior, this is a finding.
Verify the current SQL mode configuration: SHOW VARIABLES LIKE 'sql_mode'; Ensure that strict SQL modes are enabled to enforce predictable error handling. At a minimum, the following modes should be included: STRICT_TRANS_TABLES or STRICT_ALL_TABLES NO_ZERO_DATE NO_ZERO_IN_DATE ERROR_FOR_DIVISION_BY_ZERO If required modes are not enabled, edit the "mariadb-enterprise.cnf" configuration file located in "/etc/my.cnf.d/". [mariadb] sql_mode=STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO Restart the MariaDB service to apply changes: systemctl restart mariadb Validate that applications interacting with the database implement proper input validation and error handling consistent with organizational policies.