デバイス、メール、アプリ、ID 全体の脅威を探す

注:

Microsoft Defender XDRを体験したいですか? Microsoft Defender XDRを評価およびパイロットする方法について詳しくは、こちらをご覧ください。

適用対象:

  • Microsoft Defender XDR

Microsoft Defender XDRでの高度なハンティングを使用すると、次の脅威を事前に検出できます。

  • Microsoft Defender for Endpointによって管理されるデバイス
  • Microsoft 365 によって処理された電子メール
  • Microsoft Defender for Cloud AppsとMicrosoft Defender for Identityによって追跡されるクラウド アプリ アクティビティ、認証イベント、ドメイン コントローラー アクティビティ

このレベルの可視性を使用すると、メールや Web に到着する高度な侵入、ローカル特権の昇格、特権ドメイン資格情報の取得、デバイス間の横方向への移動など、ネットワークのセクションを通過する脅威をすばやく検出できます。

このような高度な脅威を検出するときにクエリを構築する方法を調べるのに役立つ、さまざまなハンティング シナリオに基づく一般的な手法とサンプル クエリを次に示します。

エンティティ情報を取得する

これらのクエリを使用して、ユーザー アカウント、デバイス、ファイルに関する情報をすばやく取得する方法について説明します。

メール アドレスからユーザー アカウントを取得する

デバイスとメールを対象とする複数のテーブル全体に対してクエリを作成する場合、送信者または受信者のメール アドレスからユーザー アカウント名を取得する必要があります。 通常、電子メール アドレスの ローカル ホスト を使用して、受信者または送信者アドレスに対してこれを行うことができます。

次のスニペットでは、 tostring() Kusto 関数を使用して、 列の受信者の電子メール アドレスの直前 @ にあるローカル ホストを抽出します RecipientEmailAddress

//Query snippet showing how to extract the account name from an email address
AccountName = tostring(split(RecipientEmailAddress, "@")[0])

次のクエリは、このスニペットを使用する方法を示しています。

EmailEvents
| where Timestamp > ago(7d)
| project RecipientEmailAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0]);

IdentityInfo テーブルをマージする

IdentityInfo テーブルをマージまたは結合することで、アカウント名やその他のアカウント情報を取得できます。 次のクエリでは、 EmailEvents テーブル からフィッシングとマルウェアの検出の一覧を取得し、その情報をテーブルと IdentityInfo 結合して、各受信者に関する詳細情報を取得します。

EmailEvents
| where Timestamp > ago(7d)
//Get email processing events where the messages were identified as either phishing or malware
| where ThreatTypes has "Malware" or ThreatTypes has "Phish"
//Merge email events with identity info to get recipient details
| join (IdentityInfo | distinct AccountUpn, AccountDisplayName, JobTitle,
Department, City, Country) on $left.RecipientEmailAddress == $right.AccountUpn
//Show important message and recipient details
| project Timestamp, NetworkMessageId, Subject, ThreatTypes,
SenderFromAddress, RecipientEmailAddress, AccountDisplayName, JobTitle,
Department, City, Country

この短いビデオでは、Kusto 照会言語を使用してテーブルを結合する方法について説明します。

デバイス情報を取得する

高度なハンティング スキーマは、さまざまなテーブルに広範なデバイス情報を提供します。 たとえば、 DeviceInfo テーブル は、定期的に集計されたイベント データに基づく包括的なデバイス情報を提供します。 このクエリでは、テーブルをDeviceInfo使用して、侵害された可能性のあるユーザー (<account-name>) がデバイスにログオンしているかどうかをチェックし、それらのデバイスでトリガーされたアラートを一覧表示します。

ヒント

このクエリでは、 を使用 kind=inner して 内部結合を指定します。これにより、 の左側の値が重複除去されないようにします DeviceId

