SpringShellおよび最近のSpringの脆弱性CVE-2022-22963、CVE-2022-22965に対するPrisma Cloudによる緩和策

Apr 08, 2022
5 minutes
... views

概要

最近Spring Frameworkに影響を与える複数の脆弱性が公表されました。3月の初め以降に発表された4つの脆弱性の中では、2022年3月31日に明らかにされたCVE-2022-22965が最も影響が重大で、SpringShellと呼ばれています。

SpringShell脆弱性は、影響を受けたシステムに攻撃者が未認証でリモートコード実行(RCE)を行うことを可能にします。SpringShell脆弱性に関する分析の全文は、Unit 42 脅威に関する情報をご覧ください。

Prisma Cloudは、あらゆるクラウド資産で最近のすべてのSpringShell脆弱性を検出できます。影響を受けたインスタンスを検出するだけでなく、Prisma Cloudは脆弱なコンテナイメージの実行を防いだり停止したりもできます。また、Prisma Cloudはさまざまな機能やエクスプロイト後の手法により脆弱性のエクスプロイトを防止します。

背景

Spring Frameworkは、Javaプラットフォームのための包括的なオープンソース アプリケーション フレームワークです。その強力な機能と使いやすさから、業界で幅広く利用されています。Spring Coreコンポーネントはフレームワークの中核となるもので、Inversion of Control (制御の反転)や依存性注入などの強力な機能を提供しています。これには、core、beans、context、Spring Expression Language (SpEL)モジュールが含まれています。

Spring Cloud Functionは、ビジネスロジックの開発ライフサイクルを促進し、サーバーレスプロバイダ間で統一されたプログラミングモデルをサポートするために設計されたプロジェクトです。Spring Expression Language (SpEL)は、メソッドの呼び出しや基本的な文字列テンプレート機能を含むUnified ELを利用し、実行時のオブジェクトのクエリと操作をサポートします。

3月の初め以降、Spring Frameworkに関するCVEが合計4つ公表されています。

Prisma Cloudの検出機能

Prisma Cloudのユーザーは、CVE-2022-22963またはCVE-2022-22965のいずれかの脆弱性の影響を受けたソフトウェアコンポーネントを検出できます。Prisma Cloud Intelligence Stream (IS)は、公式なベンダーフィードからの脆弱性情報が含まれるよう、自動的に更新されます。これにより、Prisma CloudではLinuxディストリビューションやアプリケーションメンテナによるあらゆる更新や分析を直接反映でき、影響を受けたあらゆる機能、イメージ、ホストを検出できます。

また、Prisma Cloudではシステムやアプリケーションに影響を与えるものでありながら、CVE追跡番号を割り当てられてこなかった、またはまだ割り当てられていない、業界で知られた厳選された一連の脆弱性を対象としたPRISMA IDも採用しています。 業界で知られているもののCVE追跡番号をまだ割り当てられていない脆弱性はPrisma Cloudのクラウド セキュリティ リサーチ チーム(CSRT)で分析され、Prisma CloudのISに追加されます。業界で知られた脆弱性を追跡するPRISMA-IDにより、Prisma Cloudでは短時間でクライアント環境に脆弱性検出ルールをプッシュできます。多くの場合、CVE情報が公開されるよりも早くプッシュが可能です。

その典型例であるSpringShell脆弱性(CVE-2022-22965)は、Prisma IDのルールが公開されたCVE情報よりも早いペースで脆弱性を検出している一例です。SpringShell CVE (CVE-2022-22965)は2022年3月31日に公開されましたが、Prisma CloudのCSRTはPrisma IDルール「PRISMA-2022-0130」を2022年3月30日に公開しています。つまり、Prisma Cloudのクラウドワークロード保護(CWP)モジュールのクライアントは、その脆弱性のその正式リリースの何時間も前にCVE-2022-22965を検出できたことになります。

図1: Intelligence StreamのPRISMA-2022-0130
図1: Intelligence StreamのPRISMA-2022-0130

このリスクを抱えるホストがないか環境をクエリ

Prisma CloudのRQL (Resource Query Language)では、影響を受けたリソースを迅速かつ簡単にクエリできます。ユーザーは、Prismaプラットフォームの機能を使用して脆弱性のある資産を分離し、インターネットに公開されトラフィックを受信している資産を探すことでそれらをさらに優先順位付けできます。

CVE-2022-22963またはCVE-2022-22965という具体的な脆弱性を持つクラウド内のホストを把握するには以下をクエリします。

図2: RQLクエリとWAAS検出によるホストのCVE-2022-22963とCVE-2022-22965の脆弱性情報
図2: RQLクエリとWAAS検出によるホストのCVE-2022-22963とCVE-2022-22965の脆弱性情報

クラウドでトラフィックを受信しており、CVE-2022-22963またはCVE-2022-22965という具体的な脆弱性を持つインターネットに公開されたホストを把握するには以下をクエリします。

