今週のプレイブック: Cortex XSOARでChatGPTを使う方法

Jun 01, 2023
2 minutes
... views

皆さんはすでにChatGPTを使ってスクリプトを書いたり、画像を生成したりしたことがあるかもしれません。Cortex XSOARにChatGPTインテグレーションが加わったことは既報のとおりなのですが、そうなると「これをどうセキュリティ オペレーション(SecOps)に活かせばインシデント レスポンスを効率化できるのか」が気になるところではないでしょうか。

取り急ぎ概要を知りたい方へ: CortexのポートフォリオにAIを組み込んで最新の自律型SOCを作る方法はCortex XSIAM Solution Brief (日本語版)から確認できます。

本稿では以下のように、XSOARのプレイブック内でChatGPTを使ってユーザーフレンドリーに情報配信をはじめる方法の例をご紹介します。

  • インシデントの分析結果をセキュリティ アナリストが読みやすい自然言語で提供
  • 分析、影響、勧告に関する情報を提供しインシデント チケットへのレスポンスを改善
  • MSSPの場合は人間が書いたような説明や分析を提供。人間をはるかにしのぐスピードで応答することでChatGPTはわかりやすさと高いユーザー満足度を実現

プレイブックの解説に入る前に、ChatGPTがアラートを取り込み、定形フォーマットに従い、よりリッチなコンテキストを追加した上で、インシデントの詳細を書き換えてくれるようすを見てみましょう。

ChatGPTへのリクエスト

今回のリクエストとプレイブックではGPT-3.5を使っています。

ChatGPTのレスポンス

分析

影響分析

アクション/勧告

たいしたものですよね。

ということで、これを自動化されたプレイブック連携させてみましょう。このプレイブックは標準的なチケット テンプレートで作成されており、以下の内容をカバーしています。

  • 詳細(分析)
  • 影響
  • アクション/勧告

別の出力条件を与えてやれば、ChatGPTのレスポンスは微調整可能です。クイック ヒント: 条件を箇条書きにしておけばChatGPTはそれに合わせたフォーマットにしてくれます。注: ChatGPTを使ってデータを提示するさいは、自社のデータ分類ポリシーに従うことをお勧めします。

ChatGPTインテグレーションをプレイブックで利用する方法

弊社は以下のインテグレーション(OpenAi ChatGPT v3)を使う予定です。

https://xsoar.pan.dev/docs/reference/integrations/open-ai-chat-gpt-v3

OpenAI APIキーを生成する

注: OpenAI APIの利用には無料の試用終了後に従量課金(pay-as-you-go)のサブスクリプションが必要です。

  1. 以下のリンクからご自身のOpenAIアカウントにログインしてください。

https://platform.openai.com/docs/introduction

  1. 右上のプロフィールをクリックし、メニューから[View API keys (APIキーを表示)]をクリックします。

APIキーのメニュー
APIキーのメニュー

  1. [Generate new secret key (新しい秘密鍵を生成する)]をクリックします。

Creating new secret key
新しい秘密鍵を生成

新しい秘密鍵を追加するには、[Create new secret key (新しい秘密鍵を生成)]をクリックします。

新しい秘密鍵を生成するウィンドウ
[Create new secret key (新しい秘密鍵を生成する)]ウィンドウ

新しい秘密鍵をコピーしてください。警告: 新しい秘密鍵にアクセスできなくなるのでコピーしてからウィンドウを閉じるようにしてください。

[Create new secret key (新しい秘密鍵を生成する)]ウィンドウの2つめのウィンドウ
[Create new secret key (新しい秘密鍵を生成する)]ウィンドウの2つめのウィンドウ

OpenAI ChatGPT v3 インスタンスの設定

  1. Cortex Marketplaceからコンテンツ パックをダウンロードします。
  2. インスタンスを追加します。

インスタンスの追加
インスタンスの追加

  1. コピーした秘密鍵を貼り付け、[Save & exit (保存して終了)]をクリックします。

インスタンスを保存
インスタンスの保存

ユース ケース

これでChatGPTインテグレーションのインスタンス設定は終了です。さっそくプレイブックで使ってみましょう。自動化のユース ケースに合わせて、必要に応じてプレイブック タスクを変更できます。

インシデント エンリッチメント

