Azurescapeについて知っておくべきこと

Sep 23, 2021
1 minutes
... views

Unit 42 脅威インテリジェンスチームは、パブリッククラウドサービスにおいて、あるユーザーが自分の環境からエスケープし、同じパブリッククラウドサービスの他のユーザーが所有する環境上でコードを実行することができる脆弱性を、知られているかぎり初めて発見しました。これまでに報告のないこのクロスアカウント型の乗っ取り(テイクオーバー)は、MicrosoftのCaaS(Container-as-a-Service サービスとしてのコンテナ)プラットフォームAzureに影響するものでした。この攻撃はコンテナのエスケープ(コンテナ環境からの特権拡大を可能にする技術を指す)から始まることから、リサーチャーは、この発見を「Azurescape」と名付けました。

私たちからMicrosoft Security Response Center(MSRC)への報告後、Microsoftはすぐに根本的な問題を解決するための迅速な対応を行いました。本稿執筆時点で弊社はAzurescapeによる攻撃が実際に発生したことは確認していませんが、Azure Container Instances(ACI)プラットフォームの悪意のあるユーザーは、他の顧客の環境への事前アクセスがない状態で、この脆弱性を利用してそれら顧客のコンテナ上でコードを実行できていた可能性があります。

Azurescapeでは、ACIユーザーがコンテナのクラスタ全体に対する管理者権限を得ることができます。そこから、この影響を受けるマルチテナントクラスタを乗っ取り、悪意のあるコードを実行したり、データを盗んだり、他の顧客の基盤インフラを破壊したりすることができます。攻撃者は、他の顧客のコンテナをホストするAzureのサーバーを完全に制御し、それらの環境に保存されているすべてのデータと機密情報にアクセスすることができました。

Azurescapeがクラウドセキュリティについて教えてくれること

パブリッククラウドは、マルチテナンシーと呼ばれる概念で運営されています。クラウドサービスプロバイダは、単一のプラットフォーム上に複数の組織(テナント)を受け入れる環境を構築し、それぞれに安全なアクセスを提供するとともに、大規模なクラウド基盤を構築することで、これまでにないスケールメリットを実現しています。

クラウドプロバイダは、これらのマルチテナント型プラットフォームのセキュリティ確保に多大な投資を行っていますが、未知の「ゼロデイ」脆弱性が存在し、同じクラウドインフラ内の他のインスタンスから顧客が攻撃を受ける危険性があることは、以前から避けられないと考えられていました。

今回の発見により、クラウド利用者は、クラウドプラットフォームの内外を問わず、脅威を継続的に監視することを含め、クラウドインフラストラクチャの安全性を確保するために、「多層防御」のアプローチをとる必要があることが明らかになりました。また、Azurescapeの発見は、クラウドサービスプロバイダが、未知の脅威を探すために外部のリサーチャーが環境を調査するための適切なアクセスを提供する必要性を強調しています。

パロアルトネットワークスは、パブリッククラウドのセキュリティ向上に向けた取り組みの一環として、パブリッククラウドプラットフォームや関連技術の高度な脅威モデルや脆弱性テストなどの研究に積極的に投資しています。

Microsoftがセキュリティを第一と考え、外部のリサーチャーとの協力に関する業界最先端のプログラムを通じてAzure全体での外部からの侵入テストを可能にし、他のベンダに素晴らしい手本を示していることを評価したいと思います。協調的なセキュリティ研究は、イノベーションを促進するクラウドサービスの継続的開発を進め、保護していくには不可欠です。弊社はまた、MSRCからのバウンティにもお礼申し上げます。

AzurescapeについてのQ&A

Azurescape発見の経緯については、Unit 42ブログ「Azurescapeの発見: Azure Container Instances(ACI)におけるクロスアカウントでのコンテナ乗っ取り」の全文をお読みいただくことをお勧めします。本校ではAzurescapeがどのように機能するかや、お使いの環境が影響を受けることがわかった場合にどうすればよいかについて、いくつか簡単な事実を紹介します。

影響の有無を確認するには

Unit 42ではAzurescapeが実際に悪用されている様子は確認していません。この脆弱性はACIの提供開始当初から存在していた可能性があるので、影響を受けた組織が存在する可能性はあります。AzurescapeはAzure Virtual NetworksのACIコンテナにも影響を与えていました。

