mcpField
A
analyzing-browser-forensics-with-hindsight

analyzing-browser-forensics-with-hindsight

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

analyzing-browser-forensics-with-hindsight について

調査担当者やインシデント対応者向けのブラウザフォレンジック手順です。Hindsight を使って Chrome など Chromium 系ブラウザのプロファイルを解析し、痕跡を時系列にまとめてウェブ活動を再構成します。

主な機能

  1. 01URL、ダウンロード、キャッシュの解析
  2. 02ブックマーク、自動入力、ログイン情報の抽出
  3. 03Cookie、ローカルストレージ、セッションの確認
  4. 04ブラウザー痕跡を関連付けたタイムライン作成
  5. 05XLSX、JSON、SQLite への出力

活用シーン

  1. 01インシデント時のウェブ活動の再構成
  2. 02内部脅威に関連するブラウザー痕跡の調査
  3. 03フォレンジックイメージ内のプロファイル解析
  4. 04インシデント対応向けブラウザー記録の整理

インストール

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

$npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill analyzing-browser-forensics-with-hindsight

インストール後、Claude Code で/analyzing-browser-forensics-with-hindsightを入力して読み込まれたか確認します。

同梱ファイル

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

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

詳細

Hindsight を使用したブラウザーフォレンジックの分析

概要

Hindsight は、Google Chrome およびその他の Chromium ベースのブラウザー(Microsoft Edge、Brave、Opera、Vivaldi)からアーティファクトを解析するために設計されたオープンソースのブラウザーフォレンジックツールです。複数のブラウザーデータベースファイルからデータを抽出して相関分析し、ウェブアクティビティの統合タイムラインを作成します。Hindsight は、URL、ダウンロード履歴、キャッシュレコード、ブックマーク、自動入力レコード、保存済みパスワード、設定、ブラウザー拡張機能、HTTP Cookie、Local Storage(HTML5 Cookie)、ログインデータ、セッション/タブ情報を解析できます。このツールは複数の出力形式(XLSX、JSON、SQLite)で時系列のタイムラインを生成し、インシデント対応、内部脅威調査、刑事事件において、調査担当者がユーザーのウェブアクティビティを再構成できるようにします。

使用する場面

  • Hindsight を使用したブラウザーフォレンジック分析が必要なセキュリティインシデントを調査する場合
  • この分野の検知ルールや脅威ハンティング用クエリを作成する場合
  • SOC アナリストがこの種の分析のための体系的な手順を必要とする場合
  • 関連する攻撃手法に対するセキュリティ監視の対象範囲を検証する場合

前提条件

  • Hindsight がインストールされた Python 3.8 以降(pip install pyhindsight)
  • フォレンジックイメージからブラウザープロファイルディレクトリにアクセスできること
  • ブラウザープロファイルデータ(OS レベルの暗号化が適用されていないもの)
  • 分析用の Timeline Explorer またはスプレッドシートアプリケーション

ブラウザープロファイルの場所

ブラウザーWindows のプロファイルパス
Chrome%LOCALAPPDATA%\Google\Chrome\User Data\Default\
Edge%LOCALAPPDATA%\Microsoft\Edge\User Data\Default\
Brave%LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data\Default\
Opera%APPDATA%\Opera Software\Opera Stable\
Vivaldi%LOCALAPPDATA%\Vivaldi\User Data\Default\
Chrome(macOS)~/Library/Application Support/Google/Chrome/Default/
Chrome(Linux)~/.config/google-chrome/Default/

主なアーティファクトファイル

ファイル内容
HistoryURL の閲覧履歴、ダウンロード、キーワード検索
Cookiesドメイン、有効期限、値を含む HTTP Cookie
Web Data自動入力エントリー、保存済みクレジットカード
Login Data保存済みユーザー名/パスワード(暗号化済み)
BookmarksJSON 形式のブックマークツリー
Preferencesブラウザー設定と拡張機能
Local Storage/ドメインごとの HTML5 Local Storage
Session Storage/ドメインごとのセッション固有のストレージ
Network Action Predictor以前に入力された URL
ShortcutsOmnibox のショートカットと予測
Top Sitesよくアクセスするサイト