エンリッチメントは2段階に分けて行います。

  • インジケーター抽出: ログなどの詳細を取得し、お使いのSIEMソリューションからアーティファクトを抽出します。
  • インジケーター エンリッチメント: Unit42の脅威インテリジェンスやVirusTotalなどの脅威インテリジェンスのフィードを使い、抽出したインジケーターのエンリッチメントを行います。

プレイブック内のインジケーター エンリッチメント タスク
プレイブック内のインジケーター エンリッチメント タスク

インシデント分析

インシデント分析のため、以下のように以前のタスクで収集したすべてのデータをChatGPTに送信し、インシデントの深刻度を判定します。

プレイブックのChatGPT分析セクション
プレイブックのChatGPT分析セクション

ChatGPTのタスクの設定

前述のとおり、ChatGPTにはご自身でプロンプトを設定できますが、最適な出力結果を得るためのヒントを以下にいくつかご紹介します。

  • 簡潔に書く
  • 出力表示についての具体的に指示する
  • 出力条件を箇条書きで与える
  • データ パラメーターを追加する(例えばタイトルや侵害されたマシンのホスト名など)

プレイブック内のChatGPTプロンプトの出力結果
プレイブック内のChatGPTプロンプトの出力結果

ChatGPTのプロンプト

ご自身の入力パラメーターでタスクを設定すると、ChatGPTのWeb版の出力内容とよく似た内容になるはずです。

ChatGPTからのレスポンスの出力

API連携でChatGPTと通信する場合はトークンの利用数を監視することが重要です。OpenAIはお客様のAPIコール(プロンプト+回答)で使用されたトークンの総数にもとづいてAPI利用料を計算します。

OpenAIはOpenAIトークンの定義とカウント方法についての詳細情報を提供しています。

インシデント ウォールームでのChatGPTのレスポンス情報
インシデント ウォールームでのChatGPTのレスポンス情報

インシデント レスポンス

このフェーズでは、悪意のあるインジケーターはすべて、Cortex XDRないしファイアウォールでブロックされることになります。これはインジケーターのエンリッチメント段階で判定されたインジケーターのレピュテーション/スコア応じて決まります。

インシデントの深刻度にもとづくインシデント対応アクション
インシデントの深刻度にもとづくインシデント対応アクション

インシデントのクローズ

インシデント解決の一環として、ChatGPTのレスポンス詳細が記載されたメールがSOCアナリストに送信され、ServiceNowチケットが生成され、ChatGPTの出力をもとにしたクローズ メモで更新されます。

インシデントのクローズ アクション
インシデントのクローズ アクション

サンプル メール

これはXSOARからアナリストが受け取ったメールの例で、ChatGPTのレスポンスが出力されています。

サンプル メール
サンプル メール

備考:

私たちは、Cortex XSOARとの連携させるべく、多数のLLM (大規模言語モデル)に取り組んでいて、このChatGPTもそうしたLLMの1つです。ほかにGoogle Vertex AiなどのLLMとの連携に関するブログも予定しています。

さらに詳細を学ぶには

Cortex XSOARをまだお使いでない場合は、無料の Community版をいますぐダウンロードして、このプレイブックと何百もの自動化パックをお試しください。自動化パックは、セキュリティ オペレーションやSOCで皆さんが日常的に扱うよくあるユース ケースに対応しています。


Playbook of the Week: Using ChatGPT in Cortex XSOAR

May 18, 2023
5 minutes
... views

You might have used ChatGPT to help you write a script or generate an image. So now that you know Cortex XSOAR has a ChatGPT integration, are you wondering how you might apply it to your security operations to facilitate incident response? 

Quick Note: For more information on how we are incorporating AI across our Cortex portfolio to drive the autonomous modern SOC, please refer to the XSIAM Solution brief.  

Here’s an example of how you can start using ChatGPT within your XSOAR playbooks to deliver information in a user-friendly way:

  • Analysis of incidents delivered in readable, natural language to security analysts.
  • Improve incident ticket response with information on analysis, impact and recommendations.
  • For MSSPs, your clients will receive a description and analysis that looks like it was written by a human. That will help in clarity and better user satisfaction as ChatGPT can respond at a much higher speed than humans.

Before we dive into the playbook, let’s have a look at how ChatGPT rewrites the incident details from an ingested alert, adding richer context and in accordance with the format provided:

ChatGPT Request

