將 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 中顯示的 Windows Defender 防毒警報遷移為 CBN 警報

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

  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"
                }
            }
        }
    }
}

接著,您可以使用 Maps 函式,在 YARA-L 偵測引擎規則中使用這個值,如下所示:

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"
    )

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