Hindsight の実行

コマンドライン
# Basic analysis of a Chrome profile
hindsight.exe -i "C:\Evidence\Users\suspect\AppData\Local\Google\Chrome\User Data\Default" -o C:\Output\chrome_analysis

# Specify browser type
hindsight.exe -i "/path/to/profile" -o /output/analysis -b Chrome

# JSON output format
hindsight.exe -i "C:\Evidence\Chrome\Default" -o C:\Output\chrome --format jsonl

# With cache parsing (slower but more complete)
hindsight.exe -i "C:\Evidence\Chrome\Default" -o C:\Output\chrome --cache
ウェブ UI
# Start Hindsight web interface
hindsight_gui.exe
# Navigate to http://localhost:8080
# Upload or point to browser profile directory
# Configure output format and analysis options
# Generate and download report

アーティファクト分析の詳細

URL の履歴と閲覧記録
-- Chrome History database schema (key tables)
-- urls table: id, url, title, visit_count, typed_count, last_visit_time
-- visits table: id, url, visit_time, from_visit, transition, segment_id

-- Timestamps are Chrome/WebKit format: microseconds since 1601-01-01
-- Convert: datetime((visit_time/1000000)-11644473600, 'unixepoch')
ダウンロード履歴
-- downloads table: id, current_path, target_path, start_time, end_time,
--   received_bytes, total_bytes, state, danger_type, interrupt_reason,
--   url, referrer, tab_url, mime_type, original_mime_type
Cookie の分析
-- cookies table: creation_utc, host_key, name, value, encrypted_value,
--   path, expires_utc, is_secure, is_httponly, last_access_utc,
--   has_expires, is_persistent, priority, samesite

Python 分析スクリプト

import sqlite3
import os
import json
import sys
from datetime import datetime, timedelta


CHROME_EPOCH = datetime(1601, 1, 1)


def chrome_time_to_datetime(chrome_ts: int):
    """Convert Chrome timestamp to datetime."""
    if chrome_ts == 0:
        return None
    try:
        return CHROME_EPOCH + timedelta(microseconds=chrome_ts)
    except (OverflowError, OSError):
        return None


def analyze_chrome_history(profile_path: str, output_dir: str) -> dict:
    """Analyze Chrome History database for forensic evidence."""
    history_db = os.path.join(profile_path, "History")
    if not os.path.exists(history_db):
        return {"error": "History database not found"}

    os.makedirs(output_dir, exist_ok=True)
    conn = sqlite3.connect(f"file:{history_db}?mode=ro", uri=True)

    # URL visits with timestamps
    cursor = conn.cursor()
    cursor.execute("""
        SELECT u.url, u.title, v.visit_time, u.visit_count,
               v.transition & 0xFF as transition_type
        FROM visits v JOIN urls u ON v.url = u.id
        ORDER BY v.visit_time DESC LIMIT 5000
    """)
    visits = [{
        "url": r[0], "title": r[1],
        "visit_time": str(chrome_time_to_datetime(r[2])),
        "total_visits": r[3], "transition": r[4]
    } for r in cursor.fetchall()]

    # Downloads
    cursor.execute("""
        SELECT target_path, tab_url, start_time, end_time,
               received_bytes, total_bytes, mime_type, state
        FROM downloads ORDER BY start_time DESC LIMIT 1000
    """)
    downloads = [{
        "path": r[0], "source_url": r[1],
        "start_time": str(chrome_time_to_datetime(r[2])),
        "end_time": str(chrome_time_to_datetime(r[3])),
        "received_bytes": r[4], "total_bytes": r[5],
        "mime_type": r[6], "state": r[7]
    } for r in cursor.fetchall()]

    # Keyword searches
    cursor.execute("""
        SELECT k.term, u.url, k.url_id
        FROM keyword_search_terms k JOIN urls u ON k.url_id = u.id
        ORDER BY u.last_visit_time DESC LIMIT 1000
    """)
    searches = [{"term": r[0], "url": r[1]} for r in cursor.fetchall()]

    conn.close()

    report = {
        "analysis_timestamp": datetime.now().isoformat(),
        "profile_path": profile_path,
        "total_visits": len(visits),
        "total_downloads": len(downloads),
        "total_searches": len(searches),
        "visits": visits,
        "downloads": downloads,
        "searches": searches
    }

    report_path = os.path.join(output_dir, "browser_forensics.json")
    with open(report_path, "w") as f:
        json.dump(report, f, indent=2)

    return report


