次の方法で共有


高度なハンティングにおける Kubeaudit イベント

Kubernetes Kubeaudit イベント (および Azure Resource Manager クラウド監査) は、Microsoft Defender ポータルの高度なハンティングで使用できます。

Kubernetes コントロール プレーンの攻撃対象領域と Azure Resource Management で発生したインシデントをトリアージして調査できます。 高度なハンティングを使用して、脅威事前に検出することもできます。

さらに、疑わしい Resource Manager および Kubernetes (KubeAudit) コントロール プレーン アクティビティにカスタム検出を作成できます。

この機能の対象は次のとおりです:

  • Azure (Azure Kubernetes Service)、アマゾン ウェブ サービス (Amazon Elastic Kubernetes Service)、Google Cloud Platform (Google Kubernetes Engine)、オンプレミスからの Kubernetes KubeAudit イベント

  • Resource Manager コントロール プレーン イベント

開始するには、CloudAuditEvents と呼ばれる高度なハンティングで [スキーマ] タブに追加された新しいテーブル参照してください。

高度なハンティングの [スキーマ] タブの CloudAuditEvents テーブルのスクリーンショット。

一般的なユース ケースとシナリオ

  • XDR 高度なハンティングで疑わしい Resource Manager と Kubernetes (Kubeaudit) コントロール プレーンアクティビティを調査する
  • 疑わしい Resource Manager と Kubernetes (Kubeaudit) コントロール プレーン アクティビティのカスタム検出を作成する

前提条件

  • Kubernetes イベントの場合: Defender for Containers プランが有効になっているサブスクリプションが少なくとも 1 つ必要です
  • Azure Resource Manager イベントの場合: Defender for Azure Resource Manager プランが有効になっているサブスクリプションが少なくとも 1 つ必要です

サンプル クエリ

特権ポッドのデプロイを表示するには、次のサンプル クエリを使用します:

CloudAuditEvents
| where Timestamp > ago(1d)
| where DataSource == "Azure Kubernetes Service"
| where OperationName == "create"
| where RawEventData.ObjectRef.resource == "pods" and isnull(RawEventData.ObjectRef.subresource)
| where RawEventData.ResponseStatus.code startswith "20"
| extend PodName = RawEventData.RequestObject.metadata.name
| extend PodNamespace = RawEventData.ObjectRef.namespace
| mv-expand Container = RawEventData.RequestObject.spec.containers
| extend ContainerName = Container.name
| where Container.securityContext.privileged == "true"
| extend Username = RawEventData.User.username
| project Timestamp, AzureResourceId , OperationName, IPAddress, UserAgent, PodName, PodNamespace, ContainerName, Username

kube-system 名前空間で exec コマンドを表示するには、次のサンプル クエリを使用します:

CloudAuditEvents
| where Timestamp > ago(1d)
| where DataSource == "Azure Kubernetes Service"
| where OperationName == "create"
| where RawEventData.ObjectRef.resource == "pods" and RawEventData.ResponseStatus.code == 101  
| where RawEventData.ObjectRef.namespace == "kube-system"
| where RawEventData.ObjectRef.subresource == "exec"
| where RawEventData.ResponseStatus.code == 101
| extend RequestURI = tostring(RawEventData.RequestURI)
| extend PodName = tostring(RawEventData.ObjectRef.name)
| extend PodNamespace = tostring(RawEventData.ObjectRef.namespace)
| extend Username = tostring(RawEventData.User.username)
| where PodName !startswith "tunnelfront-" and PodName !startswith "konnectivity-" and PodName !startswith "aks-link"
| extend Commands =  extract_all(@"command=([^\&]*)", RequestURI)
| extend ParsedCommand = url_decode(strcat_array(Commands, " "))
| project Timestamp, AzureResourceId , OperationName, IPAddress, UserAgent, PodName, PodNamespace,  Username, ParsedCommand

cluster-admin ロール バインドの作成を識別するには、次のサンプル クエリを使用します:

CloudAuditEvents
| where Timestamp > ago(1d)
| where OperationName == "create"
| where RawEventData.ObjectRef.resource == "clusterrolebindings"
| where RawEventData.ResponseStatus.code startswith "20"
| where RawEventData.RequestObject.roleRef.name == "cluster-admin"
| mv-expand Subject = RawEventData.RequestObject.subjects
| extend SubjectName = tostring(Subject.name)
| extend SubjectKind = tostring(Subject["kind"]) 
| extend BindingName = tostring(RawEventData.ObjectRef.name)
| extend ActionTakenBy = tostring(RawEventData.User.username)
| where ActionTakenBy != "acsService" //Remove FP
| project Timestamp, AzureResourceId , OperationName, ActionTakenBy, IPAddress, UserAgent, BindingName, SubjectName, SubjectKind