Skip to content
RCE Write-up Beginner

[Thompson] — Exploitation of Apache Tomcat Default Credentials Leading to RCE and Cron-Based Privilege Escalation

An Apache Tomcat manager interface accepted the default Tomcat credentials, letting an attacker deploy a malicious WAR file and gain remote code execution as the tomcat user. A world-writable script run by root's cron job was then modified to obtain a root shell.

Bash Overflow Follow

Published on meetcyber.net

The presence of AJP (Apache JServ Protocol) suggested a potential Ghostcat-style attack surface. Enumeration against port 8009 successfully retrieved the web.xml file.

Bash Overflow, on meetcyber.net

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 Tomcat manager was left with default credentials, and a cron-executed script was world-writable.

Impact

An attacker could gain remote code execution as the tomcat user and then escalate to a root shell.

What the attacker needed

Network access to Tomcat manager; default credentials unchanged; world-writable cron script

How it was found

  1. Scan the target and find ports 22, 8009 and 8080 open.
  2. Try the common Tomcat admin endpoints, which all return 401 Unauthorized.
  3. Attempt Ghostcat enumeration on port 8009 and retrieve web.xml, which holds nothing useful.
  4. Brute-force directories with ffuf, then manually revisit /manager and log in with default credentials.
  5. Deploy a malicious WAR file through the manager to get a reverse shell as the tomcat user.
  6. Read /etc/crontab, find that id.sh in jack's directory runs as root, and modify it to run a reverse shell.

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.

The Tomcat web server ships with a management page that lets people upload and run web applications. The administrator had left the factory default username and password in place, so anyone who found the page could log in and upload their own program. Separately, a script that the system runs automatically as the most powerful user was writable by everyone, so the attacker changed it to run their own commands.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Bash Overflow

View all

35 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.