図3: ネットワークRQLクエリとWAAS検出による脆弱なインスタンスの調査
図3: ネットワークRQLクエリとWAAS検出による脆弱なインスタンスの調査

WAASが有効となっているPrisma Cloudユーザーは、弊社がSpringShellについて分析したエクスプロイト(CVE-2022-22965)の大半からApp Firewall Code Injection検出機能によって保護されます。

図4: WAASがSpring4Shellエクスプロイトを防御
図4: WAASがSpring4Shellエクスプロイトを防御

CVE-2022-22965 (Spring4Shell)とCVE-2022-22963 (Spring Cloud Function)に対し、それらの回避も含めより正確に対応するためにカスタムルールを作成しました。WAASが有効となっているユーザーは、下記の新しいカスタムルールを保護のためにインポートできます。

WAASバージョン22.01.839以上に対応したルールは次の通りです。

図5: WAAS 22.01.839 Spring4Shellルール
図5: WAAS 22.01.839 Spring4Shellルール

WAASバージョン21.08.525以上に対応したルールは次の通りです。

Graphical user interface, text, applicationDescription automatically generated
図6: WAAS 21.08.525 Spring4Shellルール

要約

SpringShellは幅広く利用されているSpring Frameworkの深刻な脆弱性でした。SpringShellには正式にCVE-2022-22965が割り当てられ、2022年3月31日にパッチがリリースされました。さらに、2022年3月の初め以降、Spring Cloud Gateway、Spring Expression Language (SpEL)、Spring Cloud Functionのコンポーネントに影響を及ぼす3つの脆弱性がこのほかに公表されています。

Prisma Cloudは、デプロイメント内のすべての脆弱なインスタンスの検出を支援します。Prisma Cloudは、この問題に対して脆弱なすべてのイメージやホストの実行を完全に防ぐよう設定することもできます。

SpringShell脆弱性に関する詳細な技術分析については、パロアルトネットワークスのUnit 42の脅威に関する情報を参照してください。


Prisma Cloud Mitigations for SpringShell and Recent Spring Vulnerabilities: CVE-2022-22963, CVE-2022-22965

Mar 31, 2022
8 minutes
... views

Executive Summary

In the past week, multiple vulnerabilities affecting the Spring Framework have been disclosed to the public. Among four vulnerabilities released since the beginning of March, CVE-2022-22965, which was uncovered on March 31, 2022, had the most critical impact and was dubbed SpringShell.

The SpringShell vulnerability allows attackers unauthenticated remote code execution (RCE) to affected systems. A full analysis of the SpringShell vulnerability can be found in the Unit 42 Threat Brief.

Prisma Cloud can detect all recent SpringShell vulnerabilities across all cloud assets. In addition to detecting affected instances, Prisma Cloud can prevent and stop the execution of vulnerable container images. Prisma Cloud is also able to prevent exploitation of the vulnerabilities with different capabilities as well as post-exploitation techniques.

 

Background

The Spring Framework is an open-source and comprehensive application framework for the Java Platform. It is widely used in the industry due to its powerful features and ease of use. The Spring Core component is the core of the framework that provides powerful features such as Inversion of Control and dependency injection. It contains core, beans, context, and the Spring Expression Language (SpEL) modules.

The Spring Cloud Function is a project that is designed to promote the development lifecycle of business logic and support uniform programming models across serverless providers. Where the Spring Expression Language (SpEL) supports the querying and manipulation of an object at runtime, using a Unified EL which includes method invocation and basic string templating functionality.

Since the beginning of March, there have been a total of four CVEs published pertaining to the Spring Framework:

 

Prisma Cloud Detection Capabilities

Prisma Cloud users can detect software components affected by either of these two vulnerabilities, CVE-2022-22963 or CVE-2022-22965. The Prisma Cloud Intelligence Stream (IS) automatically updates to include the vulnerability information from official vendor feeds. This allows Prisma Cloud to directly reflect any updates or analysis by Linux distribution and application maintainers, allowing Prisma Cloud to detect any affected functions, images, and hosts.

Prisma Cloud also employs the use of PRISMA IDs which contain a curated set of industry-known vulnerabilities affecting systems and applications, but which have not been, or not yet been, assigned CVE tracking numbers. Vulnerabilities that are industry known but have yet to be assigned a CVE tracking number are analyzed by Prisma Cloud’s Cloud Security Research Team (CSRT) and then added to Prisma Cloud’s IS. With PRISMA-IDs to track industry-known vulnerabilities, Prisma Cloud can push vulnerability detection rules to client environments in short order, often times faster than CVE publications are released to the public.

