xp_cmdshell
查看能否使用xpcmd_shell;
select count(*) from master.dbo.sysobjects where xtype = 'x' and name = 'xp_cmdshell'
直接使用xpcmd_shell执行命令:
EXEC master.dbo.xp_cmdshell 'whoami'
发现居然无法使用
查看是否存在xp_cmdshell:
EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;
到现在我们知道了,这台mssql支持xp_cmdshell,但没有开启 xp_cmdshell:
启用:
EXEC sp_configure 'show advanced options', 1
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell', 1;
RECONFIGURE;
关闭:
exec sp_configure 'show advanced options', 1;
reconfigure;
exec sp_configure