Understanding Apache Struts 2 CVE-2024-53677

As we approach the end of the year, many people are looking forward to a slower pace of activity and possibly even some well-deserved time off.  However, for the second year in a row, security researchers have "gifted" the IT community with awareness of vulnerabilities in Apache Struts 2, perhaps as an opportunity to reflect on how complicated modern IT systems are, and of the vigilance that must be maintained to keep these systems secure.

What Is Apache Struts 2?

Apache Struts 2 is a presentation framework that is used to build Java web applications, using a Model, View, Controller (MVC) architecture. Initially released in 2006, web applications based on Apache Struts 2 are still in use today, and the project is still being maintained by the Apache Software Foundation. However, many Java web app developers are favoring Spring Framework over Struts for new projects. For a quick primer on MVC architecture and how Struts works, check out JRebel's blog here.

Struts 2 utilizes objects called Actions which are the basic unit of work within the web application (for example, there may be a Hello World Action class that is responsible for displaying a Hello World message for specific visitors to a web page).  Actions can be chained together to provide more complex functionality.

To provide more extensible control over Actions, Struts 2 implements Interceptor objects, which allow developers to manipulate what is passed into or returned from an Action (for example, validate that a visitor has a UserID before trying to lookup the UserID to check if they should get our earlier referenced Hello World message).  You can learn more about how and why Interceptors are used in Struts applications in the Struts Developer Documentation here.

What Is CVE-2024-53677

CVE-2024-53677 is a critical file upload vulnerability in the default Interceptor class (FileUploadInterceptor) of Struts 2; this vulnerability has some similarities to CVE-2023-50164 from December 2023 – Struts, like many popular frameworks, is the gift that keeps on giving. An attacker could exploit this vulnerability by sending specially crafted upload parameters, bypassing path traversal protections and uploading malicious files, leading to Remote Code Execution.

Despite the vulnerable FileUploadInterceptor object shipping as part of the default Interceptor stack in all currently available versions of Struts 2, the extensible nature of Struts 2 does not require developers to implement the functionality for uploading files. This means that not all applications which leverage Struts 2 are vulnerable.

The good news is that a vulnerable version of Struts 2 is only exploitable if the application has implemented the FileUploadInterceptor. Unfortunately, detecting use of these components and mitigating the vulnerability requires manual investigation of the application or coordination with the vendor or developers who created it.

The versions of Apache Struts 2 affected by CVE-2024-53677 include:

Version Range

End-of-Life

Notes

Struts 2.0.0 - Struts 2.3.37

May 2019

Struts 2.5.0 - Struts 2.5.33

April 2024

Struts 6.0.0 - Struts 6.6.1

Any 6.x version is vulnerable; as of 2024-12-20, 6.6.1 is latest 6.x release

What Is the Fix?

Unfortunately, fixing the CVE-2024-53677 vulnerability is more complex than a traditional patch. As of December 20, 2024, the Apache Software Foundation's Security Bulletin (S02-067) recommends upgrading to Struts 2 version 6.4.0 or later. However, web applications running Struts version 6.4.0 and above still contain the vulnerable FileUploadInterceptor component, but Struts 6.4.0 introduces a new Interceptor (ActionFileUploadInterceptor) that handles HTTP form input differently from the vulnerable FileUploadInterceptor.

Implementing the recommended fix of updating existing applications that use FileUploadInterceptor to instead use ActionFileUploadInterceptor requires developers to modify and test code before releasing a patched version of their application.

Apache notes that this change is not backward compatible, and continuing to use the old mechanism keeps systems vulnerable, regardless if they are using the newer version of Struts. In Struts 7.0.0 (released December 20, 2024), the FileUploadInterceptor has been removed.

How Can Tanium Help?

Once scoped, you can target specific applications for additional monitoring, hardening, or specific remediation guidance from the software vendor.

When Tanium environments are configured to collect Software Bill of Materials (SBOM) data, scoping potential exposure can be as easy as creating a Report.

Note:

