mcpField
P
performing-ai-driven-osint-correlation

performing-ai-driven-osint-correlation

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

performing-ai-driven-osint-correlation について

複数ソースのOSINTを相関させる、セキュリティ調査向けワークフロースキルです。情報を正規化し、LLMで横断分析と信頼度評価を行い、構造化レポートとエンティティ間の関連を作成します。

主な機能

  1. 01複数ソースからのOSINT収集
  2. 02共通スキーマへの情報の正規化
  3. 03LLMによる相関分析と信頼度評価
  4. 04エンティティ解決とリンク分析
  5. 05JSONおよびMarkdownレポートの生成

活用シーン

  1. 01断片的な公開情報からプロフィールを作成
  2. 02組織の外部公開状況を把握
  3. 03脅威アクターと疑われる人物を調査
  4. 04ブランドを装うアカウントを検出

インストール

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

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill performing-ai-driven-osint-correlation

インストール後、Claude Code で/performing-ai-driven-osint-correlationを入力して読み込まれたか確認します。

同梱ファイル

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

LICENSE
references/
api-reference.md
scripts/
agent.py

詳細

AI 駆動による OSINT 相関分析の実施

使用するタイミング

  • 複数のツールやソースから生の OSINT データを収集済みで、それらの間にある関連性、矛盾、パターンを特定する必要がある場合。
  • 断片的なデータから、対象のエンティティ(個人、組織、またはインフラストラクチャ)について統合されたインテリジェンスプロファイルを構築する必要がある場合。
  • 収集したデータ量に対して、従来の手動による相関分析では遅すぎる、またはミスが発生しやすい場合。
  • 単純なキーワードマッチングではなく、プラットフォーム横断のアイデンティティ紐付けについて、信頼度スコア付きの評価を得たい場合。

前提条件

  • requests、json、csv ライブラリを備えた Python 3.10 以上
  • Sherlock のインストール(pip install sherlock-project)
  • theHarvester のインストール(pip install theHarvester)
  • localhost:5001 で稼働している SpiderFoot 4.0 以上
  • LLM API へのアクセス(OpenAI、Anthropic、または Ollama 経由のローカルモデル)
  • 任意:相関分析結果のグラフ可視化用の Maltego CE
  • 任意:Shodan、VirusTotal、HaveIBeenPwned、Hunter.io の API キー

ワークフロー

法的および倫理的要件
  • 調査を開始する前に、文書化された書面による許可を取得すること
  • データ処理の適法な根拠を確立すること(法執行機関、企業ポリシーなど)
  • PII の保持期間の上限と、データの取り扱い手順を定めること
  • 各地域のプライバシー規制(GDPR、CCPA など)を遵守すること
フェーズ 1 — マルチソース OSINT 収集
  1. すべての OSINT 出力用の作業ディレクトリを作成します:

    mkdir -p /tmp/osint
    
  2. Sherlock を使用して、複数のプラットフォームにまたがるユーザー名を列挙します:

    sherlock "targetusername" --output /tmp/osint/sherlock-results.txt --csv
    
  3. theHarvester を使用して、メールアドレス、サブドメイン、ホストを収集します:

    theHarvester -d targetdomain.com -b all -f /tmp/osint/harvester-results.json
    
  4. REST API 経由で SpiderFoot のパッシブスキャンを実行します:

    curl -s http://localhost:5001/api/scan/start \
      -d "scanname=target-recon&scantarget=targetdomain.com&usecase=passive" \
      | jq '.scanid'
    
  5. スキャン完了後に SpiderFoot の結果をエクスポートします:

    SCAN_ID="<scanid_from_step_3>"
    curl -s "http://localhost:5001/api/scan/${SCAN_ID}/results?type=all" \
      -o /tmp/osint/spiderfoot-results.json
    
  6. メールアドレスの漏えいについて侵害データベースを照会します(HIBP API の例):

    curl -s -H "hibp-api-key: ${HIBP_KEY}" \
      -H "User-Agent: OSINT-Correlation-Skill" \
      "https://haveibeenpwned.com/api/v3/breachedaccount/[email protected]" \
      -o /tmp/osint/breach-results.json
    
