1.写入webshell
使用select 'payload' into outfile '/path/to/webshell'
即可写入一个webshell到/path/to/webshell
,这种方式的利用条件为:
- mysql账户有 File_priv 权限,即
select user,file_priv from mysql.user where user=current_user()
为 Y show variables like '%secure_file_priv%'
的结果符合要求(前面的语句执行结果可能与select @@global.secure_file_priv
不同,但经过我的测试这时候前面的语句的结果是准确的,不过我也不知道为什么两个结果会不一致,按照MySQL官方文档的说法该变量是全局系统变量,应该是不会出现两个不同结果的。。。如果有权限的话还是用select * from information_schema.session_variables where variable_name='secure_file_priv'
看比较好,这个肯定准确)。具体要求如下:- 如果该变量为空,则变量无效