Rule ID
SV-289372r1319037_rule
Version
V1R1
CCIs
Individual authentication prior to shared group authentication mitigates the risk of using group accounts or authenticators.
Review the system documentation to identify:
- Individual users authorized to access MySQL.
- MySQL roles used to provide shared access to database resources.
- Any application, service, proxy, or other shared accounts.
- Any approved exceptions requiring use of a shared account.
Review MySQL accounts:
SELECT User, Host, plugin, account_locked
FROM mysql.user
ORDER BY User, Host;
MySQL authenticates a client against the selected MySQL account and its configured authentication method before granting access.
Verify that human users who access MySQL interactively use individually identifiable accounts or individually identifiable external authentication identities.
If multiple human users directly authenticate using the same MySQL user name and credentials, this is a finding unless the use is specifically approved and an organization-approved mechanism individually authenticates the users before access is granted.
Review role assignments:
SELECT
re.FROM_USER AS User,
re.FROM_HOST AS User_Host,
re.TO_USER AS Role,
re.TO_HOST AS Role_Host,
u.account_locked AS Role_Account_Locked
FROM mysql.role_edges AS re
LEFT JOIN mysql.user AS u
ON u.User = re.TO_USER
AND u.Host = re.TO_HOST
ORDER BY re.TO_USER, re.FROM_USER;
Verify that shared database privileges are assigned through roles to individually authenticated users where practical.
Verify that authorization identifiers intended solely to function as roles remain locked and cannot be used for direct authentication. MySQL roles are locked by default; a locked role cannot authenticate to the server.
For application, service, or other shared accounts, verify that:
- The account is not used as a shared interactive login by multiple human users.
- Human access to the associated application or resource requires individual authentication before the shared service account is used.
- Credentials for the shared account are not distributed to individual users.
- Use of the shared account is documented and approved.
If a user can obtain access to a shared MySQL account or shared database resource without first being individually authenticated, this is a finding.Configure MySQL so human users authenticate using individually identifiable accounts. Do not provide multiple human users with the credentials for a common MySQL login account. Where multiple users require the same database privileges, create a MySQL role representing the shared privilege set and grant the role to each individual's MySQL account. For example: CREATE ROLE 'r_shared_resource'; GRANT SELECT, INSERT, UPDATE ON application_db.* TO 'r_shared_resource'; GRANT 'r_shared_resource' TO 'user1'@'host1', 'user2'@'host2'; SET DEFAULT ROLE 'r_shared_resource' TO 'user1'@'host1', 'user2'@'host2'; Ensure the role cannot be used for direct authentication: ALTER USER 'r_shared_resource' ACCOUNT LOCK; MySQL roles provide common privilege sets to separate authenticated accounts, avoiding the need for users to share a database login. For application or service accounts that must be shared by a service, prevent direct human use of the account and require users to authenticate individually to the application or other approved access mechanism before the service account is used. Remove or lock shared interactive accounts whose credentials are used directly by multiple human users, and replace them with individually authenticated accounts and appropriate role assignments.