PowerShell ログを収集する

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

このドキュメントでは、Bindplane を使用して PowerShell ログを Google Security Operations に収集する方法について説明します。パーサーは、未加工の Microsoft PowerShell ログを統合データモデル(UDM)に変換します。まず、未加工のログ メッセージからフィールドを抽出し、UDM フィールドに正規化します。次に、特定のイベント ID に基づいて追加のコンテキストでデータを拡充し、最終的にセキュリティ分析用の構造化 UDM イベントを作成します。

始める前に

  • Google SecOps インスタンスがあることを確認します。
  • Windows 2016 以降があることを確認します。
  • プロキシの背後で実行している場合は、ファイアウォールのポートが開いていることを確認します。

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

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

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

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

Windows に Bindplane エージェントをインストールする

  1. 管理者として コマンド プロンプトまたは PowerShell を開きます。
  2. 次のコマンドを実行します。

    msiexec /i "https://github.com/observIQ/bindplane-agent/releases/latest/download/observiq-otel-collector.msi" /quiet
    

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

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

  1. YAML ファイルを構成する前に、サービスパネルで observIQ Distro for Open Telemetry Collector サービスを停止します。
  2. 構成ファイルにアクセスします。

    1. config.yaml ファイルを見つけます。通常、Linux では /etc/bindplane-agent/ ディレクトリ、Windows ではインストール ディレクトリにあります。
    2. テキスト エディタ(nanovi、メモ帳など)を使用してファイルを開きます。
  3. config.yaml ファイルを次のように編集します。

    receivers:
      windowseventlog/powershell:
        channel: Microsoft-Windows-PowerShell/Operational
        max_reads: 100
        poll_interval: 5s
        raw: true
        start_at: end
    
    processors:
      batch:
    
    exporters:
      chronicle/powershell:
        endpoint: malachiteingestion-pa.googleapis.com
        # Adjust the path to the credentials file you downloaded in Step 1
        creds: '/path/to/ingestion-authentication-file.json'
        log_type: 'POWERSHELL'
        override_log_type: false
        raw_log_field: body
        customer_id: '<customer_id>'
    
    service:
      pipelines:
        logs/winpowershell:
          receivers:
            - windowseventlog/powershell
          processors: [batch]
          exporters: [chronicle/powershell] 
    
  4. <customer_id> は、実際のお客様 ID に置き換えます。

  5. /path/to/ingestion-authentication-file.json の値を、Google SecOps の取り込み認証ファイルを取得するで認証ファイルを保存したパスに更新します。

  6. config.yaml ファイルを保存したら、observIQ Distro for Open Telemetry Collector Service開始します。

Bindplane エージェントを再起動して変更を適用する

  • Windows で Bindplane エージェントを再起動するには、Services コンソールを使用するか、次のコマンドを入力します。

    net stop BindPlaneAgent && net start BindPlaneAgent
    

UDM マッピング テーブル

