收集 MISP IOC 記錄
支援的國家/地區:
Google SecOps
SIEM
本指南說明如何使用 Bindplane,將 MISP (惡意軟體資訊分享平台) IOC (遭入侵指標) 記錄檔擷取至 Google Security Operations。剖析器會從 JSON 或 CSV 格式的 MISP 資料中擷取 IOC。這項服務會剖析輸入內容、將欄位對應至統一資料模型 (UDM)、處理各種 IOC 類型 (例如 IP、網域和檔案雜湊),並使用威脅情報內容 (例如信賴度和嚴重程度) 擴充資料。剖析器也會針對不同資料格式執行特定邏輯,並處理缺少或不支援欄位的情況。
事前準備
請確認您已完成下列事前準備事項:
- Google SecOps 執行個體
- 搭載
systemd
的 Linux 主機 - 如果透過 Proxy 執行,防火牆通訊埠已開啟
- MISP 伺服器的特殊存取權
取得 MISP API 金鑰
- 以管理員身分登入 MISP 網頁 UI。
- 依序前往「Administration」(管理) >「List Auth Keys」(列出驗證金鑰)。
- 按一下「新增驗證金鑰」,
- 提供下列金鑰設定:
- 使用者:選取與金鑰相關聯的使用者帳戶。
- 允許的 IP:您可以選擇為金鑰指定允許的 IP 位址。
- 複製金鑰並妥善儲存於安全的位置。
- 按一下「我已記下金鑰」。
設定匯出 MISP 記錄
- 使用 SSH 登入 MISP 執行個體。
使用下列指令安裝 PyMISP:
pip3 install pymisp
使用下列項目修改
get_csv.py
匯出指令碼:#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse from pymisp import ExpandedPyMISP from keys import misp_url, misp_key, misp_verifycert if __name__ == '__main__': parser = argparse.ArgumentParser(description='Get MISP data in a CSV format.') parser.add_argument("--controller", default='attributes', help="Attribute to use for the search (events, objects, attributes)") parser.add_argument("-e", "--event_id", help="Event ID to fetch. Without it, it will fetch the whole database.") parser.add_argument("-a", "--attribute", nargs='+', help="Attribute column names") parser.add_argument("-o", "--object_attribute", nargs='+', help="Object attribute column names") parser.add_argument("-t", "--misp_types", nargs='+', help="MISP types to fetch (ip-src, hostname, ...)") parser.add_argument("-c", "--context", action='store_true', help="Add event level context (tags...)") parser.add_argument("-f", "--outfile", help="Output file to write the CSV.") parser.add_argument("-l", "--last", required=True, help="can be defined in days, hours, minutes (for example 5d or 12h or 30m).") args = parser.parse_args() pymisp = ExpandedPyMISP(misp_url, misp_key, misp_verifycert, debug=True) attr = [] if args.attribute: attr += args.attribute if args.object_attribute: attr += args.object_attribute if not attr: attr = None print(args.context) response = pymisp.search(return_format='csv', controller=args.controller, eventid=args.event_id, requested_attributes=attr, publish_timestamp=args.last, type_attribute=args.misp_types, include_context=args.context) if args.outfile: with open(args.outfile, 'w') as f: f.write(response) else: print(response)
編輯
keys.py
檔案,加入 MISP API 憑證和網址,如下所示:misp_url = 'https://<MISP_URL>' misp_key = '<MISP_API_KEY>' misp_verifycert = False misp_client_cert = ''
- 將
<MISP_URL>
替換為您的 MISP IP 或主機名稱。 - 將
<MISP_API_KEY
替換為先前產生的實際 API 金鑰。
- 將
使用
crontab -e
指令開啟 crontab,然後輸入下列內容:0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/url.log -t "url" -l 1d -c 0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/ip-dst.log -t "ip-dst" -l 1d -c 0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/ip-src.log -t "ip-src" -l 1d -c 0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/domain.log -t "domain" -l 1d -c 0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/sha256.log -t "sha256" -l 1d -c 0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/file.log -t "filename" -l 1d -c 0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/registry.log -t "registry" -l 1d -c 0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/mutex.log -t "mutex" -l 1d -c 0 20 * * * python3 /opt/misp/<YOUR_EXPORT_SCRIPT_PATH> -f /opt/misp/ioc_export/threat-actor.log -t "threat-actor" -l 1d -c
- 根據實際匯出指令碼位置更新
<YOUR_EXPORT_SCRIPT_PATH>
。
- 根據實際匯出指令碼位置更新
取得 Google SecOps 擷取驗證檔案
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」>「收集代理程式」。
- 下載擷取驗證檔案。將檔案安全地儲存在要安裝 Bindplane 的系統上。
取得 Google SecOps 客戶 ID
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」>「設定檔」。
- 複製並儲存「機構詳細資料」專區中的客戶 ID。
在 MISP 伺服器上安裝 Bindplane 代理程式
Linux 安裝
- 開啟具有根層級或 sudo 權限的終端機。
執行下列指令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-agent/releases/latest/download/install_unix.sh)" install_unix.sh
其他安裝資源
如需其他安裝選項,請參閱安裝指南。
設定 Bindplane 代理程式,擷取 MISP 記錄檔並傳送至 Google SecOps
- 存取設定檔:
- 找出
config.yaml
檔案。通常位於 Linux 的/etc/bindplane-agent/
目錄中。 - 使用文字編輯器 (例如
nano
、vi
或記事本) 開啟檔案。
- 找出
按照下列方式編輯
config.yaml
檔案:receivers: filelog: file_path: /opt/misp/ioc_export/*.log log_type: 'file' exporters: chronicle/chronicle_w_labels: compression: gzip # Adjust the path to the credentials file you downloaded in Step 1 creds_file_path: '/path/to/ingestion-authentication-file.json' # Replace with your actual customer ID from Step 2 customer_id: <customer_id> endpoint: malachiteingestion-pa.googleapis.com # Add optional ingestion labels for better organization ingestion_labels: log_type: 'MISP_IOC' raw_log_field: body service: pipelines: logs/source0__chronicle_w_labels-0: receivers: - filelog exporters: - chronicle/chronicle_w_labels
- 視基礎架構需求,替換通訊埠和 IP 位址。
- 將
<customer_id>
替換為實際的客戶 ID。 - 將
/path/to/ingestion-authentication-file.json
更新為「取得 Google SecOps 擷取驗證檔案」一節中驗證檔案的儲存路徑。
重新啟動 Bindplane 代理程式,以套用變更
如要在 Linux 中重新啟動 Bindplane 代理程式,請執行下列指令:
sudo systemctl restart bindplane-agent
UDM 對應表
記錄欄位 | UDM 對應 | 邏輯 |
---|---|---|
Attribute.category |
event.idm.entity.metadata.threat.category_details |
直接從「data」欄位中的巢狀 JSON 物件對應 Attribute.category 。用於 JSON 剖析路徑。 |
Attribute.comment |
event.idm.entity.metadata.threat.summary |
直接從「data」欄位中的巢狀 JSON 物件內對應 Attribute.comment 。用於 JSON 剖析路徑。 |
Attribute.deleted |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Attribute.deleted 對應,並新增為偵測欄位,索引鍵為「Attribute deleted」。用於 JSON 剖析路徑。 |
Attribute.event_id |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Attribute.event_id 對應,並新增為偵測欄位,鍵為「Attribute event_id」。用於 JSON 剖析路徑。 |
Attribute.first_seen |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Attribute.first_seen 對應,並以「Attribute first_seen」鍵新增為偵測欄位。用於 JSON 剖析路徑。 |
Attribute.id |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Attribute.id 對應,並視剖析路徑而定,以「屬性 ID」或「屬性 ID $$」做為鍵,新增為偵測欄位。用於 CSV 和 JSON 剖析路徑。 |
Attribute.timestamp |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Attribute.timestamp 對應,並以「Attribute timestamp」鍵新增為偵測欄位。用於 JSON 剖析路徑。 |
Attribute.to_ids |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Attribute.to_ids 對應,並以「Attribute to_ids」鍵新增為偵測欄位。用於 JSON 剖析路徑。 |
Attribute.type |
log_type |
直接從「data」欄位中的巢狀 JSON 物件內對應 Attribute.type 。做為暫時欄位,之後用於填入其他 UDM 欄位。用於 JSON 剖析路徑。 |
Attribute.uuid |
event.idm.entity.metadata.product_entity_id |
直接從「data」欄位中的巢狀 JSON 物件內對應 Attribute.uuid 。用於 JSON 剖析路徑。 |
Attribute.value |
多個 | 系統會根據 Attribute.type (或 log_type ,如果衍生自 Attribute.type ) 使用這個欄位的值,填入多個 UDM 欄位:- event.idm.entity.entity.hostname (如果 type 為「網域」)。- event.idm.entity.entity.file.md5 (如果 type 為「md5」)。- event.idm.entity.entity.file.sha1 (如果 type 為「sha1」)。- event.idm.entity.entity.file.sha256 (如果 type 為「sha256」)。- event.idm.entity.entity.resource.name (如果 type 為「mutex」)。- event.idm.entity.entity.registry.registry_key (如果 type 為「regkey」)。- event.idm.entity.entity.user.email_addresses (如果 type 為「威脅行為者」)。- type (如果 type 為 uri 或 url )。event.idm.entity.entity.url - event.idm.entity.entity.file.full_path (如果 type 為「filename」)。- 如果 type 是「ip-dst|port」、「ip-dst」或「ip-src」,則會剖析 IP 和通訊埠。用於 JSON 剖析路徑。 |
column1 |
event.idm.entity.metadata.product_entity_id |
直接從 CSV 剖析路徑中的 column1 對應。 |
column14 |
「event.idm.entity.metadata.threat.description 」旗下品牌 |
與 description 串連,形成威脅中繼資料中的最終說明。用於 CSV 剖析路徑。 |
column16 |
event.idm.entity.metadata.threat.threat_feed_name 、event.ioc.feed_name |
直接對應自 column16 。用於 CSV 剖析路徑。 |
column18 |
event.idm.entity.metadata.threat.severity_details 、event.ioc.raw_severity |
直接對應自 column18 。用於 CSV 剖析路徑。 |
column21 |
event.idm.entity.metadata.threat.description 、event.ioc.description 的一部分 |
做為說明的基礎,稍後會與 event_info 串連。用於 CSV 剖析路徑。 |
column3 |
「event.ioc.categorization 」旗下品牌 |
直接從 column3 對應,並與「IOC」串連,形成最終分類。用於 CSV 剖析路徑。 |
column4 |
event.idm.entity.metadata.description |
直接對應自 column4 。用於 CSV 剖析路徑。 |
column5 |
多個 | 系統會根據 column4 欄位 (對應至 type ) 的值,填入多個 UDM 欄位:- event.idm.entity.entity.hostname (如果 type 為「網域」)。- 如果 type 是「ip-dst|port」、「ip-dst」或「ip-src」,則會剖析 IP 和通訊埠。- event.idm.entity.entity.file.md5 (如果 type 為「md5」)。- event.idm.entity.entity.file.sha1 (如果 type 為「sha1」)。- event.idm.entity.entity.file.sha256 (如果 type 為「sha256」)。- event.idm.entity.entity.resource.name (如果 type 為「mutex」)。- event.idm.entity.entity.registry.registry_key (如果 type 為「regkey」)。- event.idm.entity.entity.user.email_addresses (如果 type 為「威脅行為者」)。- type (如果 type 為 uri 或 url )。event.idm.entity.entity.url - event.idm.entity.entity.file.full_path (如果 type 為「filename」)。用於 CSV 剖析路徑。 |
column6 |
event.idm.entity.metadata.threat.summary |
直接對應自 column6 。用於 CSV 剖析路徑。 |
column8 |
event.ioc.active_timerange.start 、event.idm.entity.metadata.interval.start_time |
解析為 UNIX 時間戳記。用於 CSV 剖析路徑。 |
date description |
event.idm.entity.metadata.threat.description |
直接從「data」欄位中的巢狀 JSON 物件內對應 description 。用於 JSON 剖析路徑。 |
event_creator_email |
event.idm.entity.entity.labels.value |
直接從 event_creator_email 對應,並以「event_creator_email」鍵新增為標籤。用於 JSON 剖析路徑。 |
event_id Feed.publish |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Feed.publish 對應,並以「Feed publish」鍵新增為偵測欄位。用於 JSON 剖析路徑。 |
first_seen |
event.ioc.active_timerange.start 、event.idm.entity.metadata.interval.start_time |
系統會將此值剖析為「yyyy-MM-ddTHH:mm:ssZZ」格式的時間戳記。用於 JSON 剖析路徑。 |
id info |
event.idm.entity.metadata.description |
直接從「data」欄位中的巢狀 JSON 物件內對應 info 。用於 JSON 剖析路徑。 |
last_seen |
event.ioc.active_timerange.end |
系統會將此值剖析為「yyyy-MM-ddTHH:mm:ssZZ」格式的時間戳記。用於 JSON 剖析路徑。 |
Org.name |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Org.name 對應,並新增為偵測欄位,索引鍵為「Org name」。用於 JSON 剖析路徑。 |
published |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 published 對應,並以「published」鍵新增為偵測欄位。用於 JSON 剖析路徑。 |
Tag.colour |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.colour 對應,並新增為偵測欄位,索引鍵為「tag colour」。用於 JSON 剖析路徑。 |
Tag.exportable |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.exportable 對應,並新增為偵測欄位,鍵為「tag exportable」。用於 JSON 剖析路徑。 |
Tag.hide_tag |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.hide_tag 對應,並新增為偵測欄位,索引鍵為「tag hide_tag」。用於 JSON 剖析路徑。 |
Tag.id |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.id 對應,並新增為偵測欄位,索引鍵為「tag id」。用於 JSON 剖析路徑。 |
Tag.is_custom_galaxy |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.is_custom_galaxy 對應,並新增為偵測欄位,索引鍵為「tag is_custom_galaxy」。用於 JSON 剖析路徑。 |
Tag.is_galaxy |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.is_galaxy 對應,並以「tag is_galaxy」鍵新增為偵測欄位。用於 JSON 剖析路徑。 |
Tag.isinherited |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.isinherited 對應,並新增為偵測欄位,索引鍵為「tag isinherited」。用於 JSON 剖析路徑。 |
Tag.name |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.name 對應,並以「標記名稱」做為鍵新增為偵測欄位。用於 JSON 剖析路徑。 |
Tag.numerical_value |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.numerical_value 對應,並新增為偵測欄位,索引鍵為「tag numerical_value」。用於 JSON 剖析路徑。 |
Tag.user_id |
event.idm.entity.metadata.threat.detection_fields.value |
直接從 Tag.user_id 對應,並新增為偵測欄位,索引鍵為「tag user_id」。用於 JSON 剖析路徑。 |
threat_level_id |
event.idm.entity.entity.labels.value |
直接從 threat_level_id 對應,並以「threat_level_id」鍵新增為標籤。用於 JSON 剖析路徑。 |
timestamp |
event.idm.entity.metadata.collected_timestamp 、event.idm.entity.metadata.interval.start_time |
解析為 UNIX 時間戳記。用於 CSV 剖析路徑。 |
uuid |
event.idm.entity.metadata.vendor_name |
由剖析器設為「MISP」。由剖析器設為「MISP」。設為遠遠未來的預設值 (自 Epoch 紀元時間起算 253402300799 秒)。由剖析器根據 type 或 log_type 欄位判斷。可以是「FILE」、「DOMAIN_NAME」、「IP_ADDRESS」、「MUTEX」、「RESOURCE」或「USER」。可從 Attribute.comment 或 Attribute.value 衍生,視 Attribute.type 而定。如果類型與 IP 相關,則從 Attribute.value 或 column5 剖析。如果類型為「ip-dst|port」,則從 Attribute.value 或 column5 剖析。衍生自 CSV 剖析中的 column3 或 JSON 剖析中的 Attribute.category 。衍生自 CSV 剖析中的 column21 和 column14 。衍生自 column8 或 first_seen 。衍生自 last_seen 。使用 grok 模式從 description 衍生而來。衍生自 column16 或設為「MISP」。衍生自 column18 。如果類型與 IP 相關,則從 Attribute.value 或 column5 剖析。如果類型為「ip-dst|port」,則從 Attribute.value 或 column5 剖析。如果類型為「網域」,則衍生自 Attribute.value 或 column5 。衍生自 confidence 欄位,該欄位是從 description 欄位擷取而來。值可以是「HIGH_CONFIDENCE」、「MEDIUM_CONFIDENCE」、「LOW_CONFIDENCE」或「UNKNOWN_CONFIDENCE」。直接從「confidence 」欄位對應,該欄位是從「description 」欄位擷取而來。直接從 threat_level 欄位對應,該欄位衍生自 CSV 剖析路徑中的 column18 。直接從 feed_name 欄位對應,該欄位衍生自 CSV 剖析路徑中的 column16 。衍生自 CSV 剖析中的 column21 和 column14 。衍生自 CSV 剖析中的 column6 或 JSON 剖析中的 Attribute.comment 。系統會新增多個欄位做為偵測欄位,並提供對應的鍵。系統會將多個欄位新增為標籤,並附上對應的鍵。從原始記錄的頂層 timestamp 欄位複製。 |
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。