Network Penetration Testing- SSH, Tomcat, and Java RMI
The article demonstrates exploiting default Tomcat manager credentials to deploy a malicious WAR file and gain a reverse shell, using weak SSH host key algorithms to log in, and exploiting Java RMI to achieve remote code execution as root. An attacker could use these misconfigurations to compromise the server and escalate privileges.
medium.com
Published on medium.com
This post examines vulnerabilities in three widely-used services: Apache Tomcat, SSH, and Java RMI. This post will walk through exploitation techniques and provide practical remediation strategies to secure your environments.
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 root causes are default credentials on the Tomcat manager, outdated Tomcat and SSH configurations allowing weak algorithms, and Java RMI remote class loading enabled.
Impact
An attacker could gain a reverse shell as the tomcat user, escalate to root, and maintain persistent access via SSH keys.
What the attacker needed
Access to the target network; Tomcat manager exposed with default credentials; Ability to upload WAR files; SSH service with weak algorithms enabled
The fix
The article recommends updating Tomcat, changing default credentials, limiting WAR deployment, disabling weak SSH algorithms, and disabling remote class loading in Java RMI.
How it was found
- Scan the target with nmap to find Tomcat on port 8180.
- Try default Tomcat manager credentials (tomcat/tomcat, tomcat/s3cret) and log in.
- Create a malicious WAR file with msfvenom and upload it via the Tomcat manager.
- Start a netcat listener and access the deployed JSP file to get a reverse shell.
- Upgrade the shell to a TTY using Python and stty commands.
- Log in via SSH using a weak host key algorithm and escalate to root with sudo.
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.
This is a walkthrough of a deliberately vulnerable practice machine. It shows how weak default passwords and outdated software let an attacker take control of a server. The attacker uploads a harmful file to a web management page, logs in over SSH with a weak setting, and abuses a Java service to run commands as the administrator.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.