ログフィールド UDM マッピング ロジック
AccountName principal.user.userid 未加工ログの AccountName フィールドから直接マッピングされます。
ActivityID security_result.detection_fields[0].value 未加工ログの ActivityID フィールドから直接マッピングされます。中かっこが削除されます。
チャネル IDM オブジェクトにはマッピングされません。
collection_time.nanos IDM オブジェクトにはマッピングされません。
collection_time.seconds IDM オブジェクトにはマッピングされません。
コマンド IDM オブジェクトにはマッピングされません。
CommandLine IDM オブジェクトにはマッピングされません。
パソコン principal.hostname 未加工ログの Computer フィールドから直接マッピングされます(存在する場合)。
ContextInfo IDM オブジェクトにはマッピングされません。
ContextInfo_Command Name security_result.detection_fields[0].value 未加工ログの ContextInfo_Command Name フィールドから直接マッピングされます(存在する場合)。
ContextInfo_Command Type security_result.detection_fields[1].value 未加工ログの ContextInfo_Command Type フィールドから直接マッピングされます(存在する場合)。
ContextInfo_Host Application target.process.command_line powershell.Host Application が存在しない場合、未加工ログの ContextInfo_Host Application フィールドから直接マッピングされます。
ContextInfo_Host ID target.asset.asset_id powershell.Host ID が存在しない場合、未加工ログの ContextInfo_Host ID フィールドから直接マッピングされます。値には Host ID: の接頭辞が付いています。
ContextInfo_ホスト名 target.hostname powershell.Host Name が存在しない場合、未加工ログの ContextInfo_Host Name フィールドから直接マッピングされます。
ContextInfo_Script Name target.process.file.full_path script_name が存在しない場合、未加工ログの ContextInfo_Script Name フィールドから直接マッピングされます。
ContextInfo_シーケンス番号 security_result.detection_fields[2].value 未加工ログの ContextInfo_Sequence Number フィールドから直接マッピングされます(存在する場合)。文字列に変換されます。
ContextInfo_Severity IDM オブジェクトにはマッピングされません。
create_time.nanos IDM オブジェクトにはマッピングされません。
create_time.seconds IDM オブジェクトにはマッピングされません。
customer_id IDM オブジェクトにはマッピングされません。
データ IDM オブジェクトにはマッピングされません。
データ security_result.detection_fields[0].value 未加工ログの Data フィールドから直接マッピングされます(存在する場合)。
Data_1 security_result.detection_fields[1].value 未加工ログの Data_1 フィールドから直接マッピングされます(存在する場合)。
Data_2 security_result.detection_fields[2].value 未加工ログの Data_2 フィールドから直接マッピングされます(存在する場合)。
ドメイン principal.administrative_domain 未加工ログの Domain フィールドから直接マッピングされます。
entries IDM オブジェクトにはマッピングされません。
ERROR_EVT_UNRESOLVED IDM オブジェクトにはマッピングされません。
EventCategory IDM オブジェクトにはマッピングされません。
EventData IDM オブジェクトにはマッピングされません。
EventID metadata.product_event_type、security_result.rule_name 未加工ログの EventID フィールドから直接マッピングされます。値の接頭辞は、security_result.rule_name フィールドの場合は EventID: です。
EventLevel IDM オブジェクトにはマッピングされません。
EventLevelName security_result.severity EventLevelName:
の値に基づいてマッピングされます。InformationINFORMATIONAL にマッピングされます。
- VerboseLOW にマッピングされます。
EventLog IDM オブジェクトにはマッピングされません。
EventReceivedTime IDM オブジェクトにはマッピングされません。
EventType IDM オブジェクトにはマッピングされません。
EventTime metadata.event_timestamp タイムスタンプを抽出するために使用されます(存在する場合)。
ExecutionProcessID principal.process.pid 未加工ログの ExecutionProcessID フィールドから直接マッピングされます(存在し、空でないか 0 でない場合)。文字列に変換されます。
ExecutionThreadID security_result.detection_fields[2].value 未加工ログの ExecutionThreadID フィールドから直接マッピングされます(存在し、空でないか 0 でない場合)。文字列に変換されます。
ファイル target.process.file.full_path 未加工ログの File フィールドから直接マッピングされます(存在する場合)。
ホストアプリ IDM オブジェクトにはマッピングされません。
HostApplication IDM オブジェクトにはマッピングされません。
ホスト名 principal.hostname 未加工ログの Hostname フィールドから直接マッピングされます。
id IDM オブジェクトにはマッピングされません。
キーワード IDM オブジェクトにはマッピングされません。
log_type metadata.log_type 未加工ログの log_type フィールドから直接マッピングされます。
マシン principal.asset.asset_id、principal.asset.platform_software.platform_version Machine フィールドが解析され、マシン ID とプラットフォーム情報が抽出されます。マシン ID には Machine ID: という接頭辞が付いています。プラットフォームは、値に基づいて UDM 列挙型にマッピングされます。
- winWINDOWS にマッピングされます。
- macMAC にマッピングされます。
- linLINUX にマッピングされます。
- その他の値は UNKNOWN_PLATFORM にマッピングされます。
ManagementGroupName additional.fields[0].value.string_value 未加工ログの ManagementGroupName フィールドから直接マッピングされます(存在する場合)。
Message.EventTime metadata.event_timestamp タイムスタンプ(存在する場合)を抽出するために使用されます。文字列に変換されます。
Message.Message security_result.description EventID が [40341034104] と message_message_not_found にある場合、未加工ログの Message.Message フィールドから直接マッピングされます。改行とタブはカンマに置き換えられます。
メッセージ security_result.description 未加工ログの Message フィールドから直接マッピングされます(存在する場合)。
MessageNumber IDM オブジェクトにはマッピングされません。
MessageSourceAddress principal.ip 未加工ログの MessageSourceAddress フィールドから直接マッピングされます(存在する場合)。
MessageTotal IDM オブジェクトにはマッピングされません。
MG IDM オブジェクトにはマッピングされません。
オペコード metadata.description 未加工ログの Opcode フィールドから直接マッピングされます。
OpcodeValue IDM オブジェクトにはマッピングされません。
出力 security_result.detection_fields[0].value 未加工ログの Output フィールドから直接マッピングされます(存在する場合)。
powershell.Command Name security_result.detection_fields[0].value powershell.Command Name フィールドが存在する場合は、そのフィールドから直接マッピングされます。
powershell.Command の種類 security_result.detection_fields[1].value powershell.Command Type フィールドが存在する場合は、そのフィールドから直接マッピングされます。
powershell.Host Application target.process.command_line 未加工ログの powershell.Host Application フィールドから直接マッピングされます(存在する場合)。
powershell.Host ID target.asset.asset_id 未加工ログの powershell.Host ID フィールドから直接マッピングされます(存在する場合)。値には Host ID: の接頭辞が付いています。
powershell.Host Name target.hostname 未加工ログの powershell.Host Name フィールドから直接マッピングされます(存在する場合)。
powershell.HostApplication target.process.command_line 未加工ログの powershell.HostApplication フィールドから直接マッピングされます(存在する場合)。
powershell.HostId target.asset.asset_id 未加工ログの powershell.HostId フィールドから直接マッピングされます(存在する場合)。値には Host ID: の接頭辞が付いています。
powershell.HostName target.hostname 未加工ログの powershell.HostName フィールドから直接マッピングされます(存在する場合)。
powershell.Script Name target.process.file.full_path 未加工ログの powershell.Script Name フィールドから直接マッピングされます(存在する場合)。
powershell.ScriptName target.process.file.full_path 未加工ログの powershell.ScriptName フィールドから直接マッピングされます(存在する場合)。
powershell.Sequence Number security_result.detection_fields[2].value 未加工ログの powershell.Sequence Number フィールドから直接マッピングされます(存在する場合)。
powershell.SequenceNumber security_result.detection_fields[0].value 未加工ログの powershell.SequenceNumber フィールドから直接マッピングされます(存在する場合)。
powershell.UserId principal.user.userid 未加工ログの powershell.UserId フィールドから直接マッピングされます(存在する場合)。
プロセス ID principal.process.pid ExecutionProcessIDProcessID が存在しない場合、または空または 0 の場合、未加工ログの Process ID フィールドから直接マッピングされます。文字列に変換されます。
ProcessID principal.process.pid ExecutionProcessID が存在しない場合、空の場合、または 0 の場合、未加工ログの ProcessID フィールドから直接マッピングされます。文字列に変換されます。
ProviderGuid metadata.product_deployment_id 未加工ログの ProviderGuid フィールドから直接マッピングされます。中かっこが削除されます。
PSEdition IDM オブジェクトにはマッピングされません。
PSRemotingProtocolVersion IDM オブジェクトにはマッピングされません。
PSVersion IDM オブジェクトにはマッピングされません。
RecordNumber metadata.product_log_id 未加工ログの RecordNumber フィールドから直接マッピングされます。文字列に変換されます。
RenderedDescription security_result.description 未加工ログの RenderedDescription フィールドから直接マッピングされます(存在する場合)。
RunAs ユーザー IDM オブジェクトにはマッピングされません。
ScriptBlockId IDM オブジェクトにはマッピングされません。
ScriptBlockText security_result.detection_fields[0].value 未加工ログの ScriptBlockText フィールドから直接マッピングされます(存在する場合)。
ScriptBlock ID IDM オブジェクトにはマッピングされません。
重大度 security_result.severity、security_result.severity_details Severity の値に基づいてマッピングされます。
- verbose または infoLOW にマッピングされます。
- warn または errMEDIUM にマッピングされます。
- critHIGH にマッピングされます。
未加工値も security_result.severity_details にマッピングされます。
source.collector_id IDM オブジェクトにはマッピングされません。
source.customer_id IDM オブジェクトにはマッピングされません。
ソース additional.fields[1].value.string_value 未加工ログの Source フィールドから直接マッピングされます(存在する場合)。
SourceModuleName principal.resource.name 未加工ログの SourceModuleName フィールドから直接マッピングされます。
SourceModuleType principal.resource.resource_subtype 未加工ログの SourceModuleType フィールドから直接マッピングされます。
SourceName metadata.product_name 未加工ログの SourceName フィールドから直接マッピングされます。
start_time.nanos IDM オブジェクトにはマッピングされません。
start_time.seconds IDM オブジェクトにはマッピングされません。
TenantId additional.fields[2].value.string_value 未加工ログの TenantId フィールドから直接マッピングされます(存在する場合)。
ThreadID IDM オブジェクトにはマッピングされません。
timestamp.nanos IDM オブジェクトにはマッピングされません。
timestamp.seconds IDM オブジェクトにはマッピングされません。
type IDM オブジェクトにはマッピングされません。
UserID principal.user.windows_sid 未加工ログの UserID フィールドから直接マッピングされます。
ユーザー名 principal.user.userid AccountName が存在しない場合、未加工ログの Username フィールドから直接マッピングされます。
metadata.vendor_name Microsoft に設定します。
metadata.event_type EventID4104 で、_PathMessage に存在する場合、または EventID4103 の場合、または EventID が [800600400] にあり、powershell.ScriptNamepowershell.HostApplication が存在する場合は、PROCESS_LAUNCH に設定します。EventID403 で、_HostApplicationMessage に存在する場合、または EventID403NewEngineStateStopped の場合、PROCESS_TERMINATION に設定します。EventID4104 で、Message_Path が存在しない場合、または EventID4103 で、no_valuescript_name が空で、script_name_not_foundhost_application_not_found がすべて true の場合、または EventID53504 の場合、または EventID40962 の場合、または EventID40961 の場合、または EventID が空で MessageSourceAddress が存在する場合は、STATUS_UPDATE に設定します。EventID が空で Username が存在する場合は、USER_UNCATEGORIZED に設定します。EventID が空で、MessageSourceAddressUsername が存在しない場合は GENERIC_EVENT に設定します。
metadata.product_name SourceName が存在しない場合、Powershell に設定します。
security_result.action ALLOW に設定します。
security_result.detection_fields[0].key Activity ID に設定します。
security_result.detection_fields[1].key Sequence Number に設定します。
security_result.detection_fields[2].key ExecutionThreadID に設定します。
additional.fields[0].key Management Group Name に設定します。
additional.fields[1].key Source に設定します。
additional.fields[2].key TenantId に設定します。
principal.asset.platform_software.platform platform_softwarewin が含まれている場合は WINDOWSmac が含まれている場合は MAClin が含まれている場合は LINUX、それ以外の場合は UNKNOWN_PLATFORM に設定します。
target.process.file.full_path EventID4104 で、_PathMessage に存在する場合は、_Path に設定します。EventID4104 で、file_pathMessage に存在する場合は、file_path に設定します。EventID403 で、_HostApplicationMessage に存在する場合は、_HostApplication に設定します。

