Bug #86664 | Reopen of #78033 - CREATE USER accepts plugin and hash, but misplaces the hash | ||
---|---|---|---|
Submitted: | 12 Jun 2017 21:57 | Modified: | 25 Aug 2017 14:57 |
Reporter: | Szymon Komendera | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Security: Privileges | Severity: | S3 (Non-critical) |
Version: | 5.5, 5.6, 5.6.36 | OS: | Any |
Assigned to: | Georgi Kodinov | CPU Architecture: | Any |
[12 Jun 2017 21:57]
Szymon Komendera
[13 Jun 2017 10:04]
MySQL Verification Team
Thank you for the report. -- 5.6.36 rm -rf 86664 scripts/mysql_install_db --basedir=$PWD --datadir=$PWD/86664 -v bin/mysqld --no-defaults --basedir=$PWD --datadir=$PWD/86664 --core-file --socket=/tmp/mysql_ushastry.sock --port=5636 --log-error=$PWD/86664/log.err 2>&1 & [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.36: bin/mysql -uroot -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.36 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. root@localhost [(none)]> SELECT PASSWORD('my_n0t_v3ry_secur3_passw0rd'); +-------------------------------------------+ | PASSWORD('my_n0t_v3ry_secur3_passw0rd') | +-------------------------------------------+ | *FBE2E24FCEAC1399CF7E7B60E2E723AF45F25D44 | +-------------------------------------------+ 1 row in set (0.00 sec) root@localhost [(none)]> CREATE USER 'myuser'@'localhost' IDENTIFIED WITH mysql_native_password AS '*FBE2E24FCEAC1399CF7E7B60E2E723AF45F25D44'; Query OK, 0 rows affected (0.00 sec) root@localhost [(none)]> SELECT User, Host, Plugin, Password FROM mysql.user WHERE User = 'myuser' AND host = 'localhost'; +--------+-----------+-----------------------+----------+ | User | Host | Plugin | Password | +--------+-----------+-----------------------+----------+ | myuser | localhost | mysql_native_password | | +--------+-----------+-----------------------+----------+ 1 row in set (0.00 sec) root@localhost [(none)]> SELECT User, Host, Plugin, Password, Authentication_string FROM mysql.user WHERE User = 'myuser' AND host = 'localhost'; +--------+-----------+-----------------------+----------+-------------------------------------------+ | User | Host | Plugin | Password | Authentication_string | +--------+-----------+-----------------------+----------+-------------------------------------------+ | myuser | localhost | mysql_native_password | | *FBE2E24FCEAC1399CF7E7B60E2E723AF45F25D44 | +--------+-----------+-----------------------+----------+-------------------------------------------+ 1 row in set (0.00 sec) root@localhost [(none)]> \q Bye [umshastr@hod03]/export/umesh/server/binaries/GABuilds/mysql-5.6.36: bin/mysql -umyuser -S /tmp/mysql_ushastry.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.6.36 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. myuser@localhost [(none)]> show grants; +--------------------------------------------+ | Grants for myuser@localhost | +--------------------------------------------+ | GRANT USAGE ON *.* TO 'myuser'@'localhost' | +--------------------------------------------+ 1 row in set (0.00 sec)
[25 Aug 2017 14:57]
Georgi Kodinov
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at http://www.mysql.com/downloads/ What you're describing here is the documented behavior:(https://dev.mysql.com/doc/refman/5.6/en/create-user.html) says: "With IDENTIFIED WITH, the server assigns the specified plugin and the account has no password. If the optional AS 'hash_string' clause is also given, the string is stored as is in the authentication_string column (it is assumed to be already hashed in the format required by the plugin)." There was a logical discrepancy in how 5.5 and 5.6 were handling the two columns in mysql.user. This is fixed in 5.7 since it required changes in behavior that are not acceptable in a GA release. And mysql_upgrade should properly upgrade the system tables too. I would suggest you consider upgrading your installation to 5.7.