[アップデート]Amazon DetectiveがAmazon GuardDuty ECS Runtime Monitoringの検出結果の調査をサポートするようになりました #AWSreinvent

こんにちは。AWS事業本部トクヤマシュンです。

re:Invent2023期間中の2023/11/26にAmazon DetectiveがAmazon GuardDuty ECS Runtime Monitoringの検出結果の調査をサポートするようになりました。

Amazon GuardDuty ECS Runtime Monitoringを利用する際には、是非ともセットで使いたい機能ですね。
本エントリではこちらの概要についてまとめます。

なお、Amazon GuardDuty ECS Runtime Monitoringについては下記エントリでまとめてますのでご参照ください。

本機能についてサマリ

Amazon DetectiveはAWS アカウントとワークロード全体にわたる潜在的なセキュリティ問題を調査できるように設計されたマネージドセキュリティサービスです。 有効化すると、Amazon GuardDutyの検出結果やAWS CloudTrailのログなどを取り込み、他の検出結果との相関関係の表示、グラフの視覚化、といった調査を効率的に行うためのサポートを行ってくれます。

今回のアップデートの内容は、Amazon GuardDutyがECS Runtime Monitoringの検出に対応したのにあわせて、Amazon Detectiveでもその調査が行えるようになった、というものです。
対象リージョンはAmazon Detectiveを有効化することができる全てのリージョンとなっています。

試してみる

では、早速試してみます。
結論から先に申しておくと、今回私の環境ではAmazon Detectiveを使った調査はうまくいきませんでした。
2023/12/04 19:30追記:少し待てば調査できましたので、調査結果を追記しました。

では、どのように試してみたのかについて説明していきます。
まず、Amazon GuardDuty ECS Runtime Monitoringが有効化されているECSタスクを準備します。 (この準備についてはこちらのエントリをご参考ください)

この状態で、ECSタスク内のコンテナに対してECS Execでログインし、nmapをインストールして、GuadDutyで検出してみます。
今回はコンテナイメージとしてpublic.ecr.aws/nginx/nginx:stableを利用しました。
こちらはDebianベースのイメージですので、ECS Execでログイン後、下記コマンドを実行します。

# apt update
# apt install -y nmap

すると、Execution:Runtime/NewBinaryExecutedという検出結果をもつ次のようなFindingsの発生をAmazon GuardDutyで確認することができました。

