How Tanium Can Help with Spring4Shell - Spring Framework RCE - CVE-2022-22965

Overview

On March 31, 2022 VMWare Tanzu announced CVE-2022-22965. According to additional research, there is a reported unauthenticated Remote Code Execution (RCE) vulnerability in the JDK9+ Spring Framework. In order to exploit this vulnerability, the affected system must be running a Java version of 9 or higher and be leveraging the Spring Framework among other pre-requisites.

Specifically quoting from the Spring Framework RCE announcement:

Vulnerability

The vulnerability impacts Spring MVC and Spring WebFlux applications running on JDK 9+. The specific exploit requires the application to run on Tomcat as a WAR deployment. If the application is deployed as a Spring Boot executable jar, i.e., the default, it is not vulnerable to the exploit. However, the nature of the vulnerability is more general, and there may be other ways to exploit it.

Am I Impacted?

These are the requirements for the specific scenario from the report:

  • JDK 9 or higher

  • Apache Tomcat acting as the Servlet container

  • Packaged as WAR

  • spring-webmvc or spring-webflux dependency

  • Spring Framework versions 5.3.0 to 5.3.17, 5.2.0 to 5.2.19, and older versions

However, be aware that this is still an emerging situation and there may be other environmental pre-requisites that would make an endpoint vulnerable.

Tanium will continue to monitor and update this article as information becomes available.

Finding the Vulnerability

Tanium can help you find systems that meet the criteria that determine potential vulnerability in seconds, at scale, without the need to run high-impact scans or visit individual systems directly.

Tanium Interact

One approach to determining which systems to investigate is to identify if Apache Tomcat is an installed application. If Apache Tomcat is present or running on the system, the system should be investigated further.

With this type of approach, if Tomcat is not present on the system, that endpoint is unlikely to be a vulnerable candidate and further investigation may not be necessary. Keep in mind, every company must define their own risk factor to determine if this type of approach is acceptable.

There are other identifying characteristics, such as determining if the endpoint has JDK9+ installed, or if the spring-beans-*.jar file is present on disk. The questions below are examples of queries that can be used when attempting to begin this investigative workflow.

Using the Tanium Interact “Drill-Down” feature, you can begin an investigative workflow that chains multiple questions together, asking subsequent questions to only those endpoints with the relevant answer to the previous questions. As in the below example, using drill-down you can ask “Who has Java 9+” to only those systems that have “Apache Tomcat” installed, and then follow on further to ask only that subset of endpoints if they have the vulnerable “Spring Framework” installed.

To identify endpoints with Apache Tomcat installed you can use the following question:

Get Computer Name and Installed Application Exists[tomcat]from all machines with Installed Application Exists[tomcat] contains true

Note: You may also want to consider "Running Processes" and "Running Applications" for further investigation in determining if Apache Tomcat is present, but perhaps not "installed", or utilizing the Tanium Asset capabilities identified in the next section.

To report on all version 9+ of Java installed in the environment:

Get Computer Name and Installed Applications matches "(openjdk|java(\tm\(.*development[\d]+)?)?)($|(\s|-1\|-)(9|[12]\d)).*$" from all machines with Installed Applications matches "(openjdk|java(\tm\(.*development[\d]+)?)?)($|(\s|-1\|-)(9|[12]\d)).*$"

To report on specific endpoints that have the vulnerable Spring Framework located on the filesystem, using Index, as the following question:

Get Computer Name and Index - File Details[10,*,"spring-beans-[0-9].*.jar",*,*,*,*,*,*,1,0,,] from all machines with Index - File Exists[*,"spring-beans-[0-9].*.jar",*,*,*,*,*,*,1] matches True|Yes

Note:

If you are leveraging Index included with Tanium Reveal, replace the Index – File Details portion of this question with Reveal – Index File Details.

Tanium Asset

Another method of identifying potentially vulnerable systems could be leveraging a Tanium Asset report. With Tanium Asset, you can quickly view the installed software for systems inventoried, even if they may not be online to answer one of the Interact questions above.

