mcpField
P
performing-cloud-native-threat-hunting-with-aws-detective

performing-cloud-native-threat-hunting-with-aws-detective

github.com/mukul975セキュリティ35.2k60 回インストール8 週間前に更新
リポジトリ

performing-cloud-native-threat-hunting-with-aws-detective について

AWS のセキュリティ分析担当者向けのクラウドネイティブ脅威ハンティングスキルです。AWS Detective のビヘイビアグラフと調査機能を使い、エンティティの活動、異常な API 呼び出し、関連する検出結果を調べます。

主な機能

  1. 01利用可能なビヘイビアグラフの一覧表示
  2. 02IAM ユーザーなどのエンティティ調査
  3. 03AWS CLI と boto3 によるエンティティ検索
  4. 04関連付けられた GuardDuty 検出結果の分析
  5. 05調査インジケーターの確認

活用シーン

  1. 01不審な IAM ユーザーやロールの活動調査
  2. 02高重要度の調査と攻撃関連性の確認
  3. 03Detective の結果と CloudTrail ログの照合

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill performing-cloud-native-threat-hunting-with-aws-detective

インストール後、Claude Code で/performing-cloud-native-threat-hunting-with-aws-detectiveを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

assets/
template.md
references/
api-reference.md
standards.md
workflows.md
scripts/
process.py

詳細

AWS Detective を使用したクラウドネイティブな脅威ハンティング

概要

AWS Detective は、AWS CloudTrail、VPC Flow Logs、GuardDuty の検出結果、EKS 監査ログからログデータを自動的に収集・分析し、インタラクティブな行動グラフを構築します。これらのグラフを使うことで、セキュリティアナリストはエンティティ(IAM ユーザー、ロール、IP アドレス、EC2 インスタンス)を時間軸に沿って調査し、異常な API 呼び出しを特定し、アカウント間のラテラルムーブメントを検出し、GuardDuty の検出結果を関連付けて一貫性のある攻撃シナリオを構築できます。ログを手動で解析する必要はありません。

前提条件

  • Detective が有効になっている AWS アカウント(GuardDuty が 48 時間以上アクティブである必要があります)
  • 適切な IAM 権限(detective:*、guardduty:List*)を設定した AWS CLI v2
  • boto3 を使用できる Python 3.9 以降
  • IAM ポリシー:AmazonDetectiveFullAccess、または detective:SearchGraph、detective:GetInvestigation、detective:ListIndicators を含むカスタムポリシー

主な概念

概念説明
行動グラフアカウント/リージョンの CloudTrail、VPC Flow、GuardDuty、EKS のログをつなぐデータ構造
エンティティ調査対象となるオブジェクト:IAM ユーザー、IAM ロール、EC2 インスタンス、IP アドレス、S3 バケット、EKS クラスター
検出結果グループ同じ攻撃キャンペーンに関連付けられた、相関性のある GuardDuty 検出結果の集合
エンティティプロファイル特定のエンティティに関する API 呼び出し、ネットワーク接続、リソースアクセスのタイムライン
スコープ時間行動分析に使用する調査期間(デフォルトは 24 時間、最長 1 年)

手順

ステップ 1:利用可能な行動グラフを一覧表示する
aws detective list-graphs --output table
ステップ 2:不審な IAM ユーザーを調査する
# Get entity profile for an IAM user
aws detective get-investigation \
  --graph-arn arn:aws:detective:us-east-1:123456789012:graph:a1b2c3d4 \
  --investigation-id 000000000000000000001
ステップ 3:プログラムからエンティティを検索する
#!/usr/bin/env python3
"""Search AWS Detective for suspicious entities."""
import boto3
import json
from datetime import datetime, timedelta

detective = boto3.client('detective')

def list_behavior_graphs():
    """List all Detective behavior graphs."""
    response = detective.list_graphs()
    return response.get('GraphList', [])

def get_investigation_indicators(graph_arn, investigation_id, max_results=50):
    """Get indicators for a specific investigation."""
    response = detective.list_indicators(
        GraphArn=graph_arn,
        InvestigationId=investigation_id,
        MaxResults=max_results
    )
    return response.get('Indicators', [])

def investigate_guardduty_findings(graph_arn):
    """List high-severity investigations correlated by Detective."""
    response = detective.list_investigations(
        GraphArn=graph_arn,
        FilterCriteria={
            'Severity': {'Value': 'CRITICAL'},
            'Status': {'Value': 'RUNNING'}
        },
        MaxResults=20
    )

    for investigation in response.get('InvestigationDetails', []):
        print(f"Investigation: {investigation['InvestigationId']}")
        print(f"  Entity: {investigation['EntityArn']}")
        print(f"  Status: {investigation['Status']}")
        print(f"  Severity: {investigation['Severity']}")
        print(f"  Created: {investigation['CreatedTime']}")
        print()

if __name__ == "__main__":
    graphs = list_behavior_graphs()
    for graph in graphs:
        print(f"Graph: {graph['Arn']}")
        investigate_guardduty_findings(graph['Arn'])
ステップ 4:検出結果グループを分析して攻撃キャンペーンを調査する
# List investigations with high severity
aws detective list-investigations \
  --graph-arn arn:aws:detective:us-east-1:123456789012:graph:a1b2c3d4 \
  --filter-criteria '{"Severity":{"Value":"HIGH"}}' \
  --max-results 10
ステップ 5:エンティティのインジケーターを確認する
# Get indicators for a specific investigation
aws detective list-indicators \
  --graph-arn arn:aws:detective:us-east-1:123456789012:graph:a1b2c3d4 \
  --investigation-id 000000000000000000001 \
  --max-results 50

期待される出力

list-investigations コマンドは調査のメタデータを返します。

{
  "InvestigationDetails": [
    {
      "InvestigationId": "000000000000000000001",
      "Severity": "CRITICAL",
      "Status": "RUNNING",
      "State": "ACTIVE",
      "EntityArn": "arn:aws:iam::123456789012:user/suspicious-user",
      "EntityType": "IAM_USER",
      "CreatedTime": "2026-03-15T14:30:00Z"
    }
  ]
}

インジケーターは list-indicators で個別に取得します。TTP_OBSERVED、IMPOSSIBLE_TRAVEL、FLAGGED_IP_ADDRESS、NEW_GEOLOCATION、NEW_ASO、NEW_USER_AGENT、RELATED_FINDING、RELATED_FINDING_GROUP などの種類があります。

検証

  1. 行動グラフにデータがあることを確認します:aws detective list-graphs が空でないリストを返すこと
  2. 調査結果に API 呼び出しのシーケンスを含むエンティティのタイムラインが含まれていることを確認します
  3. Detective の検出結果を未加工の CloudTrail ログと照合し、正確性を確認します
  4. 検出結果グループの相関関係が手動での調査結果と一致することを確認します
  5. HIGH/CRITICAL の重大度の調査で自動アラートが発動することを確認します

コメント