MISP IOC ログを収集する

以下でサポートされています。

このドキュメントでは、Bindplane を使用して MISP(Malware Information Sharing Platform)IOC ログを Google Security Operations に取り込む方法について説明します。パーサーは、CSV 形式と JSON 形式の両方のデータを処理します。IP アドレス、ドメイン、ハッシュ、URL などの IOC 属性を抽出し、重大度、信頼度、説明などの脅威の詳細とともに統合データモデル(UDM)にマッピングします。パーサーは、入力データ内の単一の IOC エントリと複数の IOC エントリの両方を処理し、一貫性のある UDM 出力に正規化します。

始める前に

次の前提条件を満たしていることを確認してください。

  • Google SecOps インスタンス。
  • systemd を含む Linux ホスト。
  • プロキシの背後で実行している場合は、Bindplane エージェントの要件に従ってファイアウォール ポートが開いていることを確認します。
  • MISP サーバーへの特権アクセス。

Google SecOps の取り込み認証ファイルを取得する

  1. Google SecOps コンソールにログインします。
  2. [SIEM 設定] > [収集エージェント] に移動します。
  3. Ingestion Authentication File をダウンロードします。
    • Bindplane をインストールするシステムにファイルを安全に保存します。

Google SecOps のお客様 ID を取得する

  1. Google SecOps コンソールにログインします。
  2. [SIEM 設定]*> [プロファイル] に移動します。
  3. [組織の詳細情報] セクションから [お客様 ID] をコピーして保存します。

MISP API 認証情報を取得する

  1. 管理者として MISP ウェブ インターフェースにログインします。
  2. [Administration] > [List Auth Keys] に移動します。
  3. [認証キーを追加] をクリックします。
  4. 次の構成の詳細を入力します。
    • ユーザー: キーに関連付けられているユーザー アカウントを選択します。
    • 省略可: 許可された IP: 鍵に対して許可された IP アドレスを指定します。
    • 有効期限: 有効期限を設定しない場合は空白のままにします。必要に応じて設定することもできます。
  5. [送信] をクリックします。
  6. API キーをコピーして安全な場所に保存します。
  7. [鍵をメモしました] をクリックします。

MISP データ エクスポートを構成する

  1. MISP サーバーに PyMISP をインストールします。

    pip3 install pymisp
    
  2. エクスポート ディレクトリを作成します。

    sudo mkdir -p /opt/misp/scripts
    sudo mkdir -p /opt/misp/ioc_export
    
  3. 認証情報ファイル /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 サーバーの URL に置き換えます。
    • <MISP_API_KEY> は、前提条件の API キーに置き換えます。
  4. エクスポート スクリプト /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)
    
    1. スクリプトを実行可能にします。
    sudo chmod +x /opt/misp/scripts/misp_export.py
    

    MISP データ エクスポートをスケジュールする

    1. crontab を使用してスケジュール設定されたエクスポートを作成します。
    sudo crontab -e
    
  5. 次の 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
    
  6. 必要に応じて、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 のインストール

  1. root 権限または sudo 権限でターミナルを開きます。
  2. 次のコマンドを実行します。

    sudo sh -c "$(curl -fsSlL https://github.com/observiq/bindplane-otel-collector/releases/latest/download/install_unix.sh)" install_unix.sh
    

その他のインストール リソース

MISP ログを取り込んで Google SecOps に送信するように Bindplane エージェントを構成する

  1. 構成ファイルにアクセスします。

    • config.yaml ファイルを見つけます。通常、Linux では /etc/bindplane-agent/ ディレクトリにあります。
    • テキスト エディタ(nanovi など)を使用してファイルを開きます。
  2. 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 エージェントを再起動して変更を適用する

  1. 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.typefilename の場合にマッピングされます。