Case in point, the SpringShell vulnerability (CVE-2022-22965) is one such example of Prisma IDs rules providing vulnerability detections at a faster rate than public CVE publications. The SpringShell CVE (CVE-2022-22965) was published on March 31, 2022, however, Prisma Cloud’s CSRT published the Prisma ID rule ‘PRISMA-2022-0130’ on March 30, 2022. This equates to clients of Prisma Cloud’s Cloud Workload Protection (CWP) module being capable of detecting CVE-2022-22965 hours prior to the official vulnerability release.

 

Figure 1. PRISMA-2022-0130 in Intelligence Stream
Figure 1. PRISMA-2022-0130 in Intelligence Stream

 

Query Your Environments for Hosts with This Risk

Prisma Cloud’s RQL (Resource Query Language) provides a quick and easy way to query for resources impacted. In this case, users can utilize the Prisma platform's capabilities to isolate assets with vulnerabilities and prioritize them further by looking for internet-exposed assets receiving traffic.

Know the hosts in your cloud that have the specific vulnerability CVE-2022-22963 or CVE-2022-22965:

config from cloud.resource where finding.type = 'Host Vulnerability' AND finding.name IN ('CVE-2022-22963', 'CVE-2022-22965')

Figure 2. CVE-2022-22963 and CVE-2022-22965 vulnerability information for hosts with RQL query/WAAS Detections
Figure 2. CVE-2022-22963 and CVE-2022-22965 vulnerability information for hosts with RQL query/WAAS Detections

 

Know the Internet exposed hosts that are receiving traffic in your cloud and have the specific vulnerability CVE-2022-22963 or CVE-2022-22965:

network from vpc.flow_record where bytes > 0 AND destination.resource IN ( resource where finding.type IN ( 'Host Vulnerability' ) AND finding.source IN ( 'Prisma Cloud' ) AND finding.name IN ('CVE-2022-22963', 'CVE-2022-22965') ) AND source.publicnetwork IN ('Internet IPs', 'Suspicious IPs')

 

Figure 3. Investigating vulnerable instances with the network RQL queryWAAS Detections
Figure 3. Investigating vulnerable instances with the network RQL queryWAAS Detections

 

Prisma Cloud users with WAAS enabled are protected from the majority of exploits we analyzed for SpringShell (CVE-2022-22965) by the App Firewall Code Injection detection feature.

Figure 4. WAAS prevents Spring4Shell exploitation
Figure 4. WAAS prevents Spring4Shell exploitation

 

Custom rule was created to more accurately cover CVE-2022-22965 (Spring4Shell) and CVE-2022-22963 (Spring Cloud Function) including their bypasses, users with WAAS enabled may import the following new custom rules for protection:

Rule compatible for WAAS version 22.01.839 and above:

Figure 5. WAAS 22.01.839 Spring4Shell Rule
Figure 5. WAAS 22.01.839 Spring4Shell Rule

 

urlQueryDecode(unicodeDecode(compressWhitespace(req.header_names))) contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

urlQueryDecode(unicodeDecode(compressWhitespace(req.header_values))) contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

urlQueryDecode(unicodeDecode(compressWhitespace(req.body))) contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

urlQueryDecode(unicodeDecode(compressWhitespace(req.body_param_values))) contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

urlQueryDecode(unicodeDecode(compressWhitespace(req.query_param_names))) contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

urlQueryDecode(unicodeDecode(compressWhitespace(req.query_param_values))) contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

 

Rule compatible for WAAS version 21.08.525 and above:

Figure 6. WAAS 21.08.525 Spring4Shell Rule
Figure 6. WAAS 21.08.525 Spring4Shell Rule

 

req.header_names contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

req.header_values contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

req.body contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

req.body_param_values contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

req.query_param_names contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

or

req.query_param_values contains /(?i)(?:extends\s*?ClassLoader\s*?\{|Base64\.getDecoder\s*?\(|java\.io\.InputStream|java\.lang\.Process\s*?\(|java\.lang\.Runtime\s*?\(|utility\.Execute\s*?\(|\.getRuntime\s*?\(\s*?\)|\.getInputStream\s*?\(|ProcessBuilder\s*\(\s*\)|\.newSingleThreadExecutor\s*?\(\))((.|\s)*?\.exec\s*?\()?/

 

Summary

SpringShell was a severe vulnerability affecting the widely used Spring Framework. SpringShell is officially assigned CVE-2022-22965 and the patch was released on March 31, 2022. In addition, three other vulnerabilities affecting the Spring Cloud Gateway, Spring Expression Language (SpEL), and Spring Cloud Function components have been disclosed since the beginning of March 2022.

Prisma Cloud can help in detecting all vulnerable instances in your deployments. Prisma Cloud may also be configured to fully prevent running any images or hosts vulnerable to this issue.

For an in-depth technical analysis of the SpringShell vulnerability, please refer to Palo Alto Networks Unit 42’s Threat Brief.

 

 


Subscribe to the Newsletter!

Sign up to receive must-read articles, Playbooks of the Week, new feature announcements, and more.