変更点

2025-01-29

機能強化:

  • ScriptBlockText のマッピングを security_result.detection_fields から target.process.command_line に変更しました。

2025-01-28

機能強化:

  • 新しい形式の JSON ログをサポートするために gsub を追加しました。

2025-01-09

機能強化:

  • Payloadsecurity_result.detection_fields にマッピングしました。
  • Script Nametarget.file.full_path にマッピングしました。

2024-11-28

機能強化:

  • SYSLOG ログの新しいパターンのサポートを追加しました。

2024-08-20

機能強化:

  • 余分な文字を削除して JSON ログを解析する gsub を追加しました。

2024-08-14

機能強化:

  • Versionmetadata.product_version にマッピングしました。
  • SystemTimemetadata.event_timestamp にマッピングしました。
  • channelkeywordsMessageNumberMessageTotalScriptBlockIdsecurity_result.detection_fields にマッピングしました。
  • Pathtarget.process.file.full_path にマッピングしました。

2024-07-24

機能強化:

  • JSON ログの新しいパターンに対応しました。

2024-07-20

機能強化:

  • HostApplicationprincipal.application にマッピングしました。
  • HostIdprincipal.resource.product_object_id にマッピングしました。
  • System.Computerprincipal.hostnameprincipal.asset.hostname にマッピングしました。
  • System.Versionmetadata.product_version にマッピングしました。
  • System.ProcessIDprincipal.process.pid にマッピングしました。
  • System.ProviderNameprincipal.resource.attribute.labels にマッピングしました。
  • HostVersionRunspaceIdPipelineIdEngineVersionDetailSequenceDetailTotalSequenceNumberScriptNameadditional.fields にマッピングしました。
  • System.EventRecordIDSystem.TaskSystem.KeywordsSystem.OpcodeSystem.ThreadIDsecurity.detection_fields にマッピングしました。