If any of the links or buttons in these steps are not present in your environment, check with your Tanium administrator to ensure that you have sufficient RBAC permissions to make the suggested changes (or request that they make the changes on your behalf).After configuring Attributes in Asset, it can take 10 minutes or more for the Attributes to be available on the default Import schedule.  If access to the Attributes is required sooner, consider using the 'Run Now' option on the Import Schedules page.

To configure a Struts-specific report in Reporting:

  1. Verify you have the SBOM Package Information Filtered By sensor registered to harvest data for BOMs with Name=*struts*

    1. From the Overview page of the Interact module, click Settings.

    2. On the Registration and Collection tab, expand the Filters section.

    3. Change the Registered value to True.

    4. In the Filter Items box type: sbom.

    5. Scroll through the list to see if there is a SBOM Package Information Filtered By sensor with green checkmark in the Status column and name *struts* in the Parameters column.
      A screenshot of a computer Description automatically generated
    6. If the sensor is not configured as pictured, follow the steps in the Work with SBOM Profiles and Setting up Tanium Asset sections of the SBOM v2 Installation Guide to register Struts BOM data for harvesting.

  2. In the Tanium web console, click on the Data icon, then click Reports menu item.
    A screen shot of a computer Description automatically generated
  3. On the Reports page, click Create Report.

  4. In the Quick Column Add box, type: SBOM Package.

  5. Click the first result (starts with SBOM Package vs Name > SBOM Package).

  6. Scroll through the list to locate the item with *struts* listed in the Name column, then check the box next to that item and click Apply.
    A screenshot of a computer Description automatically generated
  7. At the top of the right pane, expand the Filters link and click Add Row, then enter the following filtering criteria:

    1. SBOM Packages Information By [*struts*,"","",""] Name contains Core

  8. Hover over the + icon below the previously entered filtering criteria, then click Add Row. When the new line appears click the OR button to toggle the row to be grouped by the AND operator.
    A screenshot of a computer Description automatically generated
  9. In the new filter criteria line, enter the following filtering criteria. Hover over the + icon and click Add Row for each sequential item:

    1. SBOM Packages Information By [*struts*,"","",""] Name does not contain Plugin

    2. SBOM Packages Information By [*struts*,"","",""] Version is greater than or equal to 2.0.0

    3. SBOM Packages Information By [*struts*,"","",""] Version is less than 7.0.0

  10. Confirm the four filtering criteria looks like the screenshot below:
    A screenshot of a computer Description automatically generated
    Note:

    Although the vulnerability was addressed in version 6.4.0, the vulnerable Interceptor will not be removed from Struts until version 7.0.0. This means that any application using a version less than 7.0.0 may still be vulnerable if it has not been updated to use the non-vulnerable Interceptor.

  11. Click the checkboxes on the right side of EACH line to apply all the configured filter criteria

  12. Click Save Report and provide settings such as:

    1. Report Name: Apache Struts 2 [CVE-2024-35677].

    2. Description: Endpoints potentially vulnerable to CVE-2024-35677 - FileUploadInterceptor (S02-067).

    3. Content Set: Reporting.

  13. Click Save to save the Report.

Final Thoughts

As with previous vulnerabilities in Struts, Log4j, and other Open-Source Software (OSS) projects, detection and scoping aren't always easy solutions, but Tanium provides real-time visibility to identify not only Installed Applications on all endpoints and can provide a SBOM inventory. Tanium SBOM can expedite scoping and impact across the applications with complex dependencies that are in use throughout your enterprise.

The Breakglass Option

Although not recommended without a thorough code/risk review, per the Struts Developer documentation, applications that are running Struts 2.3.11 or later can completely disable FileUploadInterceptor by adding the following line to the application's struts.xml:

<constant name="struts.multipart.enabled" value="false"/>

Note:

Adding this configuration WILL prevent file uploads from occurring throughout the application, so if a Struts application was specifically designed to allow users to upload files/attachments, disabling FileUploadInterceptor will mitigate CVE-2024-35677, but will also make the application effectively non-functional (with respect to the application's original design intent).

Resources and Further Reading