收集 MISP IOC 記錄
支援的國家/地區:
Google SecOps
SIEM
本文說明如何使用 Bindplane,將 MISP (惡意軟體資訊分享平台) IOC 記錄擷取至 Google Security Operations。剖析器會處理 CSV 和 JSON 格式的資料。這項功能會擷取 IP 位址、網域、雜湊和網址等 IOC 屬性,並將這些屬性對應至統一資料模型 (UDM),以及嚴重程度、信賴度和說明等威脅詳細資料。剖析器會處理輸入資料中的單一和多個 IOC 項目,並將其正規化為一致的 UDM 輸出內容。
事前準備
請確認您已完成下列事前準備事項:
- Google SecOps 執行個體。
- 搭載
systemd
的 Linux 主機。 - 如果透過 Proxy 執行,請確保防火牆通訊埠已根據 Bindplane 代理程式需求開啟。
- MISP 伺服器的特殊存取權。
取得 Google SecOps 擷取驗證檔案
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」>「收集代理程式」。
- 下載擷取驗證檔案。
- 將檔案安全地儲存在要安裝 Bindplane 的系統上。
取得 Google SecOps 客戶 ID
- 登入 Google SecOps 控制台。
- 依序前往「SIEM 設定」*>「設定檔」。
- 複製並儲存「機構詳細資料」專區中的客戶 ID。
取得 MISP API 憑證
- 以管理員身分登入 MISP 網頁介面。
- 依序前往「Administration」(管理) >「List Auth Keys」(列出驗證金鑰)。
- 按一下「新增驗證金鑰」。
- 提供下列設定詳細資料:
- 使用者:選取與金鑰相關聯的使用者帳戶。
- 選用:允許的 IP:指定金鑰允許的 IP 位址。
- 到期日:如要設為無期限,請留空;如要設定到期日,請視需要填寫。
- 按一下「提交」。
- 複製 API 金鑰並儲存在安全地點。
- 按一下「我已記下金鑰」。
設定 MISP 資料匯出作業
在 MISP 伺服器上安裝 PyMISP:
pip3 install pymisp
建立匯出目錄:
sudo mkdir -p /opt/misp/scripts sudo mkdir -p /opt/misp/ioc_export
建立憑證檔案
/opt/misp/scripts/keys.py
:misp_url = 'https://<MISP_SERVER_URL>' misp_key = '<MISP_API_KEY>' misp_verifycert = True misp_client_cert = ''
- 將
<MISP_SERVER_URL>
替換為您的 MISP 伺服器網址。 - 將
<MISP_API_KEY>
替換為必要條件中的 API 金鑰。
- 將
建立匯出指令碼
/opt/misp/scripts/misp_export.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='Export MISP IOCs to CSV format.') parser.add_argument("--controller", default='attributes', help="Controller to use for search (events, objects, attributes)") parser.add_argument("--event_id", help="Event ID to fetch. Without it, fetches recent data.") parser.add_argument("--attributes", nargs='*', help="Requested attributes for CSV export") parser.add_argument("--misp_types", nargs='+', help="MISP types to fetch (ip-src, hostname, domain, etc.)") parser.add_argument("--context", action='store_true', help="Add event level context (tags, metadata)") parser.add_argument("--outfile", required=True, help="Output file to write the CSV data") parser.add_argument("--last", required=True, help="Time period: days (d), hours (h), minutes (m) - e.g., 1d, 12h, 30m") args = parser.parse_args() api = ExpandedPyMISP(misp_url, misp_key, misp_verifycert, debug=False) response = api.search( controller=args.controller, return_format='csv', type_attribute=args.misp_types, publish_timestamp=args.last, include_context=args.context, requested_attributes=args.attributes or None ) with open(args.outfile, 'w') as response_file: response_file.write(response)
- 將指令碼設定為可執行:
sudo chmod +x /opt/misp/scripts/misp_export.py
排定 MISP 資料匯出作業
- 使用 crontab 建立匯出排程:
sudo crontab -e
新增下列 cron 項目:
# Export different IOC types daily with context 0 0 * * * python3 /opt/misp/scripts/misp_export.py --outfile /opt/misp/ioc_export/domains.csv --misp_types domain --last 1d --context --attributes uuid event_id category type value comment to_ids date attribute_tag event_info 0 1 * * * python3 /opt/misp/scripts/misp_export.py --outfile /opt/misp/ioc_export/ip-src.csv --misp_types ip-src --last 1d --context --attributes uuid event_id category type value comment to_ids date attribute_tag event_info 0 2 * * * python3 /opt/misp/scripts/misp_export.py --outfile /opt/misp/ioc_export/ip-dst.csv --misp_types ip-dst --last 1d --context --attributes uuid event_id category type value comment to_ids date attribute_tag event_info 0 3 * * * python3 /opt/misp/scripts/misp_export.py --outfile /opt/misp/ioc_export/urls.csv --misp_types url --last 1d --context --attributes uuid event_id category type value comment to_ids date attribute_tag event_info 0 4 * * * python3 /opt/misp/scripts/misp_export.py --outfile /opt/misp/ioc_export/sha256.csv --misp_types sha256 --last 1d --context --attributes uuid event_id category type value comment to_ids date attribute_tag event_info 0 5 * * * python3 /opt/misp/scripts/misp_export.py --outfile /opt/misp/ioc_export/filenames.csv --misp_types filename --last 1d --context --attributes uuid event_id category type value comment to_ids date attribute_tag event_info 0 6 * * * python3 /opt/misp/scripts/misp_export.py --outfile /opt/misp/ioc_export/registries.csv --misp_types regkey --last 1d --context --attributes uuid event_id category type value comment to_ids date attribute_tag event_info 0 7 * * * python3 /opt/misp/scripts/misp_export.py --outfile /opt/misp/ioc_export/mutexes.csv --misp_types mutex --last 1d --context --attributes uuid event_id category type value comment to_ids date attribute_tag event_info
視需要排定從 MISP 擷取動態饋給的時間:
23 0 * * * curl --insecure --header "Authorization: <MISP_API_KEY>" --header "Accept: application/json" --header "Content-Type: application/json" https://<MISP_SERVER_URL>/feeds/fetchFromAllFeeds
安裝 Bindplane 代理程式
按照下列操作說明,在 Linux 作業系統上安裝 Bindplane 代理程式。
Linux 安裝
- 開啟具有根層級或 sudo 權限的終端機。
執行下列指令:
sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-otel-collector/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 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
- 請將
<CUSTOMER_ID>
替換成必要條件中的實際客戶 ID。 - 將
/path/to/ingestion-authentication-file.json
更新為驗證檔案的儲存路徑。
- 請將
重新啟動 Bindplane 代理程式,以套用變更
如要在 Linux 中重新啟動 Bindplane 代理程式,請執行下列指令:
sudo systemctl restart observiq-otel-collector
UDM 對應表
記錄欄位 | UDM 對應 | 邏輯 |
---|---|---|
Attribute.category | entity.metadata.threat.category_details | 直接從 Attribute 物件的 category 欄位對應。 |
Attribute.comment | entity.metadata.threat.summary | 直接從 Attribute 物件的 comment 欄位對應。 |
Attribute.deleted | entity.metadata.threat.detection_fields.value | 直接從 Attribute 物件的 deleted 欄位對應。這個按鈕已設為「Attribute deleted 」。 |
Attribute.event_id | entity.metadata.threat.detection_fields.value | 直接從 Attribute 物件的 event_id 欄位對應。這個按鈕已設為「Attribute event_id 」。 |
Attribute.first_seen | entity.metadata.threat.detection_fields.value | 直接從 Attribute 物件的 first_seen 欄位對應。這個按鈕已設為「Attribute first_seen 」。 |
Attribute.id | entity.metadata.threat.detection_fields.value | 直接從 Attribute 物件的 id 欄位對應。視原始記錄的格式而定,金鑰會設為 Attribute id 或 Attribute id $$ 。 |
Attribute.timestamp | entity.metadata.threat.detection_fields.value | 直接從 Attribute 物件的 timestamp 欄位對應。這個按鈕已設為「Attribute timestamp 」。 |
Attribute.to_ids | entity.metadata.threat.detection_fields.value | 直接從 Attribute 物件的 to_ids 欄位對應。這個按鈕已設為「Attribute to_ids 」。 |
Attribute.type | entity.metadata.threat.category_details | 直接從 Attribute 物件的 type 欄位對應。 |
Attribute.type | log_type | 用於判斷 IOC 類型,並將其對應至適當的 UDM 欄位。 |
Attribute.uuid | entity.metadata.product_entity_id | 直接從 Attribute 物件的 uuid 欄位對應。 |
Attribute.value | entity.entity.file.full_path | 如果 Attribute.type 為 filename ,則會對應。 |
Attribute.value | entity.entity.file.md5 | 如果 Attribute.type 為 md5 ,則會對應。 |
Attribute.value | entity.entity.file.sha1 | 如果 Attribute.type 為 sha1 ,則會對應。 |
Attribute.value | entity.entity.file.sha256 | 如果 Attribute.type 為 sha256 ,則會對應。 |
Attribute.value | entity.entity.hostname | 如果 Attribute.type 為 domain ,則會對應。 |
Attribute.value | entity.entity.ip | 如果 Attribute.type 為 ip-dst 、ip-dst|port 或 ip-src ,則會對應。系統會使用 grok 模式擷取值。 |
Attribute.value | entity.entity.resource.name | 如果 Attribute.type 為 mutex ,則會對應。 |
Attribute.value | entity.entity.registry.registry_key | 如果 Attribute.type 為 regkey ,則會對應。 |
Attribute.value | entity.entity.url | 如果 Attribute.type 為 uri 或 URL ,則會對應。 |
第 1 欄 | entity.metadata.product_entity_id | 直接對應 CSV 資料的第一欄。 |
column14 | event_info | 用於將其他資訊附加至 threat_sr.description 欄位。 |
column16 | event_source_org | 直接對應 CSV 資料中的第 16 欄。 |
column18 | threat_level | 直接對應 CSV 資料中的第 18 欄。 |
column21 | 說明 | 直接對應 CSV 資料中的第 21 欄。 |
第 3 欄 | misp_category | 直接對應 CSV 資料中的第三欄。 |
column4 | 類型 | 直接對應 CSV 資料中的第四欄。 |
column5 | 值 | 直接對應 CSV 資料中的第五欄。 |
column6 | 留言 | 直接對應 CSV 資料中的第六欄。 |
column8 | ts1 | 直接對應 CSV 資料中的第八欄。 |
說明 | ioc.description | 這個值是由 description 欄位和 event_info 欄位合併產生,並以 - additional info: 分隔。 |
說明 | entity.metadata.threat.description | 直接對應「description 」欄位。 |
event_creator_email | entity.entity.labels.value | 直接對應「event_creator_email 」欄位。這個按鈕已設為「event_creator_email 」。 |
event_source_org | ioc.feed_name | 直接對應「event_source_org 」欄位。 |
event_source_org | entity.metadata.threat.threat_feed_name | 直接對應「event_source_org 」欄位。 |
Feed.publish | entity.metadata.threat.detection_fields.value | 直接從 Feed 物件的 publish 欄位對應。這個按鈕已設為「Feed publish 」。 |
first_seen | ioc.active_timerange.start | 直接對應「first_seen 」欄位。系統會將這個值剖析為日期。 |
first_seen | entity.metadata.interval.start_time | 直接對應「first_seen 」欄位。系統會將這個值剖析為日期。 |
資訊 | entity.metadata.description | 直接對應「info 」欄位。 |
last_seen | ioc.active_timerange.end | 直接對應「last_seen 」欄位。系統會將這個值剖析為日期。 |
log.category | ioc.categorization | 直接從 log 物件的 category 欄位對應。 |
log.category | entity.metadata.threat.category_details | 直接從 log 物件的 category 欄位對應。 |
log.comment | entity.entity.file.full_path | 如果 log.type 為 filename ,且 comment 欄位不是 Artifacts dropped ,則為對應。 |
log.comment | entity.metadata.threat.detection_fields.value | 直接從 log 物件的 comment 欄位對應。這個按鈕已設為「Attribute comment 」。 |
log.comment | entity.metadata.threat.summary | 直接從 log 物件的 comment 欄位對應。 |
log.deleted | entity.metadata.threat.detection_fields.value | 直接從 log 物件的 deleted 欄位對應。這個按鈕已設為「Attribute deleted 」。 |
log.event_id | entity.metadata.threat.detection_fields.value | 直接從 log 物件的 event_id 欄位對應。這個按鈕已設為「Attribute event_id 」。 |
log.first_seen | entity.metadata.threat.detection_fields.value | 直接從 log 物件的 first_seen 欄位對應。這個按鈕已設為「Attribute first_seen 」。 |
log.id | entity.metadata.threat.detection_fields.value | 直接從 log 物件的 id 欄位對應。這個按鈕已設為「Attribute id 」。 |
log.timestamp | entity.metadata.threat.detection_fields.value | 直接從 log 物件的 timestamp 欄位對應。這個按鈕已設為「Attribute timestamp 」。 |
log.to_ids | entity.metadata.threat.detection_fields.value | 直接從 log 物件的 to_ids 欄位對應。這個按鈕已設為「Attribute to_ids 」。 |
log.type | ioc.categorization | 直接從 log 物件的 type 欄位對應。 |
log.type | log_type | 用於判斷 IOC 類型,並將其對應至適當的 UDM 欄位。 |
log.uuid | entity.metadata.product_entity_id | 直接從 log 物件的 uuid 欄位對應。 |
log.value | entity.entity.file.full_path | 如果 log.type 為 filename ,則會對應。 |
log.value | entity.entity.file.md5 | 如果 log.type 為 md5 ,則會對應。 |
log.value | entity.entity.file.sha1 | 如果 log.type 為 sha1 ,則會對應。 |
log.value | entity.entity.file.sha256 | 如果 log.type 為 sha256 ,則會對應。 |
log.value | entity.entity.hostname | 如果 log.type 為 domain ,則會對應。 |
log.value | entity.entity.ip | 如果 log.type 為 ip-dst 、ip-dst|port 或 ip-src ,則會對應。系統會使用 grok 模式擷取值。 |
log.value | entity.entity.resource.name | 如果 log.type 為 mutex ,則會對應。 |
log.value | entity.entity.registry.registry_key | 如果 log.type 為 regkey ,則會對應。 |
log.value | entity.entity.url | 如果 log.type 為 uri 或 url ,則會對應。 |
log.value | ioc.domain_and_ports.domain | 如果 log.type 為 domain ,則會對應。 |
log.value | entity.entity.user.email_addresses | 如果 log.type 為 threat-actor ,則會對應。 |
misp_category | entity.metadata.threat.category_details | 直接對應「misp_category 」欄位。 |
Org.name | entity.metadata.threat.detection_fields.value | 直接從 Org 物件的 name 欄位對應。這個按鈕已設為「Org name 」。 |
已發布 | entity.metadata.threat.detection_fields.value | 直接對應「published 」欄位。這個按鈕已設為「published 」。 |
Tag.colour | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 colour 欄位對應。這個按鈕已設為「tag colour 」。 |
Tag.exportable | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 exportable 欄位對應。這個按鈕已設為「tag exportable 」。 |
Tag.hide_tag | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 hide_tag 欄位對應。這個按鈕已設為「tag hide_tag 」。 |
Tag.id | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 id 欄位對應。這個按鈕已設為「tag id 」。 |
Tag.is_custom_galaxy | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 is_custom_galaxy 欄位對應。這個按鈕已設為「tag is_custom_galaxy 」。 |
Tag.is_galaxy | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 is_galaxy 欄位對應。這個按鈕已設為「tag is_galaxy 」。 |
Tag.isinherited | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 isinherited 欄位對應。這個按鈕已設為「tag isinherited 」。 |
Tag.name | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 name 欄位對應。這個按鈕已設為「tag name 」。 |
Tag.numerical_value | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 numerical_value 欄位對應。這個按鈕已設為「tag numerical_value 」。 |
Tag.user_id | entity.metadata.threat.detection_fields.value | 直接從 Tag 物件的 user_id 欄位對應。這個按鈕已設為「tag user_id 」。 |
threat_level | ioc.raw_severity | 直接對應「threat_level 」欄位。 |
threat_level | entity.metadata.threat.severity_details | 直接對應「threat_level 」欄位。 |
threat_level_id | entity.entity.labels.value | 直接對應「threat_level_id 」欄位。這個按鈕已設為「threat_level_id 」。 |
ts1 | ioc.active_timerange.start | 直接對應「ts1 」欄位。系統會將這個值剖析為日期。 |
ts1 | entity.metadata.interval.start_time | 直接對應「ts1 」欄位。系統會將這個值剖析為日期。 |
entity.entity.file.full_path | 如果 type 為 filename ,則會對應。 |
|
entity.entity.file.md5 | 如果 type 為 md5 ,則會對應。 |
|
entity.entity.file.sha1 | 如果 type 為 sha1 ,則會對應。 |
|
entity.entity.file.sha256 | 如果 type 為 sha256 ,則會對應。 |
|
entity.entity.hostname | 如果 type 為 domain ,則會對應。 |
|
entity.entity.ip | 如果 type 為 ip-dst 、ip-dst|port 或 ip-src ,則會對應。系統會使用 grok 模式擷取值。 |
|
entity.entity.port | 如果 port 欄位不為空白,則會對應。這個值會轉換為整數。 |
|
entity.entity.resource.name | 如果 type 為 mutex ,則會對應。 |
|
entity.entity.resource.resource_subtype | 如果 type 為 regkey ,則會對應。值會設為 regkey 。 |
|
entity.entity.resource.resource_type | 如果 type 為 mutex 或 regkey ,則會對應。值分別設為 MUTEX 或 STORAGE_OBJECT 。 |
|
entity.entity.registry.registry_key | 如果 type 為 regkey ,則會對應。 |
|
entity.entity.url | 如果 type 為 uri 或 url ,則會對應。 |
|
entity.metadata.collected_timestamp | 這個值會設為原始記錄項目的時間戳記。 | |
entity.metadata.description | 如果原始記錄採用 CSV 格式,值會設為 type 欄位。否則會設為 info 欄位。 |
|
entity.metadata.entity_type | 系統會根據 type 或 log_type 欄位判斷值。可以是 DOMAIN_NAME 、FILE 、IP_ADDRESS 、MUTEX 、RESOURCE 或 URL 。 |
|
entity.metadata.interval.end_time | 值會設為預設值 253402300799 秒。 | |
entity.metadata.interval.start_time | 如果 first_seen 欄位不為空白,系統會將值設為該欄位。否則,系統會將其設為 1 秒的預設值,或是原始記錄項目的時間戳記。 |
|
entity.metadata.product_name | 值會設為 MISP 。 |
|
entity.metadata.threat.confidence | 如果 confidence 欄位為空白或 f ,值會設為 UNKNOWN_CONFIDENCE 。否則,系統會根據 confidence 欄位的值,將其設為 HIGH_CONFIDENCE 、MEDIUM_CONFIDENCE 或 LOW_CONFIDENCE 。 |
|
entity.metadata.threat.confidence_details | 直接對應「confidence 」欄位。 |
|
entity.metadata.threat.detection_fields | 這個值是從原始記錄檔的各種欄位中擷取的鍵/值組合清單。 | |
entity.metadata.vendor_name | 值會設為 MISP 。 |
|
ioc.active_timerange.end | 如果 last_seen 欄位不為空白,系統會將值設為該欄位。 |
|
ioc.active_timerange.start | 如果 ts1 或 first_seen 欄位不為空白,系統會將值設為這些欄位。否則會設為預設值 1 秒。 |
|
ioc.categorization | 如果原始記錄採用 CSV 格式,值會設為 misp_category IOCs 。否則會設為 Attribute 或 log 物件中的 category 欄位。 |
|
ioc.confidence_score | 直接對應「confidence 」欄位。 |
|
ioc.description | 這個值是由 description 欄位和 event_info 欄位合併產生,並以 - additional info: 分隔。 |
|
ioc.domain_and_ports.domain | 如果 type 或 log_type 為 domain ,則會對應。 |
|
ioc.feed_name | 如果 event_source_org 欄位為空白,系統會將值設為 MISP 。否則會設為 event_source_org 欄位。 |
|
ioc.ip_and_ports.ip_address | 如果 ip 欄位不為空白,則會對應。該值會轉換為 IP 位址。 |
|
ioc.ip_and_ports.ports | 如果 port 欄位不為空白,則會對應。該值會轉換為無正負號整數。 |
|
ioc.raw_severity | 直接對應「threat_level 」欄位。 |
|
時間戳記 | 這個值會設為原始記錄項目的時間戳記。 |
還有其他問題嗎?向社群成員和 Google SecOps 專業人員尋求答案。