Description
This module exploits a path traversal in the legacy FileUploadInterceptor of Apache Struts 2 (S2-067 / CVE-2024-53677), an incomplete-fix bypass of S2-066 (CVE-2023-50164).
When an action uses the legacy FileUploadInterceptor, a multipart file field named X exposes the action properties X, XFileName and XContentType, which the parameters interceptor binds via OGNL. By prefixing the file-name override key with the OGNL `top.` expression (e.g. `top.<field>FileName`), an unauthenticated attacker re-sets the destination file name to a traversal path after the accepted-parameter-name filter has run, so the uploaded temporary file is moved outside the intended upload directory into a web-reachable location, yielding JSP code execution.
Affects Struts 2.0.0-2.3.37, 2.5.0-2.5.33 and 6.0.0-6.3.0.2 when an action uses the legacy FileUploadInterceptor. Note that upgrading to 6.4.0 alone is NOT sufficient: the action must be migrated to the new Action File Upload mechanism (the legacy interceptor is only removed in 7.0.0).
The upload endpoint (TARGETURI) and the action file-upload field name (UPLOAD_FIELD) are target-specific and are normally recovered from the target's upload form. The default TRAVERSAL of `../` and web retrieval path land the file in the web root, which matches the vulhub struts2:s2-067 reference application (Struts 2.5.33); deeper deployments may require tuning TRAVERSAL and WEB_PATH.
Module options
To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':
msf > use exploit/multi/http/apache/struts2_fileupload_traversal_cve_2024_53677msf undefined(struts2_fileupload_traversal_cve_2024_53677) > show actions ...actions...msf undefined(struts2_fileupload_traversal_cve_2024_53677) > set ACTION < action-name >msf undefined(struts2_fileupload_traversal_cve_2024_53677) > show options ...show and set options...msf undefined(struts2_fileupload_traversal_cve_2024_53677) > runPrioritize with Active Threat Intelligence
With curated Threat Intelligence, you can see which vulnerabilities truly put you at risk, prioritize what matters most, and act before attackers do.
Explore Intelligence Hub