おれさまラボ

実際に手を動かして理解を深めるブログ。

Indicatorルールで競合が発生した場合の挙動

はじめに

MicrosoftのDefender Seriesでは、Microsoftの脅威インテリジェンスに基づいて、さまざまな悪性サイトへのアクセスをブロックしてくれますが、独自にブロックルールを追加したり、特定のサイトは許可したい場合があります。

そんなときは、Indicator機能を使うことで、URLやIPアドレス、ファイルハッシュ値に関するカスタムルールを作成することができます。

このカスタムルールは最大15,000個作成できますが、大量のルールを作成すると時には競合するルールも出てきますので、競合した場合の挙動について調べてまとめてみました。

競合の確認

自身の環境に競合が発生しているかは、Microsoft提供のPowershellスクリプトGet-DuplicateDefenderIndicators.ps1)で確認できます。

To detect existing conflicting IoCs, execute this PowerShell script which detects and reports them.

参考:https://techcommunity.microsoft.com/t5/microsoft-defender-for-endpoint/best-practices-for-optimizing-custom-indicators/ba-p/2670357

IPの競合

Indicatorでは、IPアドレスを/32単位でしか登録できないため、競合が発生することはありません。まったく同じルールを作成する「重複」は発生し得ますが、Indicatorでは同一ルールの作成はエラーとなるためIP登録で競合が発生する心配はありません。

Classless Inter-Domain Routing (CIDR) notation for IP addresses is not supported.

参考:https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/indicator-ip-domain?view=o365-worldwide

URLの競合

URLの競合が発生した場合、ロンゲストマッチの原則に則って処理されます。

If there are conflicting URL indicator policies, the longer path is applied. For example, the URL indicator policy https:\support.microsoft.com/office takes precedence over the URL indicator policy https:\support.microsoft.com.

参考:https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/indicator-ip-domain?view=o365-worldwide#before-you-begin

ファイルハッシュの場合

ファイルハッシュの競合が発生した場合、以下のフローに沿って処理されます。

  • If the file is not allowed by Windows Defender Application Control and AppLocker enforce mode policy/policies, then Block
  • Else if the file is allowed by the Microsoft Defender Antivirus exclusion, then Allow
  • Else if the file is blocked or warned by a block or warn file IoC, then Block/Warn
  • Else if the file is allowed by an allow file IoC policy, then Allow
  • Else if the file is blocked by ASR rules, CFA, AV, SmartScreen, then Block
  • Else Allow (passes Windows Defender Application Control & AppLocker policy, no IoC rules apply to it)

参考:https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/indicator-file?view=o365-worldwide#policy-conflict-handling

Indicatorによる判定は、SHA256のようなより長いハッシュ値より安全なハッシュ値が優先されるよう実装されています。

If there are conflicting file IoC policies with the same enforcement type and target, the policy of the more secure (meaning longer) hash will be applied. For example, an SHA-256 file hash IoC policy will win over an MD5 file hash IoC policy if both hash types define the same file.

参考:https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/indicator-file?view=o365-worldwide#policy-conflict-handling

MD5のような脆弱なハッシュ関数を使用した場合、ハッシュ値の衝突が起こりえます。そのため、ハッシュの衝突を避ける意味でも、SHA256など長いハッシュ値を使用することが推奨されます。

Defender for Endpoint allows for importing of SHA256, SHA1, and MD5 hashes. There can be hash collisions, however, where there are different types of hashes for the same file, resulting in only the longer hash’s policy being applied.

参考:https://techcommunity.microsoft.com/t5/microsoft-defender-for-endpoint/best-practices-for-optimizing-custom-indicators/ba-p/2670357

以上