ACIは、お客様のコンテナをホストするマルチテナント型クラスタ上に構築されています。もともとはKubernetesのクラスタでしたが、この1年でMicrosoftはACIをService Fabricクラスタでもホスティングするようになりました。Azurescapeは、Kubernetes上のACIにのみ影響を与えます。私たちは、過去にACIコンテナがKuberntetesの上で実行されていたかどうかを確認する方法については把握していません。既存コンテナがKubernetesの上で動作しているかどうかを確認するには、以下のコマンドを実行します。

このコマンドの結果が wk-caasで始まるもので、そのコンテナが2021年8月31日以前に稼働を開始していた場合、Azuresapeによる攻撃は可能であったと考えられます。

自社が影響を受けていたと考えられる場合の対応について

プラットフォームに特権的な認証情報をデプロイしている場合は、認証情報をローテーションし、アクセスログに不審な動きがないか確認することをお勧めします。

Prisma Cloudのようなクラウドネイティブのセキュリティプラットフォームは、この種のアクティビティを可視化し、必要に応じてアラートを発報することができます。

攻撃の機序

Azurescape攻撃は3段階で行われます。第1段階として、攻撃者は自身のACIコンテナからエスケープする必要があります。第2段階では、マルチテナント型Kubernetesクラスタの管理者権限を奪取します。第3段階で悪意のあるコードを実行することで、影響を受けるコンテナを制御可能になります。

私たちの研究は、クラウドプラットフォームの基盤コンテナランタイムを明らかにするコンテナイメージであるWhoCから始まりました。WhoCを通じ、runCの2年前の脆弱性(CVE-2019-5736)を利用して、ACIコンテナをエスケープすることが可能であることを発見しました。その後、クラスタの頭脳であるapi-server上でコード実行のための2つの異なる方法を確認することができました。

api-server上でコードを実行することで、マルチテナントクラスタを完全にコントロールすることに成功しました。この段で、顧客のコンテナ上でコードを実行することも、ACIにデプロイされた顧客の機密を流出させることも、さらにはプラットフォームのインフラを暗号化のために悪用することも可能となりました。

クロスアカウントでのコンテナ乗っ取りの脆弱性は今後も出現するか

ここ数年、クラウドへの移行が急速に進んだことで、これらのプラットフォームは悪意あるアクターの格好の標的となっています。私たちは以前からクラウドの新たな脅威を特定することに注力してきましたが、今回初めてクロスアカウントでのコンテナ乗っ取りが発見されたことで、この取り組みの重要性が浮き彫りになりました。洗練された攻撃者は、エンドユーザーをターゲットにするだけでは満足せず、影響力と影響範囲の拡大のため、プラットフォーム自体にキャンペーンを拡大することもあります。

同様の脆弱性の登場に備える方法

クラウドユーザーには、外部からの脅威であれ、プラットフォーム自体からの脅威であれ、確実に侵害を封じ込めて検知していくため、クラウドセキュリティに「多層防御」アプローチをとることをお勧めします。シフトレフトセキュリティ、ランタイム保護、アノマリ検出を組み合わせることで、同様のクロスアカウント攻撃に対抗することができます。

あらゆるクラウド環境への攻撃を防ぐ最善の方法は、クラウド環境の脆弱性特定にくわえ、悪意のある振る舞いを検出して緩和できるPrisma Cloudのような包括的クラウドネイティブセキュリティプラットフォームを導入することです。Prisma Cloudがどのようにしてハイブリッド環境やマルチクラウド環境におけるインフラストラクチャ、アプリケーション、データを保護することができるのかについては、こちらからご確認ください。


What You Need to Know About Azurescape

Sep 09, 2021
6 minutes
... views

The Unit 42 Threat Intelligence team has identified the first known vulnerability that could enable one user of a public cloud service to break out of their environment and execute code on environments belonging to other users in the same public cloud service. This unprecedented cross-account takeover affected Microsoft's Azure Container-as-a-Service (CaaS) platform. Researchers named the finding Azurescape because the attack started from a container escape – a technique that enables privilege escalation out of container environments.

Microsoft took swift action to fix the underlying issues as soon as we reported them to the Microsoft Security Response Center (MSRC). We’re not aware of any Azurescape attacks in the wild, but it is possible that a malicious user of the Azure Container Instances (ACI) platform could have exploited the vulnerability to execute code on other customers' containers, without any prior access to their environment.

Azurescape allows an ACI user to gain administrative privileges over an entire cluster of containers. From there, the user could take over the impacted multitenant clusters to execute malicious code, steal data or sabotage the underlying infrastructure of other customers. The attacker could gain complete control over Azure’s servers that host containers of other customers, accessing all data and secrets stored in those environments.

 

What Azurescape Tells Us About Cloud Security