フェーズ 2 — データの正規化
  1. 収集したすべてのデータを共通スキーマに正規化します。 各検出結果にソース、タイムスタンプ、データ型をタグ付けした統合 JSON 構造を作成します:

    cat > /tmp/osint/normalize.py << 'EOF'
    import json, csv, sys, os
    from datetime import datetime
    
    findings = []
    
    # Normalize Sherlock CSV results
    sherlock_path = "/tmp/osint/sherlock-results.txt"
    if os.path.exists(sherlock_path):
        with open(sherlock_path) as f:
            for row in csv.DictReader(f):
                findings.append({
                    "source": "sherlock",
                    "type": "social_profile",
                    "platform": row.get("name", ""),
                    "url": row.get("url_user", ""),
                    "username": row.get("username", ""),
                    "status": row.get("status", ""),
                    "collected_at": datetime.utcnow().isoformat()
                })
    
    # Normalize theHarvester JSON results
    harvester_path = "/tmp/osint/harvester-results.json"
    if os.path.exists(harvester_path):
        with open(harvester_path) as f:
            data = json.load(f)
            for email in data.get("emails", []):
                findings.append({
                    "source": "theHarvester",
                    "type": "email",
                    "value": email,
                    "collected_at": datetime.utcnow().isoformat()
                })
            for host in data.get("hosts", []):
                findings.append({
                    "source": "theHarvester",
                    "type": "hostname",
                    "value": host,
                    "collected_at": datetime.utcnow().isoformat()
                })
    
    # Normalize SpiderFoot results
    sf_path = "/tmp/osint/spiderfoot-results.json"
    if os.path.exists(sf_path):
        with open(sf_path) as f:
            for item in json.load(f):
                findings.append({
                    "source": "spiderfoot",
                    "type": item.get("type", "unknown"),
                    "value": item.get("data", ""),
                    "module": item.get("module", ""),
                    "collected_at": datetime.utcnow().isoformat()
                })
    
    with open("/tmp/osint/normalized-findings.json", "w") as f:
        json.dump(findings, f, indent=2)
    
    print(f"Normalized {len(findings)} findings from {len(set(f['source'] for f in findings))} sources")
    EOF
    python3 /tmp/osint/normalize.py
    
フェーズ 3 — AI 駆動の相関分析
  1. 正規化された検出結果を LLM に送信し、ソース横断の相関分析を行います:

    cat > /tmp/osint/correlate.py << 'PYEOF'
    import json, os
    from openai import OpenAI  # or anthropic, ollama, etc.
    
    client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
    
    with open("/tmp/osint/normalized-findings.json") as f:
        findings = json.load(f)
    
    correlation_prompt = f"""You are an OSINT analyst. Analyze these findings collected
    from multiple sources and produce a correlation report.
    
    For each identity or entity you detect:
    1. List all linked accounts/profiles with the evidence connecting them.
    2. Assign a confidence score (0.0-1.0) for each linkage based on:
       - Exact username match across platforms (high)
       - Similar usernames with shared metadata (medium)
       - Same email in breach data and registration (high)
       - Co-occurring infrastructure (IP, domain) (medium)
       - Temporal correlation of account creation dates (low-medium)
    3. Identify contradictions or potential false positives.
    4. Flag high-risk exposures (breached credentials, PII leaks, infrastructure overlaps).
    5. Produce a structured JSON report.
    
    Raw findings:
    {json.dumps(findings[:500], indent=2)}
    """
    
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {"role": "system", "content": "You are an expert OSINT analyst specializing in identity correlation and link analysis."},
            {"role": "user", "content": correlation_prompt}
        ],
        temperature=0.1,
        response_format={"type": "json_object"}
    )
    
    report = json.loads(response.choices[0].message.content)
    
    with open("/tmp/osint/correlation-report.json", "w") as f:
        json.dump(report, f, indent=2)
    
    print(json.dumps(report, indent=2))
    PYEOF
    python3 /tmp/osint/correlate.py
    
  2. エンティティ解決を実行します。関連するアイデンティティを重複排除し、統合します:

    cat > /tmp/osint/resolve.py << 'PYEOF'
    import json
    
    with open("/tmp/osint/correlation-report.json") as f:
        report = json.load(f)
    
    # Extract entities and build a link graph
    entities = report.get("entities", [])
    print(f"Identified {len(entities)} distinct entities")
    for entity in entities:
        name = entity.get("identifier", "unknown")
        confidence = entity.get("confidence", 0)
        links = entity.get("linked_accounts", [])
        risk = entity.get("risk_level", "unknown")
        print(f"  [{confidence:.0%}] {name} — {len(links)} linked accounts — risk: {risk}")
    PYEOF
    python3 /tmp/osint/resolve.py
    