DeviceInfo
//Query for devices that the potentially compromised account has logged onto
| where LoggedOnUsers contains '<account-name>'
| distinct DeviceId
//Crosscheck devices against alert records in AlertEvidence and AlertInfo tables
| join kind=inner AlertEvidence on DeviceId
| project AlertId
//List all alerts on devices that user has logged on to
| join AlertInfo on AlertId
| project AlertId, Timestamp, Title, Severity, Category

ファイル イベント情報を取得する

次のクエリを使用して、ファイル関連のイベントに関する情報を取得します。

DeviceInfo
| where Timestamp > ago(1d)
| where ClientVersion startswith "20.1"
| summarize by DeviceId
| join kind=inner (
    DeviceFileEvents
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

ネットワーク イベント情報を取得する

次のクエリを使用して、ネットワーク関連のイベントに関する情報を取得します。

DeviceInfo
| where Timestamp > ago(1d)
| where ClientVersion startswith "20.1"
| summarize by DeviceId
| join kind=inner (
    DeviceNetworkEvents
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

デバイス エージェントのバージョン情報を取得する

次のクエリを使用して、デバイスで実行されているエージェントのバージョンを取得します。

DeviceInfo
| where Timestamp > ago(1d)
| where ClientVersion startswith "20.1"
| summarize by DeviceId
| join kind=inner (
    DeviceNetworkEvents
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

macOS デバイスのクエリの例

次のクエリ例を使用して、Catalina より古いバージョンの macOS を実行しているすべてのデバイスを確認します。

DeviceInfo
| where Timestamp > ago(1d)
| where OSPlatform == "macOS" and  OSVersion !contains "10.15" and OSVersion !contains "11."
| summarize by DeviceId
| join kind=inner (
    DeviceInfo
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

デバイスの状態情報を取得する

デバイスの状態を取得するには、次のクエリを使用します。 次の例では、クエリによってデバイスがオンボードされているかどうかを確認します。

DeviceInfo
| where Timestamp > ago(1d)
| where OnboardingStatus != "Onboarded"
| summarize by DeviceId
| join kind=inner (
    DeviceInfo
    | where Timestamp > ago(1d)
) on DeviceId
| take 10

捜索のシナリオ

正常にザップされなかったメールを受信したユーザーのログオン アクティビティを一覧表示する

0 時間自動消去 (ZAP) は、悪意のあるメールが受信された後にアドレスを指定します。 ZAP が失敗した場合、悪意のあるコードが最終的にデバイス上で実行され、アカウントが侵害されたままになる可能性があります。 このクエリは、ZAP によって正常にアドレス指定されなかった電子メールの受信者によって行われたログオン アクティビティをチェックします。

EmailPostDeliveryEvents
| where Timestamp > ago(7d)
//List malicious emails that were not zapped successfully
| where ActionType has "ZAP" and ActionResult == "Error"
| project ZapTime = Timestamp, ActionType, NetworkMessageId , RecipientEmailAddress
//Get logon activity of recipients using RecipientEmailAddress and AccountUpn
| join kind=inner IdentityLogonEvents on $left.RecipientEmailAddress == $right.AccountUpn
| where Timestamp between ((ZapTime-24h) .. (ZapTime+24h))
//Show only pertinent info, such as account name, the app or service, protocol, the target device, and type of logon
| project ZapTime, ActionType, NetworkMessageId , RecipientEmailAddress, AccountUpn,
LogonTime = Timestamp, AccountDisplayName, Application, Protocol, DeviceName, LogonType

資格情報の盗難の対象となるドメイン アカウントによるログオン試行の取得

このクエリは、まず、テーブル内のすべての資格情報アクセス アラートを AlertInfo 識別します。 次に、テーブルを AlertEvidence マージまたは結合します。このテーブルは、対象となるアカウントの名前を解析し、ドメイン参加済みアカウントのみのフィルターを解析します。 最後に、テーブルを IdentityLogonEvents チェックして、ドメイン参加対象アカウントによってすべてのログオン アクティビティを取得します。

AlertInfo
| where Timestamp > ago(30d)
//Get all credential access alerts
| where Category == "CredentialAccess"
//Get more info from AlertEvidence table to get the SID of the target accounts
| join AlertEvidence on AlertId
| extend IsJoined=(parse_json(AdditionalFields).Account.IsDomainJoined)
| extend TargetAccountSid=tostring(parse_json(AdditionalFields).Account.Sid)
//Filter for domain-joined accounts only
| where IsJoined has "true"
//Merge with IdentityLogonEvents to get all logon attempts by the potentially compromised target accounts
| join kind=inner IdentityLogonEvents on $left.TargetAccountSid == $right.AccountSid
//Show only pertinent info, such as account name, the app or service, protocol, the accessed device, and type of logon
| project AccountDisplayName, TargetAccountSid, Application, Protocol, DeviceName, LogonType

既知の悪意のある送信者からのファイルがデバイスに存在するかどうかを確認する

悪意のあるファイル (MaliciousSender@example.com) を送信するメール アドレスがわかっている場合は、このクエリを実行して、この送信者のファイルがデバイスに存在するかどうかを判断できます。 たとえば、このクエリを使用して、マルウェア配布キャンペーンの影響を受けるデバイスを特定できます。

EmailAttachmentInfo
| where SenderFromAddress =~ "MaliciousSender@example.com"
//Get emails with attachments identified by a SHA-256
| where isnotempty(SHA256)
| join (
//Check devices for any activity involving the attachments
DeviceFileEvents
| project FileName, SHA256, DeviceName, DeviceId
) on SHA256
| project Timestamp, FileName , SHA256, DeviceName, DeviceId,  NetworkMessageId, SenderFromAddress, RecipientEmailAddress

悪意のあるメール受信後のログオン試行を確認する

このクエリは、既知の悪意のあるメールの受信後 30 分以内に受信者が実行したログオン試行のうち、最新のもの 10 件を見つけます。 このクエリを使用することで、メールの受信者のアカウントが侵害されたかどうかを確認できます。

//Define new table for malicious emails
let MaliciousEmails=EmailEvents
//List emails detected as malware, getting only pertinent columns
| where ThreatTypes has "Malware"
| project TimeEmail = Timestamp, Subject, SenderFromAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0]);
MaliciousEmails
| join (
//Merge malicious emails with logon events to find logons by recipients
IdentityLogonEvents
| project LogonTime = Timestamp, AccountName, DeviceName
) on AccountName
//Check only logons within 30 minutes of receipt of an email
| where (LogonTime - TimeEmail) between (0min.. 30min)
| take 10

既知の悪意のある送信者からのメール受信後の PowerShell アクティビティを確認する

悪意のあるメールには多くの場合、PowerShell コマンドを実行して追加のペイロードを配信するドキュメントや特別に細工した添付ファイルが含まれます。 既知の悪意のある送信者 (MaliciousSender@example.com) からのメールを認識している場合は、このクエリを使用して、送信者からメールが受信されてから 30 分以内に発生した PowerShell アクティビティを一覧表示して確認できます。

//Define new table for emails from specific sender
let EmailsFromBadSender=EmailEvents
| where SenderFromAddress =~ "MaliciousSender@example.com"
| project TimeEmail = Timestamp, Subject, SenderFromAddress, AccountName = tostring(split(RecipientEmailAddress, "@")[0]);
//Merge emails from sender with process-related events on devices
EmailsFromBadSender
| join (
DeviceProcessEvents
//Look for PowerShell activity
| where FileName =~ "powershell.exe"
//Add line below to check only events initiated by Outlook
//| where InitiatingProcessParentFileName =~ "outlook.exe"
| project TimeProc = Timestamp, AccountName, DeviceName, InitiatingProcessParentFileName, InitiatingProcessFileName, FileName, ProcessCommandLine
) on AccountName
//Check only PowerShell activities within 30 minutes of receipt of an email
| where (TimeProc - TimeEmail) between (0min.. 30min)

ヒント

さらに多くの情報を得るには、 Tech Community: Microsoft Defender XDR Tech Community の Microsoft Security コミュニティとEngageします