2023-12-05

機能強化:

  • 未解析の JSON ログのマッピングを追加しました。
  • Computerprincipal.hostname にマッピングしました。
  • EventLevelNamesecurity_result.severity にマッピングしました。
  • ManagementGroupNameSourceTenantIdadditional_fields にマッピングしました。
  • RenderedDescriptionsecurity_result.description にマッピングしました。
  • UserNameprincipal.user.userid にマッピングしました。

2023-09-14

機能強化:

  • 未解析の JSON ログのマッピングを追加しました。
  • 「winlog.activity_id」を「security_result.detection_fields」にマッピングしました。
  • 「winlog.api」を「additional.fields」にマッピングしました。
  • 「winlog.channel」、「winlog.process.thread.id」を「security_result.about.resource.attribute.labels」にマッピングしました。
  • 「winlog.computer_name」を「principal.hostname」にマッピングしました。
  • 「winlog.event_id」を「metadata.product_event_type」と「security_result.rule_name」にマッピングしました。
  • 「winlog.opcode」を「metadata.description」にマッピングしました。
  • 「winlog.process.pid」を「principal.process.pid」にマッピングしました。
  • 「winlog.provider_guid」を「metadata.product_deployment_id」にマッピングしました。
  • 「winlog.provider_name」を「metadata.product_name」にマッピングしました。
  • 「winlog.record_id」を「metadata.product_log_id」にマッピングしました。
  • 「winlog.user.domain」を「principal.administrative_domain」にマッピングしました。
  • 「winlog.user.identifier」を「principal.user.windows_sid」にマッピングしました。
  • 「winlog.user.name」を「principal.user.userid」にマッピングしました。