Public clouds operate on a concept known as multitenancy. Cloud service providers build environments that host multiple organizations (or “tenants”) on a single platform, providing secure access to each while leveraging unprecedented economies of scale by building massive cloud infrastructures.

While cloud providers invest heavily in securing these multitenant platforms, it's long been seen as inevitable that unknown “zero-day” vulnerabilities could exist and put customers at risk of attack from other instances within the same cloud infrastructure.

This discovery highlights the need for cloud users to take a “defense-in-depth” approach to securing their cloud infrastructure that includes continuous monitoring for threats – inside and outside the cloud platform. Discovery of Azurescape also underscores the need for cloud service providers to provide adequate access for outside researchers to study their environments, searching for unknown threats.

As part of the commitment of Palo Alto Networks to advancing public cloud security, we actively invest in research that includes advanced threat modeling and vulnerability testing of public cloud platforms and related technologies.

We'd like to recognize Microsoft for setting a great example for other vendors through its industry-leading program for working with outside researchers, which puts security first and allows external penetration testing across Azure. Cooperative security research is vital for advancing and protecting the ongoing development of cloud services that spur innovation. We'd also like to thank MSRC for presenting us with bounty awards.

 

Questions and Answers About Azurescape

For a deep dive into how we discovered Azurescape, we encourage you to read the full report on the Unit 42 blog, “Finding Azurescape – Cross-Account Container Takeover in Azure Container Instances.” Here are a few quick facts on how Azurescape works and what to do if you are affected:

 

Was I Affected?

We have no knowledge of Azurescape being exploited in the wild. It’s possible the vulnerability existed from ACI's inception, so there is a chance that some organizations were affected. Azurescape also affected ACI containers in ​​Azure Virtual Networks.

ACI is built on multitenant clusters that host customer containers. Originally those were Kubernetes clusters, but over the past year Microsoft started hosting ACI on Service Fabric clusters as well. Azurescape only affects ACI on top of Kubernetes. We don't know of a way to check whether a past ACI container ran on top of Kuberntetes. If you have an existing container, you can run the following command to check whether it runs on top of Kubernetes:

az container exec -n <container-name> --exec-command "hostname"

If the output starts with wk-caas and the container started running before Aug. 31, 2021, it could have been attacked by Azuresape.

 

What Should I Do if I Think I Was Affected?

If you have privileged credentials deployed to the platform, we recommend rotating them and checking their access logs for suspicious activity.

A cloud native security platform such as Prisma Cloud can provide visibility into this type of activity and alert where appropriate.

 

How Do the Attacks Work?

Azurescape is a three-step attack. First, the attacker must break out of their ACI container. Second, they gain administrative privileges over a multitenant Kubernetes cluster. Third, they can take control of impacted containers by executing malicious code.

Our research started with WhoC, a container image that uncovers the underlying container runtime of cloud platforms. Through WhoC, we discovered it was possible to escape ACI containers through CVE-2019-5736, a two-year-old vulnerability in runC. We were then able to identify two different methods to gain code execution on the cluster's brain, the api-server.

With code execution on the api-server, we had complete control over the multitenant cluster. We could execute code on customer containers, exfiltrate customer secrets deployed to ACI and possibly even abuse the platform infrastructure for cryptomining.

 

Do You Expect More Cross-Account Takeover Vulnerabilities to Emerge?

The rapid acceleration of the shift to the cloud that has occurred in the past few years has made these platforms a prized target for malicious actors. While we’ve long been focused on identifying new cloud threats, discovery of the first cross-account container takeover underscores the importance of that effort. Sophisticated attackers may not be satisfied with targeting end users, and may expand their campaigns to the platforms themself to increase impact and reach.

 

Is There Any Way I Can Prepare for Similar Vulnerabilities That Might Emerge?

Cloud users are encouraged to adopt a "defense-in-depth" approach to cloud security to ensure breaches are contained and detected, whether the threat is from the outside or from the platform itself. A combination of shift-left security and runtime protection and anomaly detection presents the best chance of combating similar cross-account attacks.

The best way to prevent attacks on any cloud environment is to implement a comprehensive cloud native security platform such as Prisma Cloud, which is able to detect and mitigate malicious behavior as well as identify vulnerabilities in cloud environments. Learn how Prisma Cloud can secure infrastructure, applications and data across hybrid and multicloud environments.

To learn more about Azurescape, join a webinar with Ariel Zelivansky and Yuval Avrahami, “Azurescape: What to Know About the Microsoft ACI Vulnerability.”


Subscribe to the Blog!

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