def main():
    if len(sys.argv) < 3:
        print("Usage: python process.py <chrome_profile_path> <output_dir>")
        sys.exit(1)
    analyze_chrome_history(sys.argv[1], sys.argv[2])


if __name__ == "__main__":
    main()

参考資料

出力例

$ python hindsight.py -i /evidence/chrome-profile -o /analysis/hindsight_output

Hindsight v2024.01 - Chrome/Chromium Browser Forensic Analysis
================================================================

Profile: /evidence/chrome-profile (Chrome 120.0.6099.130)
OS: Windows 10

[+] Parsing History database...
    URL records:          12,456
    Download records:     234
    Search terms:         567

[+] Parsing Cookies database...
    Cookie records:       8,923
    Encrypted cookies:    6,712

[+] Parsing Web Data (Autofill)...
    Autofill entries:     1,234
    Credit card entries:  2 (encrypted)

[+] Parsing Login Data...
    Saved credentials:    45 (encrypted)

[+] Parsing Bookmarks...
    Bookmark entries:     189

--- Browsing History (Last 10 Entries) ---
Timestamp (UTC)          | URL                                          | Title                        | Visit Count
2024-01-15 14:32:05.123  | https://mail.corporate.com/inbox             | Corporate Mail                | 45
2024-01-15 14:33:12.456  | https://drive.google.com/file/d/1aBcDe...    | Q4_Financial_Report.xlsx     | 1
2024-01-15 14:35:44.789  | https://mega.nz/folder/xYz123               | MEGA - Secure Cloud          | 3
2024-01-15 14:36:01.234  | https://mega.nz/folder/xYz123#upload        | MEGA - Upload                | 8
2024-01-15 14:42:15.567  | https://pastebin.com/raw/kL9mN2pQ           | Pastebin (raw)               | 1
2024-01-15 15:01:33.890  | https://192.168.1.50:8443/admin              | Admin Panel                  | 12
2024-01-15 15:15:22.111  | https://transfer.sh/upload                  | transfer.sh                  | 2
2024-01-15 15:30:45.222  | https://vpn-gateway.corporate.com            | VPN Login                    | 5
2024-01-15 16:00:00.333  | https://whatismyipaddress.com                 | What Is My IP                | 1
2024-01-15 16:05:12.444  | https://protonmail.com/inbox                 | ProtonMail                   | 3

--- Downloads (Suspicious) ---
Timestamp (UTC)          | Filename                    | URL Source                               | Size
2024-01-15 14:33:15.000  | Q4_Financial_Report.xlsm   | https://phish-domain.com/docs/report     | 245 KB
2024-01-15 14:34:02.000  | update_client.exe          | https://cdn.evil-updates.com/client.exe  | 1.2 MB

--- Cookies (Session Tokens) ---
Domain                   | Name              | Expires            | Secure | HttpOnly
.corporate.com           | SESSION_ID        | 2024-01-16 14:32   | Yes    | Yes
.mega.nz                 | session           | Session            | Yes    | Yes
.protonmail.com          | AUTH-TOKEN        | 2024-02-15 00:00   | Yes    | Yes

Report saved to: /analysis/hindsight_output/Hindsight_Report.xlsx

コメント