summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorVenkata Sidagam <venkata.sidagam@oracle.com>2014-05-08 14:41:01 +0530
committerVenkata Sidagam <venkata.sidagam@oracle.com>2014-05-08 14:41:01 +0530
commit858e5626c5cdee3b0359e906fb04bdbbb6d38190 (patch)
tree4ad9d58e8122f5b7756d043d159307ccaf850847 /storage
parent918837f7289a3cbd032a5cdb85eb55a466ad7c8e (diff)
downloadmariadb-git-858e5626c5cdee3b0359e906fb04bdbbb6d38190.tar.gz
Bug #18045646 LOCAL USER CAN RUN ARBITRARY CODE IN THE CONTEXT OF THE MYSQL SERVER
Description: Using the temporary file vulnerability an attacker can create a file with arbitrary content at a location of his choice. This can be used to create the file /var/lib/mysql/my.cnf, which will be read as a configuration file by MySQL, because it is located in the home directory of the mysql user. With this configuration file, the attacker can specify his own plugin_dir variable, which then allows him to load arbitrary code via "INSTALL PLUGIN...". Analysis: While creating the ".TMD" file we are not checking if the file is already exits or not in mi_repair() function. And we are truncating if the ".TMD" file exits and going ahead This is creating the security breach. Fix: We need to use O_EXCL flag along with O_RDWR and O_TRUNC which will make sure if any user creates ".TMD" file, will fails the repair table with "cannot create ".TMD" file error". Actually we are initialing "param.tmpfile_createflag" member with O_RDWR | O_TRUNC | O_EXCL in myisamchk_init(). And we are modifying it in ha_myisam::repair() to O_RDWR | O_TRUNC. So, we need to remove the line which is modifying the "param.tmpfile_createflag".
Diffstat (limited to 'storage')
-rw-r--r--storage/myisam/ha_myisam.cc1
1 files changed, 0 insertions, 1 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 72a29cd8130..602a0ae6cc1 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -1041,7 +1041,6 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool do_optimize)
param.db_name= table->s->db.str;
param.table_name= table->alias;
- param.tmpfile_createflag = O_RDWR | O_TRUNC;
param.using_global_keycache = 1;
param.thd= thd;
param.tmpdir= &mysql_tmpdir_list;