Bug #77860 | Prevent account management statements from injecting account attributes | ||
---|---|---|---|
Submitted: | 28 Jul 2015 15:21 | Modified: | 6 Oct 2015 16:49 |
Reporter: | Todd Farmer (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Security: Privileges | Severity: | S3 (Non-critical) |
Version: | 5.7.8 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[28 Jul 2015 15:21]
Todd Farmer
[28 Jul 2015 15:29]
Todd Farmer
Posted by developer: One example of problems caused by this behavior: mysql> CREATE USER u1@localhost PASSWORD EXPIRE INTERVAL 5 DAY; Query OK, 0 rows affected (0.00 sec) mysql> ALTER USER u1@localhost IDENTIFIED BY 'pwd'; Query OK, 0 rows affected (0.00 sec) The CREATE USER statement is written to the binlog as follows: SET TIMESTAMP=1438097065/*!*/; CREATE USER 'u1'@'localhost' IDENTIFIED WITH 'mysql_native_password' PASSWORD EXPIRE INTERVAL 5 DAY ACCOUNT UNLOCK /*!*/; As a result, both the master and slave will have the account u1@localhost with no password, and a password expiration policy of 5 days. The ALTER USER command is rewritten to inject a password expiration policy that was not present in the ALTER USER command issued, and uses the default policy: SET TIMESTAMP=1438097085/*!*/; ALTER USER 'u1'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD' PASSWORD EXPIRE DEFAULT /*!*/; As a result, the password policy on the slave is changed from requiring a password change every 5 days to whatever the server default is.
[6 Oct 2015 16:49]
Paul DuBois
Noted in 5.7.9, 5.8.0 changelogs. Binary logging of CREATE USER and statements could log the hash of the password hash (rather than the hash itself) when log_backward_compatible_user_definition was enabled. Binary logging of ALTER USER statements could include attributes not present in the original statements. In consequence of the fix for these issues, log_backward_compatible_user_definition has been renamed to log_builtin_as_identified_by_password. If this variable is enabled, binary logging for CREATE USER statements involving built-in authentication plugins rewrites the statements to include an IDENTIFIED BY PASSWORD clause, and SET PASSWORD statements are logged as SET PASSWORD statements, rather than being rewritten to ALTER USER statements.