From an All Software report, a quick filter can be created using the Normalized Name from Installed Applications containing either tomcat or jdk, and return a report of the instances of these artifacts identified by the vulnerability announcements:


Asset1.png

Clicking on the count in the previous report, returns list of endpoints, and from there, the investigation can pivot to the individual systems, even if they are offline, to determine if there is further action required.

On the specific endpoint, the installed applications can help determine if the combination of artifacts matches what was identified in the vulnerability announcements.

The first image confirms Apache Tomcat, including tomcat-servlet, which matches one of the given indicators:


Asset2.png

Further investigation confirms this endpoint also has another part of the combination installed, a version of JDK greater than version 9:


Asset3.png

Tanium Comply

Tanium Comply customers can build a Comply vulnerability assessment for CVE-2022-22965. See Creating compliance assessments. Due to the dynamic nature of this vulnerability, it is expected that definitions will continue to be updated as information becomes available.

You can track this vulnerability using Comply and the following question:

Get Online from all machines with Comply - CVE Findings:Check ID contains CVE-2022-22965

Note:

At the time of this writing, the National Vulnerability Database has not issued a score for CVE-2022-22965. Customers are advised to review their Comply report settings to ensure they are including unscored “info” vulnerabilities to ensure coverage for zero day attacks.

Tanium Reveal

You can use the Tanium Reveal Quick Search feature to quickly identify potential targets for further investigation.

  1. Navigate to Tanium Reveal and click the Quick Search button:


    CVE202222965HelpSpri_7d015723-bfce-4f13-8861-972e42b7dd84.png
  2. Perform two quick searches and then save them for re-use on-demand.

    1. In the text-entry box, enter "spring-core" (without the quotes) and click the Search button:


      CVE202222965HelpSpri_bb0a66ef-c276-4267-9425-9b207a3c7443.png
      After a moment or two, you will see the results of the Quick Search (you can investigate them later).
    2. Next, do the second one. In the text-entry box above, enter “spring-beans" and click the Search button:


      CVE202222965HelpSpri_8336aa5d-fda6-4644-a114-5aa8ba9f791e.png

      Again, you will see your results after a moment or two. 

  3. Save the Quick Searches so they can be run on-demand.

  4. From the results screen, click the Quick Search link near the top of the page:


    CVE202222965HelpSpri_a7116be5-b7d9-4bb6-b38e-a73cfe74c5e8.png
    On the left side of the Quick Search page you will see your recent searches. The search time – the most recent will be the spring-beans, and the previous one will be string-core.
    CVE202222965HelpSpri_5008218c-017c-443a-9a66-98107a4fda1d.png
  5. Save each one by clicking the "+" button next to each and naming them “Spring Beans” and “Spring Core”.


CVE202222965HelpSpri_648e5823-3460-41e0-9782-9c77d1e1c041.png
 

Once you have saved them, you will see them in the Saved Search section as shown below:


CVE202222965HelpSpri_70b19492-752d-424e-bc8d-79aed61bcad7.png

At this point, any reveal operator can simply navigate to the Tanium Reveal Quick Search page and issue the searches by clicking the magnifying glass icon next to the desired saved Search.


CVE202222965HelpSpri_12c72959-04d8-487e-8119-29126bbf2b24.png

Now the searches are saved and re-usable later.

Mitigation / Remediation

As this is a fast-moving topic, further information on mitigation or remediation with Tanium will be provided in a future article update. The preferred workaround is to upgrade the Spring Framework version 5.3.18 or higher, or version 5.2.20 or higher, depending on application requirements. Additional workarounds include:•    Downgrade to Java 8•    Set Disallowed Fields•    Upgrade Tomcat

Tanium Deploy

The Deploy Predefined Package Gallery includes software packages for the latest versions of Apache Tomcat. To use Deploy to update Apache Tomcat as a mitigation, simply import any Update Eligible Tomcat packages and deploy them. See Import a software package and Deploy a software package or bundleNo Content found for /db/organizations/tanium/repositories/master/content/documents/userguides/deploy/deploying_software.dita.

References