Bug #60732 granted privileges depends from username
Submitted: 2 Apr 2011 13:13 Modified: 3 May 2011 8:49
Reporter: Vadim Klevtsov Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Security: Privileges Severity:S2 (Serious)
Version:5.1.53-56, 32/64 OS:Windows (win7-64, winxpsp3-32)
Assigned to: CPU Architecture:Any
Tags: first-digit, priveleges

[2 Apr 2011 13:13] Vadim Klevtsov
Description:
When I use this simple script results is differ for user "1default" and "default"

/* DROP USER '1default';*/
CREATE USER "1default" IDENTIFIED BY '12345';
GRANT SELECT(`szUsername`) ON `tandem`.`users` to "1default";
flush privileges;
show grants for '1default'

/* DROP USER 'default'; */
CREATE USER "default" IDENTIFIED BY '12345';
GRANT SELECT(`szUsername`) ON `tandem`.`users` to "default";
flush privileges;
show grants for 'default'

==>
GRANT USAGE ON *.* TO '1default'@'%' IDENTIFIED BY PASSWORD '*00A51F3F48415C7D4E8908980D443C29C69B60C9'
GRANT SELECT (szUsername) ON `tandem`.`users` TO '1default'@'%'
==>
GRANT USAGE ON *.* TO 'default'@'%' IDENTIFIED BY PASSWORD '*00A51F3F48415C7D4E8908980D443C29C69B60C9'

How to repeat:
run script from description

Suggested fix:
n/a
[2 Apr 2011 13:48] Vadim Klevtsov
this error is not present at current 5.5.10 GA
[2 Apr 2011 14:00] Vadim Klevtsov
this error is present at 5.1.56
[2 Apr 2011 14:02] Vadim Klevtsov
corrected versions number. error(?) checked against 5.1.53 (present), 5.1.56(present), 5.5.10 (not present).
[3 Apr 2011 8:49] Valeriy Kravchuk
You referred to some column of some table in some database that we do not see anything about in the bug description. I tried to do similar test with mysql.user table, and results are the same for both users:

macbook-pro:5.1 openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.57-debug Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE USER "1default" IDENTIFIED BY '12345';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SELECT(`host`) ON `mysql`.`user` to "1default"
    -> ;
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> show grants for '1default'
    -> ;
+---------------------------------------------------------------------------------------------------------+
| Grants for 1default@%                                                                                   |
+---------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO '1default'@'%' IDENTIFIED BY PASSWORD '*00A51F3F48415C7D4E8908980D443C29C69B60C9' |
| GRANT SELECT (host) ON `mysql`.`user` TO '1default'@'%'                                                 |
+---------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> CREATE USER "default" IDENTIFIED BY '12345';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT SELECT(`host`) ON `mysql`.`user` to "default";
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'default'
    -> ;
+--------------------------------------------------------------------------------------------------------+
| Grants for default@%                                                                                   |
+--------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'default'@'%' IDENTIFIED BY PASSWORD '*00A51F3F48415C7D4E8908980D443C29C69B60C9' |
| GRANT SELECT (host) ON `mysql`.`user` TO 'default'@'%'                                                 |
+--------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Please, check again and provide a complete test case.
[3 May 2011 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".