Exploiting Apache tomcat6 Using Metasploit
The report describes a lab where an outdated Apache Tomcat 6 instance exposed the AJP connector on port 8009, allowing the Ghostcat vulnerability to be exploited for remote code execution. A second attempt to abuse the Tomcat Manager interface with default credentials failed because the upload endpoint was inaccessible.
Published on infosecwriteups.com
Apache Tomcat6 is a widely used open source Java Servlet container and web server that supports the deployment of Java based web applications. Despite its popularity, Tomcat6 is outdated and no longer receives official security updates.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the AJP connector was exposed to untrusted networks and the Tomcat version was outdated, making it vulnerable to CVE-2020-1938 (Ghostcat).
Impact
The Ghostcat vulnerability allowed full remote code execution through the AJP connector, while the default Tomcat files offered limited insight and did not lead to successful exploitation.
What the attacker needed
Network access to AJP port 8009; outdated Tomcat 6 with AJP exposed; attacker machine with Metasploit
The fix
The report recommends upgrading to a supported version and, if legacy systems must be used, properly hardening and securing the environment.
How it was found
- Set up two virtual machines with static IPs and confirm network reachability with ping.
- Install OpenJDK 8 and download/extract Apache Tomcat 6.0.41 to /opt.
- Add a manager-script user in tomcat-users.xml and start Tomcat.
- From the attacker machine, scan the target with nmap to find open ports 8009 and 8080.
- Use Metasploit's Ghostcat module against port 8009 with a reverse TCP payload to obtain a Meterpreter session.
- Attempt to use Metasploit's Tomcat Manager upload module with default credentials, which fails.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Apache Tomcat is a program that runs Java web applications. An old version of Tomcat had a service called AJP that, when reachable from the network, let an attacker run their own code on the server. The report shows how a tool called Metasploit was used to take control of the machine in a test lab.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.