フェーズ 4 — レポート作成と可視化
  1. Markdown で最終的なインテリジェンスプロファイルを生成します:

    cat > /tmp/osint/report.py << 'PYEOF'
    import json
    from datetime import datetime
    
    with open("/tmp/osint/correlation-report.json") as f:
        report = json.load(f)
    
    md = f"# OSINT Correlation Report\n\n"
    md += f"**Generated:** {datetime.utcnow().isoformat()}Z\n\n"
    md += "## Entity Profiles\n\n"
    
    for entity in report.get("entities", []):
        eid = entity.get("identifier", "Unknown")
        conf = entity.get("confidence", 0)
        md += f"### {eid} (Confidence: {conf:.0%})\n\n"
        md += "| Source | Platform | Evidence |\n|--------|----------|----------|\n"
        for link in entity.get("linked_accounts", []):
            md += f"| {link.get('source','')} | {link.get('platform','')} | {link.get('evidence','')} |\n"
        md += f"\n**Risk Level:** {entity.get('risk_level', 'N/A')}\n\n"
        for flag in entity.get("flags", []):
            md += f"- ⚠️ {flag}\n"
        md += "\n"
    
    with open("/tmp/osint/intelligence-profile.md", "w") as f:
        f.write(md)
    
    print("Report written to /tmp/osint/intelligence-profile.md")
    PYEOF
    python3 /tmp/osint/report.py
    
  2. 任意 — 相関分析グラフを可視化のため Maltego にインポートします:

    # Export entities as Maltego-compatible CSV for manual import
    cat > /tmp/osint/maltego_export.py << 'PYEOF'
    import json, csv
    
    with open("/tmp/osint/correlation-report.json") as f:
        report = json.load(f)
    
    with open("/tmp/osint/maltego-import.csv", "w", newline="") as f:
        writer = csv.writer(f)
        writer.writerow(["Entity Type", "Value", "Linked To", "Link Label", "Confidence"])
        for entity in report.get("entities", []):
            for link in entity.get("linked_accounts", []):
                writer.writerow([
                    link.get("type", "Alias"),
                    link.get("value", ""),
                    entity.get("identifier", ""),
                    link.get("evidence", ""),
                    link.get("confidence", "")
                ])
    
    print("Maltego CSV exported to /tmp/osint/maltego_export.py")
    PYEOF
    python3 /tmp/osint/maltego_export.py
    

主な概念

概念説明
情報源をまたいだ相関分析独立した OSINT 情報源間で識別子(ユーザー名、メールアドレス、IP アドレス)を照合し、エンティティ間の関連性を確立します
信頼度スコアリング証拠の強さと裏付けに基づき、関連性ごとに確率的な信頼度(0.0~1.0)を割り当てます
エンティティ解決分散したデータセット間で、同一の実在エンティティを指すレコードを重複排除して統合します
誤検知の検出AI による推論を用いて、偶然の一致と実際の身元の関連性を見分けます
マルチベクトルインテリジェンスソーシャルメディア、DNS、侵害データ、インフラストラクチャから得た調査結果を組み合わせ、脅威の全体像を把握します
リンク分析エンティティ、アカウント、インフラストラクチャ間の関係をグラフベースで調査します

ツールとシステム

ツールワークフローでの役割
Sherlock400 以上のソーシャルプラットフォームでユーザー名を列挙します
theHarvester公開情報源からメールアドレス、サブドメイン、ホストを検出します
SpiderFoot200 以上のモジュールを利用して OSINT を自動収集します
Maltegoエンティティ間の関係をグラフで可視化します
LLM API(GPT-4、Claude、Ollama)情報源をまたいだ推論、パターン検出、信頼度スコアリングを行います
HaveIBeenPwned侵害による情報漏えいや認証情報の流出を検出します

よくあるシナリオ

  • 脅威アクターの帰属特定: フィッシングキャンペーンで見つかった不審なユーザー名を、ソーシャルメディアのプロフィール、ドメイン登録情報、侵害データと相関分析し、帰属特定プロファイルを作成します。
  • 攻撃対象領域のマッピング: 検出されたサブドメイン、メールアドレス、従業員のソーシャルアカウントを関連付け、組織の外部にさらされている範囲を把握します。
  • 内部脅威の調査: 従業員の既知のアカウントを、ダークウェブのマーケットプレイスでの活動や侵害データベースと照合します。
  • ブランドなりすましの検出: 登録パターン、命名規則、時間的な兆候を相関分析し、対象ブランドになりすましたプラットフォーム上のアカウントを特定します。

出力形式

最終的な出力は、構造化された JSON 相関レポートと、以下を含む Markdown のインテリジェンスプロファイルです。

{
  "meta": {
    "target": "targetdomain.com",
    "sources_used": ["sherlock", "theHarvester", "spiderfoot", "hibp"],
    "total_findings": 247,
    "generated_at": "2025-01-15T14:30:00Z"
  },
  "entities": [
    {
      "identifier": "john.target",
      "confidence": 0.92,
      "linked_accounts": [
        {
          "source": "sherlock",
          "platform": "GitHub",
          "value": "john.target",
          "evidence": "Exact username match, bio references targetdomain.com",
          "confidence": 0.95
        }
      ],
      "risk_level": "high",
      "flags": [
        "Credentials exposed in 2 breaches (2022, 2023)",
        "Admin email for targetdomain.com found in public WHOIS"
      ]
    }
  ],
  "contradictions": [],
  "recommendations": []
}

検証

  • 信頼度を 0.8 超に設定する前に、関連付けられた各アカウントが少なくとも 2 つの情報源で独立して検証されていることを確認します。
  • AI が生成した相関分析の精度を検証するため、無作為に抽出したサンプル(10~20%)を手動で照合します。
  • 一般的なユーザー名(例:「admin」、「test」)による誤検知でエンティティプロファイルが水増しされていないことを確認します。
  • 侵害データのタイムスタンプが最新であり、信頼できる集約元のものであることを確認します。
  • 最終レポートに古い OSINT データや撤回済みの OSINT データが含まれていないことを確認します。

コメント