Trusted Design

T1648 - Serverless Execution

概要

Adversaries may abuse serverless computing, integration, and automation services to execute arbitrary code in cloud environments. Many cloud providers offer a variety of serverless resources, including compute engines, application integration services, and web servers.

Adversaries may abuse these resources in various ways as a means of executing arbitrary commands. For example, adversaries may use serverless functions to execute malicious code, such as crypto-mining malware (i.e. Resource Hijacking).(Citation: Cado Security Denonia) Adversaries may also create functions that enable further compromise of the cloud environment. For example, an adversary may use the IAM:PassRole permission in AWS or the iam.serviceAccounts.actAs permission in Google Cloud to add Additional Cloud Roles to a serverless cloud function, which may then be able to perform actions the original user cannot.(Citation: Rhino Security Labs AWS Privilege Escalation)(Citation: Rhingo Security Labs GCP Privilege Escalation)

Serverless functions can also be invoked in response to cloud events (i.e. Event Triggered Execution), potentially enabling persistent execution over time. For example, in AWS environments, an adversary may create a Lambda function that automatically adds Additional Cloud Credentials to a user and a corresponding CloudWatch events rule that invokes that function whenever a new user is created.(Citation: Backdooring an AWS account) This is also possible in many cloud-based office application suites. For example, in Microsoft 365 environments, an adversary may create a Power Automate workflow that forwards all emails a user receives or creates anonymous sharing links whenever a user is granted access to a document in SharePoint.(Citation: Varonis Power Automate Data Exfiltration)(Citation: Microsoft DART Case Report 001) In Google Workspace environments, they may instead create an Apps Script that exfiltrates a user's data when they open a file.(Citation: Cloud Hack Tricks GWS Apps Script)(Citation: OWN-CERT Google App Script 2024)

管理者によるコメント

T1648「Serverless Function」(サーバーレス関数) は、AWS Lambda、Google Cloud Functions、Azure Functionsなどの FaaS(Function as a Service) 環境を悪用して、悪意のあるコードを実行する手法です。

クラウドネイティブな環境において、サーバーの管理を必要としない「関数」の仕組みを攻撃の足がかりや実行基盤として利用します。

1. 概要

この手法で攻撃者は、「短時間実行・自動スケール・隠蔽性の高い攻撃インフラ」を実現します。

何を実現できるのか

2. 攻撃の流れ

攻撃者はまず、クラウド環境(AWS/GCP/Azure)の認証情報や、関数をデプロイできる権限を入手する必要があります。

  1. 権限の奪取:
    漏洩したアクセスキーの入手、あるいはCI/CDパイプラインの脆弱性を突き、サーバーレス関数を操作できる権限(例:lambda:UpdateFunctionCode)を得ます。

  2. 悪意のあるコードの注入:

    • 既存関数の改ざん: すでに運用されている関数のコードを書き換え、処理の裏でデータを攻撃者のサーバーへ送信するようにします。
    • 新規関数のデプロイ: 完全に独自の攻撃用関数を配備します。
  3. トリガーの設定:

    • HTTPリクエスト(API Gateway経由)や、ストレージへの書き込み、ログの発生などをトリガーとして、関数が自動で動くように設定します。
  4. 実行と持ち出し:
    関数が起動すると、環境変数からクラウドの認証情報を盗んだり、内部ネットワークにあるデータベースをスキャンしたりして、結果を外部へ送信します。

3. 防御・対策

「関数のコード」と「関数に与える権限」の両方を守ることが重要です。

4. 重要ポイント

5. 関連する主なCWE

6. 関連する代表的なCVE・攻撃事例

実務上のアドバイス

サーバーレス環境における「異常」を検知するには、「普段の実行時間のベースライン」を知ることが重要です。普段300msで終わる関数が、突然10秒(上限いっぱい)まで動くようになった場合、それは内部で攻撃ツールが動作している兆候かもしれません。

分析

この攻撃手法を利用する脅威アクター

この攻撃手法を利用する脅威アクターは登録されていません。

関連する CVE

攻撃手法 – 脅威アクター Graph


← Technique一覧に戻る ← Tactics一覧に戻る