エンタープライズ露出グラフを照会する

Microsoft セキュリティ露出管理のエンタープライズ 露出グラフを使用して、Microsoft Defender ポータルの高度なハンティングでエンドポイント、クラウド環境、ハイブリッド インフラストラクチャ全体でエンタープライズ露出の脅威を事前に検出します。 Defender ポータルでの Defender for Cloud の統合により、公開グラフには、Azure、AWS、GCP 環境からのクラウド ノードの種類とエンティティが含まれるようになりました。

次のセクションでは、エンタープライズ露出グラフでクエリを作成するための例、ヒント、ヒントを示します。

前提条件

高度なハンティング クエリを構築する

グラフ作成演算子を使用する

Kusto の make-graph 演算子は、ノードを読み込み、データをメモリにエッジします。

  • Kusto は使用中の列のみを読み込むため、列を明示的に選択する必要はありません。
  • ただし、 NodeProperties 列にはすべてのノード情報が含まれているため、大きくなります。
  • ほとんどのシナリオでは、 make-graph 演算子にフィードする前に必要な情報のみを抽出すると便利です。

let FilteredNodes = ExposureGraphNodes
| extend ContainsSensetiveData = NodeProperties has "containsSensitiveData"
| project Id, ContainsSensetiveData, Label, EntityIds, Categories;
Edges
| make-graph SourceNodeId --> TargetNodeId with FilteredNodes on Id
..

動的列とスマート インデックス作成を使用する

