Understanding Apache Struts 2 CVE-2023-50164
Authors: Melissa Bischoping, Director, Endpoint Security Research & James Lively, Endpoint Security Research Specialist
"A new vulnerability in Apache Struts 2" is a phrase that is certain to raise concerns in cybersecurity veterans, especially one released during the winter holiday season. It's no secret that holidays are a prime target for threat actors to leverage zero-days and attack organizations; a good portion of staff members may be on vacation, change freezes may limit patching and downtime, and third-party support may come with additional delays. So, when a new vulnerability is announced in a widely used framework with a CVSS score of 9.8, it's no surprise that security teams immediately engage to understand the impact. For Apache Struts, this concern is compounded as many remember the 2017 vulnerability CVE-2017-5638 which widely exploited and viewed as responsible for the Equifax breach.
The Tanium Vulnerability Emergency Response Team (VERT) has taken a dive into the vulnerability through first-hand analysis of proof-of-concept exploits, as well as detailed writeups from other researchers in the industry. VERT has put together some FAQ to provide additional understanding, and hopefully some reassurances about the exploitability of this vulnerability in today's threat landscape.
What is Apache Struts 2?
Apache Struts 2 is a framework that is used to build Java web applications using a Model, View, Controller (MVC) architecture. It has been around for 2 decades, and is still used, although many Java web app developers prefer things like Spring Framework over Struts. You can read a great primer of MVC architecture and how Struts works on JRebel's blog here.
What is CVE-2023-50164?
The vulnerability exists in Apache Struts' internal processing logic when the ActionSupport class is implemented in an application. The vulnerability is leveraged by changing the case (Upper/Lower) of specific parameters, causing the parameters to reorder, in a web request. Any parameter that comes after another can overwrite anything that the prior parameters wrote.
In addition, reordering the parameters bypasses the protections for canonical name traversal, and arbitrary file writes on a Struts server is possible.
The vulnerable versions are:
-
From 2.0.0 up to (excluding) 2.5.33
-
From 6.0.0 up to (excluding) 6.3.0.2
An application must meet all the following conditions to be exploitable:
-
Use a vulnerable version of Struts that implements the Struts ActionSupport class in the code, OR exposes the system running struts to the internet without authentication. **NOTE: This public-facing unauthenticated configuration would introduce numerous security concerns beyond just this vulnerability**.
-
Contain a file upload capability
-
Accept input without validation and sanitization.
-
Allow user-supplied file names when uploading files.
-
Have permissions to write to a directory
-
Web-app firewalls must not be configured to block this style of attack.
This highlights that the vulnerability, while potentially severe if exploited successfully, is not vulnerable by default, and would only be exploitable if multiple other secure best-practices and protections are ignored.
The Exploit Prediction Scoring System (EPSS) calculates a 9.80% risk of this vulnerability being exploited in the wild in the next 30 days, and CVSS scoring indicates an exploitability score of 3.9. "Exploitability metrics reflect the ease and technical means by which the vulnerability can be exploited"; you can read more about how these scores are calculated and weighted in First.org's explanation of CVSS 3.1 scoring.
The holistic view of this vulnerability is far less significant than the CVSS **Base ** Score of 9.8 would lead you to believe.
In summary, a very specific, non-default set of circumstances must exist for your environment to be exploitable , even if you're using applications that were built with the vulnerable version of Struts.
How can exploitation be detected?
Currently, there are limited proof-of-concept exploits available. POCs rely on very specific configurations in purpose-built apps to demonstrate the vulnerability. While threat actors are starting to widely spray targets at internet-facing apps, there are no reports of widespread success or universal payloads. It is highly unlikely to ever be universally applicable or widely exploited at scale.
To detect exploitation or attempted exploitation, reviewing application logs or web app firewall logs is recommended. This vulnerability, if exploited successfully, could result in various post-exploitation artifacts and behaviors, so the standard approach to searching for evidence of attempted directory traversal attacks or uploaded webshells would be advised.
Because of the varied nature of the exploit payloads, it is unlikely to see high-fidelity indicators of compromise, such as file hashes, that would be specific to this vulnerability alone.
We will continue to monitor for additional information and update if new information on exploitation is available.
What is the fix?
It's not recommended for organizations to attempt to replace the vulnerable component themselves. They should prioritize identifying affected software using Software Bill of Materials (SBOM) and work with the application's developer to obtain the appropriate patching or mitigation guidelines for that application.
How can Tanium help?
Comply + SBOM
The Tanium Vulnerability and Emergency Response Team (VERT) has worked directly with Tanium Comply and SBOM teams to ensure coverage for software libraries for Struts 2 core and Struts 2 Framework. These findings will identify vulnerable versions of Struts 2, but will not indicate if the ActionSupport class is in use or exposed in an exploitable configuration.
From the Comply workbench, navigate to Findings > Vulnerability and use the Check ID filter option to search for CVE-2023-50164.
From Interact, you can ask the following question:
Get Computer Name and Comply - CVE Findings having Comply - CVE Findings:Check ID matches CVE-2023-50164 from all machines with Comply - CVE Findings:Check ID contains CVE-2023-50164
Final Thoughts
Anytime a high-severity vulnerability grabs the headlines, vulnerability management teams scramble to understand impact and attack surface. Our goal is always to help clarify, reduce confusion, and hopefully make everyone's holiday season a little less stressful. In the case of CVE-2023-50164, there is valid cause to take the potential impact of the vulnerability seriously, and work with your vendors and software developers to apply their recommended mitigations if you are in an exploitable configuration today.
The team over at Praetorian summed this up quite well in their blog: "While CVE-2023-50164 is a serious security vulnerability, it is going to be difficult for attackers to perform mass scanning and exploitation of this vulnerability. The numerous preconditions required to exploit the issue along with the requirement for an application-defined file upload endpoint to be accessible makes mass exploitation a challenge. This bug is serious and deserving of its CVSS score of 9.8 – however, it's also a good reminder that CVSS scores don't directly represent risk of exploitation. The numerous preconditions required make this vulnerability harder to identify automatically, and harder to exploit reliably. Nevertheless, we recommend mitigation of this issue as soon as possible."
Tanium Resources
To learn more about Tanium Comply and SBOM, as well as how Tanium can help identify this and other similar vulnerabilities in your environment, please contact your Tanium representative or Partner.
Test drive Tanium in your environment: https://try.tanium.com
More questions on this issue or insights you would like to share? Head over to the Tanium Resource Center to start a conversation!