Execution:Runtime/NewBinaryExecuted検出結果(クリックで展開)
[
  {
    "AccountId": "xxxxxxxxxxxx",
    "Arn": "arn:aws:guardduty:ap-northeast-1:xxxxxxxxxxxx:detector/22c2d28c09f954a78dd9508e2f02fba9/finding/ccc61a216416b57372c3848fae95dc13",
    "CreatedAt": "2023-12-04T09:57:20.699Z",
    "Description": "Process in container executed a newly created binary.",
    "Id": "ccc61a216416b57372c3848fae95dc13",
    "Partition": "aws",
    "Region": "ap-northeast-1",
    "Resource": {
      "ResourceType": "ECSCluster",
      "EcsClusterDetails": {
        "Name": "test-nginx",
        "Arn": "arn:aws:ecs:ap-northeast-1:xxxxxxxxxxxx:cluster/test-nginx",
        "Status": "ACTIVE",
        "ActiveServicesCount": null,
        "RegisteredContainerInstancesCount": null,
        "RunningTasksCount": null,
        "Tags": [
          {
            "Key": "GuardDutyManaged",
            "Value": "true"
          },
          {
            "Key": "aws:cloudformation:stack-name",
            "Value": "Infra-ECS-Cluster-test-nginx-e41b57b4"
          },
          {
            "Key": "aws:cloudformation:logical-id",
            "Value": "ECSCluster"
          },
          {
            "Key": "aws:cloudformation:stack-id",
            "Value": "arn:aws:cloudformation:ap-northeast-1:xxxxxxxxxxxx:stack/Infra-ECS-Cluster-test-nginx-e41b57b4/3b0645f0-8d24-11ee-a175-0e49582b4b55"
          }
        ],
        "TaskDetails": {
          "Arn": "arn:aws:ecs:ap-northeast-1:xxxxxxxxxxxx:task/test-nginx/2b18c21a41c74ae0a9f863a5901bddbb",
          "DefinitionArn": "arn:aws:ecs:ap-northeast-1:xxxxxxxxxxxx:task-definition/test-nginx:3",
          "Version": "3",
          "TaskCreatedAt": "2023-12-04T09:49:33.763Z",
          "StartedAt": null,
          "StartedBy": "ecs-svc/3003319634775897312",
          "Containers": [
            {
              "ContainerRuntime": "containerd",
              "Id": "2b18c21a41c74ae0a9f863a5901bddbb-2531612879",
              "Name": "nginx",
              "Image": "public.ecr.aws/nginx/nginx:stable",
              "ImagePrefix": null
            }
          ],
          "Group": null
        }
      }
    },
    "SchemaVersion": "2.0",
    "Service": {
      "Action": {},
      "Archived": false,
      "Count": 1,
      "DetectorId": "22c2d28c09f954a78dd9508e2f02fba9",
      "EventFirstSeen": "2023-12-04T09:54:51.518Z",
      "EventLastSeen": "2023-12-04T09:54:51.518Z",
      "ServiceName": "guardduty",
      "AdditionalInfo": {
        "Value": "{}",
        "Type": "default"
      },
      "FeatureName": "RuntimeMonitoring",
      "RuntimeDetails": {
        "Process": {
          "Name": "nmap",
          "ExecutablePath": "/usr/bin/nmap",
          "ExecutableSha256": "8fffb2743a224555096f3a04effb296b327a05698ed70b20b7913d7063823a49",
          "NamespacePid": 472,
          "Pwd": "/",
          "Pid": 3409,
          "StartTime": "2023-12-04T09:54:51.518Z",
          "Uuid": "9d6fcc65-d835-4fdc-df7a-f956ea83959c",
          "ParentUuid": "4da2fdf1-acc1-06ae-b42a-171b8b9f61ef",
          "User": "root",
          "UserId": 0,
          "Euid": 0,
          "Lineage": [
            {
              "StartTime": "2023-12-04T09:53:49.852Z",
              "NamespacePid": 62,
              "UserId": 0,
              "Name": "sh",
              "Pid": 2991,
              "Uuid": "4da2fdf1-acc1-06ae-b42a-171b8b9f61ef",
              "ExecutablePath": "/bin/dash",
              "Euid": 0,
              "ParentUuid": "2917dbb2-5aa7-a85d-b82b-4369ee00ea16"
            },
            {
              "StartTime": "2023-12-04T09:53:48.507Z",
              "NamespacePid": 53,
              "UserId": 0,
              "Name": "ssm-session-wor",
              "Pid": 2981,
              "Uuid": "2917dbb2-5aa7-a85d-b82b-4369ee00ea16",
              "ExecutablePath": "/managed-agents/execute-command/ssm-session-worker",
              "Euid": 0,
              "ParentUuid": "497d24aa-c431-6a9a-e83d-9f3eb691e183"
            },
            {
              "StartTime": "2023-12-04T09:50:08.114Z",
              "NamespacePid": 44,
              "UserId": 0,
              "Name": "ssm-agent-worke",
              "Pid": 2943,
              "Uuid": "497d24aa-c431-6a9a-e83d-9f3eb691e183",
              "ExecutablePath": "/managed-agents/execute-command/ssm-agent-worker",
              "Euid": 0,
              "ParentUuid": "3caf525c-6768-95a7-1557-9eadbed0ee98"
            },
            {
              "StartTime": "2023-12-04T09:50:03.554Z",
              "NamespacePid": 7,
              "UserId": 0,
              "Name": "amazon-ssm-agen",
              "Pid": 2893,
              "Uuid": "3caf525c-6768-95a7-1557-9eadbed0ee98",
              "ExecutablePath": "/managed-agents/execute-command/amazon-ssm-agent",
              "Euid": 0,
              "ParentUuid": "934185ac-4734-bf83-d7ca-3649f587844c"
            }
          ]
        },
        "Context": {
          "ModifyingProcess": {
            "Name": "dpkg",
            "ExecutablePath": "/usr/bin/dpkg",
            "ExecutableSha256": "c92aa5a52a7aa420e5ca32e61297aadd695be7f2dc5bb99eb40b105f31b35d04",
            "NamespacePid": 318,
            "Pwd": "/",
            "Pid": 3252,
            "StartTime": "2023-12-04T09:54:29.721Z",
            "Uuid": "ab115e27-822b-24c5-e1df-b5a0d5b1a092",
            "ParentUuid": "7acd4568-8353-7b41-9bad-a9cb11ef8420",
            "User": "root",
            "UserId": 0,
            "Euid": 0
          },
          "ModifiedAt": "2023-12-04T09:54:40.421Z"
        }
      }
    },
    "Severity": 5,
    "Title": "Container executed a newly created binary file.",
    "Type": "Execution:Runtime/NewBinaryExecuted",
    "UpdatedAt": "2023-12-04T09:57:20.699Z"
  }
]

検出結果を確認すると、どのクラスターでどういったコンテナで不正操作が行われたか、まで詳しく分かりますね。 Amazon GuardDutyの画面では次のように表示されます。

ここで、「investigate with Detective」というリンクをクリックすると、下記のようにAmazon Detectiveの調査画面へのリンクが表示されます。

このリンクから、Amazon Detectiveに画面遷移できます。

Amazon Detectiveの画面では、ECS Task、AWS Account、Container image、ECS clusterといった情報を一元的に確認することができます。
試しに左下のContainer imageについて「See profile」から詳細を見てみました。

コンテナイメージの取得元リポジトリやレジストリ、タグといった情報がわかります。
どのようなコンテナイメージで脅威が検出されているのか、調査する上で役に立つのではないでしょうか。

まとめ

今回のエントリではAmazon DetectiveがAmazon GuardDuty ECS Runtime Monitoringの検出結果の調査をサポートするようになったアップデートについてまとめました。
Amazon GuardDuty ECS Runtime Monitoringを利用する際には、是非ともセットで使いたい機能かと思います。
皆様も是非一度お試しされてみてはいかがでしょうか?