NodePropertiesCategories は動的列です。

  • Kusto は、これらの列に json のようなコンテンツが含まれていることを認識し、スマート インデックス作成を適用します。
  • ただし、すべての Kusto 演算子がインデックスを使用するわけではありません。 たとえば、set_has_elementisemptyisnotnull は、動的列に適用された場合はインデックスを使用せず、isnotnull(Properties["containsSensitiveData"] もインデックスを使用しません。
  • 代わりに、常にインデックスを使用する has() 演算子を使用します。

次のクエリでは、has演算子によってdata文字列がチェックされ、set_has_element要素がdataチェックされます。

両方の演算子を使用することは、 has() 演算子がカテゴリ prefix_dataの場合でも true を返すので重要です。

Categories has('data') and set_has_element(Categories, 'data')

文字列の用語について詳しくは、こちらをご覧ください。

エクスポージャークエリの例

次の例は、テナント内のセキュリティ公開データを理解するためのクエリを記述するのに役立ちます。

テナント内のすべてのノード ラベルを一覧表示する

次のクエリは、 ExposureGraphNodes テーブル内のデータをグループ化し、Kusto の summarize 演算子を使用して NodeLabelで一覧表示します。

ExposureGraphNodes
| summarize by NodeLabel

テナント内のすべてのエッジ ラベルを一覧表示する

次のクエリでは、 ExposureGraphEdges テーブル内のデータをグループ化し、Kusto の summarize 演算子を使用してエッジ ラベル (EdgeLabel) で一覧表示します。

ExposureGraphEdges
| summarize by EdgeLabel

指定されたノード ラベルからすべての接続を一覧表示する

次のクエリは、 ExposureGraphEdges テーブル内のデータをグループ化し、ソース ノード ラベルが microsoft.compute/virtualmachinesされている場合、仮想マシンの概要を EdgeLabelします。 これは、資産を仮想マシンに接続するエッジをセキュリティ露出グラフにまとめます。 Defender ポータルでの Defender for Cloud の統合により、これには複数の環境からのクラウド リソースが含まれるようになりました。

ExposureGraphEdges
| where SourceNodeLabel == "microsoft.compute/virtualmachines"
| summarize by EdgeLabel

特定のノード ラベルへのすべての接続を一覧表示する

次のクエリは、仮想マシンを他のセキュリティ露出グラフ資産に接続するエッジをまとめたものです。 ExposureGraphEdges テーブル内のデータをグループ化し、ターゲット ノード ラベルがmicrosoft.compute/virtualmachinesされている場合は、Kusto の summarize 演算子を使用してターゲット ノード ラベルをEdgeLabelで一覧表示します。

ExposureGraphEdges
| where TargetNodeLabel == "microsoft.compute/virtualmachines"
| summarize by EdgeLabel

特定のノード ラベルのプロパティを一覧表示する

次のクエリは、仮想マシン ノード ラベルのプロパティを一覧表示します。 ExposureGraphNodes テーブル内のデータをグループ化し、ノード ラベル "microsoft.compute/virtualmachines" の結果のみを表示するようにフィルター処理します。 project-keep演算子を使用すると、クエリはNodeProperties列を保持します。 返されるデータは 1 行に制限されます。 Defender ポータルでの Defender for Cloud の統合により、NodeProperties にクラウド固有の追加の属性とリレーションシップが含まれるようになりました。

ExposureGraphNodes
| where NodeLabel == "microsoft.compute/virtualmachines"
| project-keep NodeProperties
| take 1

例: 複数の環境にわたってクラウド リソースにクエリを実行する

次のクエリは、Defender ポータルで Defender for Cloud の統合で使用できるようになったさまざまな環境のクラウド リソースに対してクエリを実行する方法を示しています。

ExposureGraphNodes
| where NodeLabel contains "microsoft.compute" or NodeLabel contains "aws." or NodeLabel contains "gcp."
| summarize count() by NodeLabel
| order by count_ desc

露出グラフにクエリを実行する

露出グラフを照会するには:

  1. Microsoft Defender ポータルで、[ハンティング] > [高度なハンティング] を選択します。

  2. [クエリ] 領域にクエリを入力します。 クエリの作成に役立つグラフ スキーマ、関数、演算子テーブル、または次の例を使用します。

  3. [クエリの実行] を選択します。

グラフ指向のクエリの例

次のグラフ指向のクエリの例を使用して、より適切なセキュリティ エクスポージャー クエリを作成してください。 この例では、リスクを明らかにできるエンティティ間のリレーションシップを公開するパターンを検索します。 コンテキストとインシデント/アラートシグナルを関連付ける方法について説明します。

エッジを持つすべてのノード ラベルを特定のノード ラベルに一覧表示する

次のクエリは、仮想マシン ノード ラベルへのコネクタを持つすべての受信ノード ラベルの一覧になります。 グラフ構造を構築するには、SourceNodeId テーブル内のExposureGraphEdges列データを、TargetNodeId 演算子を使用してExposureGraphNodes テーブルのmake-graph列にマッピングすることで、グラフ構造を構築します。

次に、graph-match 演算子を使用して、ターゲット ノード TargetNodeNodeLabelmicrosoft.compute/virtualmachines に一致するグラフ パターンを作成します。 project演算子は、IncomingNodeLabelsのみを保持するために使用されます。 IncomingNodeLabelsによって結果が一覧表示されます。

ExposureGraphEdges
| make-graph SourceNodeId --> TargetNodeId with ExposureGraphNodes
on NodeId
| graph-match (SourceNode)-[edges]->(TargetNode)
       where TargetNode.NodeLabel == "microsoft.compute/virtualmachines"
       project IncomingNodeLabels = SourceNode.NodeLabel 
| summarize by IncomingNodeLabels

特定のノードラベルに隣接するすべてのノードラベルを一覧表示する

次のクエリは、仮想マシン ノード ラベルへのコネクタを持つすべての発信ノード ラベルの一覧になります。

  • SourceNodeId 演算子を使用して、ExposureGraphEdges テーブルのデータを TargetNodeId 列から ExposureGraphNodes テーブルの make-graph 列にマッピングし、グラフ構造を構築します。
  • 次に、graph-match 演算子を使用して、SourceNodeNodeLabelmicrosoft.compute/virtualmachines に一致するグラフ パターンを照合します。
  • project演算子は、OutgoingNodeLabelsのみを保持するために使用されます。 OutgoingNodeLabelsによって結果が一覧表示されます。
ExposureGraphEdges
| make-graph SourceNodeId --> TargetNodeId with ExposureGraphNodes
on NodeId
| graph-match (SourceNode)-[edges]->(TargetNode)
       where SourceNode.NodeLabel == "microsoft.compute/virtualmachines"
       project OutgoingNodeLabels = SourceNode.NodeLabel 
| summarize by OutgoingNodeLabels

RCE の脆弱性を使用してインターネットに公開されている VM を検出する

次のクエリを使用すると、クラウド環境全体で、インターネットおよびリモート コード実行 (RCE) の脆弱性に公開されている仮想マシンを検出できます。

  • ExposureGraphNodes スキーマ テーブルを使用します。
  • NodeProperties exposedToInternetvulnerableToRCEの両方が true の場合、カテゴリ (Categories) が仮想マシン (virtual_machine) であることを確認します。
  • Defender ポータルでの Defender for Cloud の統合により、Azure、AWS、GCP 環境の VM が含まれるようになりました。
ExposureGraphNodes
| where isnotnull(NodeProperties.rawData.exposedToInternet)
| where isnotnull(NodeProperties.rawData.vulnerableToRCE)
| where Categories has "virtual_machine" and set_has_element(Categories, "virtual_machine")

例: クラウドとオンプレミスの資産の間のハイブリッド攻撃パスを検索する

次のクエリは、Defender ポータルで Defender for Cloud の統合を使用して、潜在的なハイブリッド攻撃パスを識別する方法を示しています。

let CloudAssets = ExposureGraphNodes
| where Categories has "virtual_machine" and (NodeLabel contains "microsoft.compute" or NodeLabel contains "aws." or NodeLabel contains "gcp.");
let OnPremAssets = ExposureGraphNodes
| where Categories has "device" and not(NodeLabel contains "microsoft.compute" or NodeLabel contains "aws." or NodeLabel contains "gcp.");
ExposureGraphEdges
| make-graph SourceNodeId --> TargetNodeId with ExposureGraphNodes on NodeId
| graph-match (CloudVM)-[edge1]->(Identity)-[edge2]->(OnPremDevice)
       where set_has_element(CloudVM.Categories, "virtual_machine") and 
             (CloudVM.NodeLabel contains "microsoft.compute" or CloudVM.NodeLabel contains "aws." or CloudVM.NodeLabel contains "gcp.") and
             set_has_element(Identity.Categories, "identity") and
             set_has_element(OnPremDevice.Categories, "device") and
             not(OnPremDevice.NodeLabel contains "microsoft.compute" or OnPremDevice.NodeLabel contains "aws." or OnPremDevice.NodeLabel contains "gcp.")
       project CloudVMName=CloudVM.NodeName, IdentityName=Identity.NodeName, OnPremDeviceName=OnPremDevice.NodeName

特権エスカレーションの脆弱性を持つインターネットに接続するデバイスを検出する

次のクエリでは、特権エスカレーションの脆弱性にさらされているインターネットに接続しているデバイスを検索します。これにより、システム内のより高いレベルの特権へのアクセスが許可される可能性があります。

  • ExposureGraphNodes スキーマ テーブルを使用します。
  • NodePropertiesがインターネットに接続 (IsInternetFacing) とVulnerableToPrivilegeEscalationの両方である場合、クエリは、Categories内の項目が実際にデバイス (device) であることを確認します。
ExposureGraphNodes
| where isnotnull(NodeProperties.rawData.IsInternetFacing)
| where isnotnull(NodeProperties.rawData.VulnerableToPrivilegeEscalation)
| where set_has_element(Categories, "device")

複数の重要なデバイスにログインしたすべてのユーザーを表示する

このクエリにより、複数の重要なデバイスにログインしたユーザーの一覧と、ログインしているデバイスの数が表示されます。

  • 重要度レベルが 4 を超えるデバイス、または IdentitiesAndCriticalDevices によってフィルター処理された ExposureGraphNodes データを使用して、identity テーブルを作成します。
  • 次に、make-graphEdgeLabelされるCan Authenticate As演算子を使用してグラフ構造を作成します。
  • graph-match 演算子を使用して、deviceidentityと一致するインスタンスを照合します。
  • 次に、 project 演算子を使用して、ID とデバイス ID を保持します。
  • mv-applyオペレーターは、デバイス ID と ID ID を種類別にフィルター処理します。 これらを要約し、ヘッダー、 Number Of devices user is logged-in toUser Idを含むテーブルに結果を表示します。
let IdentitiesAndCriticalDevices = ExposureGraphNodes
| where
 // Critical Device
 (set_has_element(Categories, "device") and isnotnull(NodeProperties.rawData.criticalityLevel) and NodeProperties.rawData.criticalityLevel.criticalityLevel > 4)
 // or identity
 or set_has_element(Categories, "identity");
ExposureGraphEdges
| where EdgeLabel == "Can Authenticate As"
| make-graph SourceNodeId --> TargetNodeId with IdentitiesAndCriticalDevices on NodeId
| graph-match (Device)-[canConnectAs]->(Identity)
       where set_has_element(Identity.Categories, "identity") and set_has_element(Device.Categories, "device")
       project IdentityIds=Identity.EntityIds, DeviceIds=Device.EntityIds
| mv-apply DeviceIds on (
    where DeviceIds.type == "DeviceInventoryId")
| mv-apply IdentityIds on (
    where IdentityIds.type == "SecurityIdentifier")
| summarize NumberOfDevicesUserLoggedinTo=count() by tostring(IdentityIds.id)
| where NumberOfDevicesUserLoggedinTo > 1
| project ["Number Of devices user is logged-in to"]=NumberOfDevicesUserLoggedinTo, ["User Id"]=IdentityIds_id

重要な脆弱性を持つクライアント デバイスを表示する/価値の高いサーバーにアクセスできるユーザー

次のクエリでは、RCE の脆弱性を持つデバイスとそのデバイス ID、および重大な脆弱性が高いデバイスとそのデバイス ID の一覧が表示されます。

  • これにより、重要度が 4 未満の RCE 脆弱性を持つデバイス (IdentitiesAndCriticalDevices) と、フィルター処理とパターン マッチングを通じて重大な脆弱性を持つデバイスを表示する ID (device) を含むidentity テーブルが作成されます。
  • 一覧がフィルター処理され、エッジ ラベルが Can Authenticate As され、 CanRemoteInteractiveLogonToされている接続のみが表示されます。
let IdentitiesAndCriticalDevices = ExposureGraphNodes // Reduce the number of nodes to match
| where 
 // Critical devices & devices with RCE vulnerabilities
 (set_has_element(Categories, "device") and 
    (
        // Critical devices
        (isnotnull(NodeProperties.rawData.criticalityLevel) and NodeProperties.rawData.criticalityLevel.criticalityLevel < 4)
        or 
        // Devices with RCE vulnerability
        isnotnull(NodeProperties.rawData.vulnerableToRCE)
    )
  )
 or 
 // identity
 set_has_element(Categories, "identity");
ExposureGraphEdges
| where EdgeLabel in~ ("Can Authenticate As", "CanRemoteInteractiveLogonTo") // Reduce the number of edges to match
| make-graph SourceNodeId --> TargetNodeId with IdentitiesAndCriticalDevices on NodeId
| graph-match (DeviceWithRCE)-[CanConnectAs]->(Identity)-[CanRemoteLogin]->(CriticalDevice)
       where 
             CanConnectAs.EdgeLabel =~ "Can Authenticate As" and
             CanRemoteLogin.EdgeLabel =~ "CanRemoteInteractiveLogonTo" and
             set_has_element(Identity.Categories, "identity") and 
             set_has_element(DeviceWithRCE.Categories, "device") and isnotnull(DeviceWithRCE.NodeProperties.rawData.vulnerableToRCE) and
             set_has_element(CriticalDevice.Categories, "device") and isnotnull(CriticalDevice.NodeProperties.rawData.criticalityLevel)
       project DeviceWithRCEIds=DeviceWithRCE.EntityIds, DeviceWithRCEName=DeviceWithRCE.NodeName, CriticalDeviceIds=CriticalDevice.EntityIds, CriticalDeviceName=CriticalDevice.NodeName

特定のノード ID から特定のラベルを持つノードへのすべてのパスを指定する

このクエリは、特定の IP ノードから始まり、最大 3 つのアセットを経由して、仮想マシン ノード ラベルへの接続に至るパスを表示します。

  • ExposureGraphNodesおよびExposureGraphEdgesスキーマ テーブルとmake-graph演算子とgraph-match演算子を使用してグラフ構造を作成します。
  • project演算子を使用すると、IP ID、IP プロパティ、仮想マシン ID、および仮想マシンのプロパティの一覧が表示されます。
let IPsAndVMs = ExposureGraphNodes
| where (set_has_element(Categories, "ip_address") or set_has_element(Categories, "virtual_machine"));
ExposureGraphEdges
| make-graph SourceNodeId --> TargetNodeId with IPsAndVMs on NodeId
| graph-match (IP)-[anyEdge*1..3]->(VM)
       where set_has_element(IP.Categories, "ip_address") and set_has_element(VM.Categories, "virtual_machine")
       project IpIds=IP.EntityIds, IpProperties=IP.NodeProperties.rawData, VmIds=VM.EntityIds, VmProperties=VM.NodeProperties.rawData

次の手順

攻撃面マップを使用して探索します