Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-17945

mysql.db contains ghost users which allow some operations on them

    XMLWordPrintable

Details

    Description

      Anonymous users have been removed:

      MariaDB [test]> select user, host from mysql.user;
      +------+-----------+
      | user | host      |
      +------+-----------+
      | root | 127.0.0.1 |
      | root | ::1       |
      | root | localhost |
      | root | ws        |
      +------+-----------+
      4 rows in set (0.00 sec)
      

      and the server knows they don't exist:

      MariaDB [test]> set password for '' = password('test');
      ERROR 1133 (28000): Can't find any matching row in the user table
      

      but RENAME or DROP still works:

      MariaDB [test]> rename user '' to foo;
      Query OK, 0 rows affected (0.03 sec)
      

      nothing of course appears in mysql.user:

      MariaDB [test]> select user, host from mysql.user;
      +------+-----------+
      | user | host      |
      +------+-----------+
      | root | 127.0.0.1 |
      | root | ::1       |
      | root | localhost |
      | root | ws        |
      +------+-----------+
      4 rows in set (0.00 sec)
      

      It happens because there is some contents in mysql.db (and it remains there even when anonymous users get dropped):

      before RENAME

      MariaDB [test]> select user, host from mysql.db;
      +------+------+
      | user | host |
      +------+------+
      |      | %    |
      |      | %    |
      +------+------+
      2 rows in set (0.00 sec)
      

      after RENAME

      MariaDB [test]> select user, host from mysql.db;
      +------+------+
      | user | host |
      +------+------+
      | foo  | %    |
      | foo  | %    |
      +------+------+
      2 rows in set (0.00 sec)
      

      Now we can work the same way on user foo, etc.

      It appears strange. I suppose it was meant to be so once, but I'm not sure it still is.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.