Attribute.value entity.entity.file.md5 Attribute.typemd5 の場合にマッピングされます。
Attribute.value entity.entity.file.sha1 Attribute.typesha1 の場合にマッピングされます。
Attribute.value entity.entity.file.sha256 Attribute.typesha256 の場合にマッピングされます。
Attribute.value entity.entity.hostname Attribute.typedomain の場合にマッピングされます。
Attribute.value entity.entity.ip Attribute.typeip-dstip-dst|portip-src の場合にマッピングされます。値は、grok パターンを使用して抽出されます。
Attribute.value entity.entity.resource.name Attribute.typemutex の場合にマッピングされます。
Attribute.value entity.entity.registry.registry_key Attribute.typeregkey の場合にマッピングされます。
Attribute.value entity.entity.url Attribute.typeuri または URL の場合はマッピングされます。
column1 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 列目から直接マッピングされます。
column3 misp_category CSV データの 3 列目から直接マッピングされます。
column4 type CSV データの 4 列目から直接マッピングされます。
column5 CSV データの 5 列目から直接マッピングされます。
column6 コメント CSV データの 6 列目から直接マッピングされます。
column8 ts1 CSV データの 8 列目から直接マッピングされます。
説明 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.typefilename で、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.typefilename の場合にマッピングされます。
log.value entity.entity.file.md5 log.typemd5 の場合にマッピングされます。
log.value entity.entity.file.sha1 log.typesha1 の場合にマッピングされます。
log.value entity.entity.file.sha256 log.typesha256 の場合にマッピングされます。
log.value entity.entity.hostname log.typedomain の場合にマッピングされます。
log.value entity.entity.ip log.typeip-dstip-dst|portip-src の場合にマッピングされます。値は、grok パターンを使用して抽出されます。
log.value entity.entity.resource.name log.typemutex の場合にマッピングされます。
log.value entity.entity.registry.registry_key log.typeregkey の場合にマッピングされます。
log.value entity.entity.url log.typeuri または url の場合はマッピングされます。
log.value ioc.domain_and_ports.domain log.typedomain の場合にマッピングされます。
log.value entity.entity.user.email_addresses log.typethreat-actor の場合にマッピングされます。
misp_category entity.metadata.threat.category_details misp_category フィールドから直接マッピングされます。
Org.name entity.metadata.threat.detection_fields.value Org オブジェクトの name フィールドから直接マッピングされます。キーは Org name に設定されます。
published 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 typefilename の場合にマッピングされます。
entity.entity.file.md5 typemd5 の場合にマッピングされます。
entity.entity.file.sha1 typesha1 の場合にマッピングされます。
entity.entity.file.sha256 typesha256 の場合にマッピングされます。
entity.entity.hostname typedomain の場合にマッピングされます。
entity.entity.ip typeip-dstip-dst|portip-src の場合にマッピングされます。値は、grok パターンを使用して抽出されます。
entity.entity.port port フィールドが空でない場合にマッピングされます。値は整数に変換されます。
entity.entity.resource.name typemutex の場合にマッピングされます。
entity.entity.resource.resource_subtype typeregkey の場合にマッピングされます。値は regkey に設定されています。
entity.entity.resource.resource_type typemutex または regkey の場合はマッピングされます。値はそれぞれ MUTEX または STORAGE_OBJECT に設定されます。
entity.entity.registry.registry_key typeregkey の場合にマッピングされます。
entity.entity.url typeuri または url の場合はマッピングされます。
entity.metadata.collected_timestamp 値は、未加工ログエントリのタイムスタンプに設定されます。
entity.metadata.description 未加工ログが CSV 形式の場合、値は type フィールドに設定されます。それ以外の場合は、info フィールドに設定されます。
entity.metadata.entity_type 値は type フィールドまたは log_type フィールドに基づいて決定されます。DOMAIN_NAMEFILEIP_ADDRESSMUTEXRESOURCEURL のいずれかです。
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_CONFIDENCEMEDIUM_CONFIDENCELOW_CONFIDENCE のいずれかに設定されます。
entity.metadata.threat.confidence_details confidence フィールドから直接マッピングされます。
entity.metadata.threat.detection_fields 値は、未加工ログのさまざまなフィールドから抽出された Key-Value ペアのリストです。
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_typedomain の場合はマッピングされます。
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 フィールドから直接マッピングされます。
timestamp 値は、未加工ログエントリのタイムスタンプに設定されます。

さらにサポートが必要な場合 コミュニティ メンバーや Google SecOps のプロフェッショナルから回答を得ることができます。