mysql(linux)远程数据库提权漏洞_MySQL(Linux)远程数据库提权漏洞

小编的话:Kingcope神牛又放干货了。

漏洞在12月1日的Seclist上发布,作者在Debian Lenny (mysql-5.0.51a) 、 OpenSuSE 11.4 (5.1.53-log)上测试成功,代码执行成功后会增加一个MySQL的管理员帐号。

use DBI();

$|=1;

=for comment

MySQL privilege elevation Exploit

This exploit adds a new admin user.

By Kingcope

Tested on www.2cto.com

* Debian Lenny (mysql-5.0.51a)

* OpenSuSE 11.4 (5.1.53-log)

How it works:

This exploit makes use of several things:

*The attacker is in possession of a mysql user with 'file' privileges for the target

*So the attacker can create files on the system with this user (owned by user 'mysql')

*So the attacker is able to create TRIGGER files for a mysql table

triggers can be used to trigger an event when a mysql command is executed by the user,

normally triggers are 'attached' to a user and will be executed with this users privilege.

because we can write any contents into the TRG file (the actual trigger file), we write the entry

describing the attached user for the trigger as "root@localhost" what is the default admin user.

* We make use of the stack overrun priorly discovered to flush the server config so the trigger file is recognized.

This step is really important, without crashing the mysql server instance and reconnecting (the server will respawn)

the trigger file would not be recognized.

So what the exploit does is:

* Connect to the MySQL Server

* Create a table named rootme for the trigger

* Create the trigger file in /var/lib/mysql//rootme.TRG

* Crash the MySQL Server to force it to respawn and recognize the trigger file (by triggering the stack overrun)

* INSERT a value into the table so the trigger event gets executed

* The trigger now sets all privileges of the current connecting user in the mysql.user table to enabled.

* Crash the MySQL Server again to force it reload the user configuration

* Create a new mysql user with all privileges set to enabled

* Crash again to reload configuration

* Connect by using the newly created user

* The new connection has ADMIN access now to all databases in mysql

* The user and password hashes in the mysql.user table are dumped for a convinient way to show the exploit succeeded

* As said the user has FULL ACCESS to the database now

Respawning of mysqld is done by mysqld_safe so this is not an issue in any configuration I've seen.

=cut

=for comment

user created for testing (file privs will minor privileg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值