Investigation
If we can execute java command with arbitrary .jar
file as root, we can escalate to privileges.
Exploitation
1. Create a JAR File
First, create a custom jar file in local machine.
Replace <local-ip>
with your local ip address.
Then transfer the file to remote machine.
2. Reverse Shell
In local machine, start a listener.
Now execute the java command as root in target machine.
We should get a root shell.