2023-07-05

機能強化:

  • 「EventID = 403」で、「HostApplication」の値が存在しない場合に「metadata.event_type」を「STATUS_UPDATE」にマッピングしました。
  • 「Path」が空の場合に、Grok パターンを使用してログから「target.file.full_path」の値を抽出しました。
  • gsub 関数を追加して「@timestamp」を「EventTime」に名前変更しました。

2022-11-09

機能強化:

  • フィールド「ProviderGuid」は「metadata.product_deployment_id」にマッピングされます。
  • フィールド「ExecutionProcessID」は「principal.process.pid」にマッピングされます。
  • フィールド「ProcessID」または「Process ID」は「principal.process.pid」にマッピングされます。
  • フィールド「SourceModuleType」は「principal.resource.resource_subtype」にマッピングされます。
  • フィールド「SourceModuleName」は「principal.resource.name」にマッピングされます。
  • フィールド「Machine」は「principal.asset.asset_id」にマッピングされます。
  • フィールド「MessageSourceAddress」は「principal.ip」にマッピングされます。
  • フィールド「File」は「target.process.file.full_path」にマッピングされます。
  • フィールド「Host Application」または「Command」は「target.process.command_line」にマッピングされます。
  • フィールド「Output」は「security_result.detection_fields」にマッピングされます。
  • フィールド「Message」は「security_result.description」にマッピングされます。
  • フィールド「ActivityID」は「security_result.detection_fields」にマッピングされます。
  • EventID が「4103」の場合に次のマッピングを追加しました
  • フィールド「Host ID」または「ContextInfo_Host ID」は「target.asset.asset_id」にマッピングされます。
  • フィールド「Host Name」または「ContextInfo_Host Name」は「target.hostname」にマッピングされます。
  • フィールド「ContextInfo_Script Name」は「target.process.file.full_path」にマッピングされます。
  • フィールド「ContextInfo_Host Application」は「target.process.command_line」にマッピングされます。
  • フィールド「ContextInfo_Command Name」は「security_result.detection_fields」にマッピングされます。
  • フィールド「ContextInfo_Command Type」は「security_result.detection_fields」にマッピングされます。
  • フィールド「ContextInfo_Sequence Number」または「Sequence Number」は「security_result.detection_fields」にマッピングされます。
  • EventID が「800」、「600」、「400」の場合に次のマッピングを追加しました
  • フィールド「UserId」は「principal.user.userid」にマッピングされます。
  • フィールド「HostApplication」は「target.process.command_line」にマッピングされます。
  • フィールド「HostId」は「target.asset.asset_id」にマッピングされます。
  • フィールド「HostName」は「target.hostname」にマッピングされます。
  • フィールド「ScriptName」は「target.process.file.full_path」にマッピングされます。
  • フィールド「SequenceNumber」は「security_result.detection_fields」にマッピングされます。

2022-10-13

バグの修正:

  • 以下の変更を行い、失敗したログを解析しました。
  • 値がない場合、解析に失敗したフィールドに対する on_error チェックを追加しました。「opcode」、「Host Application」などのフィールド。
  • 「Message」がログに存在しない場合に、KV 解析用の新しいソース「ContextInfo」を追加しました。
  • 機能拡張
  • event_type を GENERIC_EVENT から STATUS_UPDATE に変更しました。

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