© 2020 Caendra Inc. - Hera For Waptxv2 - Insecure Rmi
© 2020 Caendra Inc. - Hera For Waptxv2 - Insecure Rmi
You are placed in an unknown network. Using nmap, discover a Remote Method Invocation interface
and achieve code execution by taking advantage of a misconfiguration.
• Burpsuite
• RMI exploitation tool e.g. sjet (https://github.com/siberas/sjet)
• Socat
• Nmap
• Netcat
Tweak the exploitation tool a bit, so that it is able to talk to the vulnerable interface. Focus on any
hardcoded names that need to be tweaked.
Use port forwarding so that the RMI interface can properly communicate with its second part.
A basic nmap scan can with the -A option (or the “rmi-dumpregistry” script) can be helpful to list the
whole interface.
We notice a custom URL and a local Stub. This might be an issue when trying to exploit the interface
using an automated tool.
We have downloaded the tool https://github.com/siberas/sjet with “git clone” as well as a jython
standalone jar from http://search.maven.org/remotecontent?filepath=org/python/jython-
standalone/2.7.0/jython-standalone-2.7.0.jar
If we try to run the tool as described in its README github section, we will encounter an error.
First, we can observe that the tool uses a default jmxrmi URL…
In order to match it, we will need to modify the program itself (sjet.py)
If you run Wireshark on local loopback (or all interfaces) you will observe that during the exploit’s
execution, your machine is trying to connect to the RMI Stub which is implemented on, as the registry
dump says, 127.0.1.1
This is of course not true and as port 40767 is opened, you should redirect traffic from localhost 40767
to the remote host. This can be achieved using socat.
Now with socat set up you can run the patched tool twice in order to achieve code execution. First, you
install the MBean with the below command.
Now, to execute code using your installed MBean you can use the below command.
The machine is compromised! Don’t forget to uninstall the malicious MBean, as follows.