We are using ChatGPT 3.5 in this request and the playbook.

ChatGPT Response

Analysis

Impact Analysis

Actions/Recommendations

Amazing, right?

Now it is time to integrate it into an automated playbook. This playbook is built using the standard ticketing template which covers:

  • Details (Analysis)
  • Impact
  • Actions/Recommendations

You can tweak the ChatGPT response by giving it a different set of output criteria. Quick tip: Put the criteria in bullet points so ChatGPT can format it accordingly. Note: When using ChatGPT for presenting data, we recommend following your organization’s data classification policies. 

How to Use the ChatGPT Integration in a Playbook

We will use the following integration (OpenAi ChatGPT v3)

https://xsoar.pan.dev/docs/reference/integrations/open-ai-chat-gpt-v3

Generate an OpenAI API key

Note: Using the OpenAI API requires a pay-as-you-go subscription after the free trial ends.

  1. Login to your OpenAI account using the following link:

https://platform.openai.com/docs/introduction

  1. Click on your profile from top right then View API Keys
Menu with API keys
Menu with API keys

 

  1. Click on Generate new secret key
Creating new secret key
Creating new secret key

 

To add a new secret key, press Create new secret key

Window to create new secret key
Window to create new secret key

 

Copy the new secret key before the pop-up is closed as it will not be accessible once you close the window.

Next window to create new secret key
Next window to create new secret key

 

Configure OpenAI ChatGPT v3 Instance

  1. Download the content pack from the Cortex Marketplace
  2. Add an Instance
Adding an Instance
Adding an Instance

 

  1. Paste the copied secret key Then press Save & exit
Saving the instance
Saving the instance

 

Use Case

Now that we have configured your ChatGPT integration instance, we can use it in a playbook. You can modify the playbook tasks as needed to suit your automation use cases.

Incident Enrichment

The enrichment is done in two separate phases:

  • Indicator extraction: Get more details like logs and extract artifacts from your SIEM solution.
  • Indicator enrichment: Enrich the extracted indicators using your threat intel feed such as Unit42 Intel or VirusTotal.
Indicator enrichment tasks in playbook
Indicator enrichment tasks in playbook

 

Incident Analysis

For incident analysis, you will send to ChatGPT all collected data from previous tasks as follows to determine severity of the incident:

ChatGPT analysis section of playbook
ChatGPT analysis section of playbook

 

ChatGPT Task Configuration

As we mentioned earlier, you can configure your prompts to ChatGPT but here are some tips for optimum output results:

  • Make it short
  • Provide specific instructions for your output display
  • Provide output criteria in bulleted format
  • Add your data parameters (e.g. title or hostname of compromised machine)
ChatGPT prompt output in playbook
ChatGPT prompt output in playbook

 

ChatGPT Prompt

As you configured the task with your input parameters, it should look very similar to the ChatGPT web output.

ChatGPT Response Output

It is important to monitor how many tokens are being used to communicate with ChatGPT via the API integration. OpenAI calculates the cost of API usage based on the total number of tokens used in your API calls (prompt + answer).

OpenAI provides more details about how they define and count OpenAI tokens.

ChatGPT response information in incident War Room
ChatGPT response information in incident War Room

 

Incident Response

In this phase, any malicious indicators will be blocked on Cortex XDR or the firewall. This is decided based on the indicator's reputation/score as determined during the indicator's enrichment phase.

Incident response actions based on incident severity
Incident response actions based on incident severity

Incident Closure

As part of incident resolution, an email with ChatGPT response details is sent to the SOC analyst, a ServiceNow ticket is generated and updated with the closure notes from the ChatGPT output.

Incident closure actions
Incident closure actions

 

Sample Email

This is an example of the email received by the analyst from XSOAR with the ChatGPT response output.

Sample email
Sample email

 

Note:

ChatGPT is one of the many LLMs (large language models) we are working to integrate into Cortex XSOAR.  Stay posted for upcoming blogs on other LLM integrations such as Google Vertex Ai.

 

Learn More

To learn more about how you can automate security operations with Cortex XSOAR, check out our virtual self-guided XSOAR Product Tour

We also host virtual and in-person events, so check here for upcoming ones.

 


Subscribe to the Newsletter!

Sign up to receive must-read articles, Playbooks of the Week, new feature announcements, and more.