將 CBN 快訊遷移至 YARA-L 偵測規則快訊

本文將詳細說明如何將以設定為準的標準化 (CBN) 通知遷移至 YARA-L 偵測通知。身為安全分析師,您可以使用「快訊和 IOC」頁面,繼續接收第三方系統的快訊通知。

將 CBN 警告遷移至 YARA-L 偵測引擎

如要遷移 CBN 警告,您可以透過下列選項,確保先前的 CBN 警告可做為偵測規則警告。

使用 UDM 搜尋選項,您可以查看在剖析器中設定 alert_state 的事件:

security_result.alert_state = "ALERTING"

在 UDM 搜尋結果中,您可以探索下列欄位,瞭解環境中產生 CBN 快訊的來源:

  • Metadata > Vendor Name

  • Metadata > Product Name

使用 Tools API 下載預設 CBN 快訊,並手動檢查

先前的做法有助於找出已觸發的快訊,但無法涵蓋您先前未見過的快訊情境。您可以使用 backstory.googleapis.com/v1/tools/cbn 剖析器方法下載預設、選取或所有 CBN,並手動檢查套用的剖析器邏輯,找出 is_alertalert_state 相關快訊。

您可以將 CBN 快訊匯入 YARA-L 偵測引擎規則快訊,並積極使用。

遷移先前在 Enterprise Insights 中以 CBN 警告形式顯示的 Windows Defender 防毒警報

以下範例說明如何遷移先前在 Enterprise Insights 中顯示為 CBN 警報的 Windows Defender 防毒警報。

  1. 使用先前說明的任一方法,找出警報範例。

  2. 使用原始記錄 / UDM 事件檢視器,複製可提供可靠偵測結果的特定 UDM 欄位。請參閱以下範例:

    metadata.vendor_name = "Microsoft"
    metadata.product_name = "Windows Defender AV"
    metadata.product_event_type = "MALWAREPROTECTION_STATE_MALWARE_DETECTED"
    principal.asset.hostname = "client02.example.local"
    security_result.action = "BLOCK"
    security_result.severity = "MEDIUM"
    
  3. 建立新的 YARA-L 偵測引擎規則。

    rule windows_defender_av_monitored_events {
        meta:
        author = "Chronicle"
        description = "Migration of CBN alerts to Google SecOps YARA-L detection engine rule alert."
        // Severity is set at the Outcome level via security_result.severity
        severity = "INFORMATIONAL"
        priority = "INFORMATIONAL"
    events:
            $windows_defender_av.metadata.vendor_name = "Microsoft"
            $windows_defender_av.metadata.product_name = "Windows Defender AV"
            $windows_defender_av.metadata.product_event_type = "MALWAREPROTECTION_STATE_MALWARE_DETECTED"
            $windows_defender_av.principal.asset.hostname = $host
            // optionally tune to only detection on ALLOW, i.e., failure to BLOCK
            //$windows_defender_av.security_result.action = "ALLOW"
            // optionally tune on severity of detection
            //$windows_defender_av.security_result.severity != "LOW"
    outcome:
            $risk_score = max(
            if ($windows_defender_av.security_result.severity = "UNKNOWN_SEVERITY", 0) +
            if ($windows_defender_av.security_result.severity = "LOW", 25) +
            if ($windows_defender_av.security_result.severity = "MEDIUM", 50) +
            if ($windows_defender_av.security_result.severity = "HIGH", 75) +
            if ($windows_defender_av.security_result.severity = "CRITICAL", 100)
            )
    $severity = array_distinct($windows_defender_av.security_result.severity)
        condition:
        $windows_defender_av
    }
    

CBN 快訊似乎使用未剖析至 UDM 的欄位

使用剖析器擴充功能選項,即可快速解決這個情況。

舉例來說,Corelight CBN 快訊會使用 notice 欄位,且只在條件為 True 時發出快訊:

if [notice] == "true" {
  mutate {
    replace => {
      "is_significant" => "true"
      "is_alert"       => "true"
    }
  }
}

由於這個值預設不會正規化為 UDM,因此您可以按照下列方式使用剖析器擴充功能 Grok,將該值新增為 Additional 類型的 UDM 欄位:

filter {
    mutate {
        replace => {
            "notice" => ""
        }
    }
    grok {
        match     => { "message" => [ "(?P<message>\{.*\})$" ] }
        on_error  => "_grok_not_syslog"
        overwrite => [ "message" ]
    }
    json {
        on_error       => "not_json" 
        source         => "message"
        array_function => "split_columns"
    }
    if ![not_json] {
        if [notice] != "" {
            mutate {
                convert => {
                    "notice" => "string"
                }
            }
            mutate {
                replace => {
                    "additional_notice.key" => "notice"
                    "additional_notice.value.string_value" => "%{notice}"
                }
            }
            mutate {
                merge => {
                    "event1.idm.read_only_udm.additional.fields" => "additional_notice"
                }
            }
            mutate {
                merge => {
                    "@output" => "event1"
                }
            }
        }
    }
}

然後,您可以在 YARA-L 偵測引擎規則中使用這項功能,如下所示,並使用 Maps 函式

events:
    // Corelight : Weird Log
    (
        $corelight.metadata.vendor_name = "Corelight" and
        $corelight.metadata.product_name = "Zeek" and
        // this requires a custom parser extension to extract notice
        $corelight.metadata.product_event_type = "weird" and
        $corelight.additional.fields["notice"] = "true"
    )

您必須啟用並開啟自訂規則,才能收到快訊。詳情請參閱「執行規則即時資料」。