Communitygithub.com

使用 Hindsight 分析瀏覽器鑑識

解析基於 Chromium 的瀏覽器資料庫,透過 Hindsight 從 Chrome、Edge、Brave、Opera 和 Vivaldi 中提取並關聯瀏覽記錄、下載、Cookie、快取內容、自動填入資料、儲存密碼及擴充功能,產出統一的時間軸(XLSX、JSON 或 SQLite 格式)。適用於事件應變、內部威脅調查或刑事案件中重建使用者活動。

使用 Hindsight 分析瀏覽器鑑識 是什麼?

Hindsight 是一款開源的瀏覽器鑑識工具,專門用於解析 Google Chrome 及其他 Chromium 核心瀏覽器(如 Microsoft Edge、Brave、Opera、Vivaldi)的遺留資料。它能從多個瀏覽器資料庫檔案中提取並關聯資料,建立統一的網頁活動時間軸,涵蓋 URL、下載記錄、快取、書籤、自動填入、儲存密碼、偏好設定、擴充功能、HTTP Cookie、Local Storage(HTML5 Cookie)、登入資料及分頁資訊。支援 XLSX、JSON 和 SQLite 等多種輸出格式,便於事件應變、內部威脅調查及刑事案件分析。使用時需具備 Python 3.8+ 環境及未受 OS 加密保護的瀏覽器設定檔,可透過命令列或 Web UI 操作,提供詳細的資料庫結構與轉換查詢。

相容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-browser-forensics-with-hindsight

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

使用 Hindsight 分析瀏覽器鑑識 是做什麼的?

概述

Hindsight 是一款開源的瀏覽器鑑識工具,專為解析 Google Chrome 及其他 Chromium 核心瀏覽器(Microsoft Edge、Brave、Opera、Vivaldi)的遺留資料而設計。它能從多個瀏覽器資料庫檔案中提取並關聯資料,建立統一的網頁活動時間軸。Hindsight 可解析 URL、下載記錄、快取記錄、書籤、自動填入記錄、儲存密碼、偏好設定、瀏覽器擴充功能、HTTP Cookie、Local Storage(HTML5 Cookie)、登入資料及分頁/索引標籤資訊。該工具能產出多種輸出格式(XLSX、JSON、SQLite)的按時間順序排列的時間軸,使調查人員能夠重建使用者網頁活動,適用於事件應變、內部威脅調查及刑事案件。

使用時機

  • 調查需要透過 Hindsight 分析瀏覽器鑑識的安全事件時
  • 為此領域建立偵測規則或威脅獵殺查詢時
  • 安全營運中心(SOC)分析師需要此分析類型的結構化程序時
  • 驗證相關攻擊手法之安全監控覆蓋率時

先決條件

  • Python 3.8+ 並已安裝 Hindsight(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 造訪記錄、下載記錄、關鍵字搜尋
CookiesHTTP Cookie,包含網域、到期日、值
Web Data自動填入項目、已儲存的信用卡資訊
Login Data已儲存的使用者名稱/密碼(加密)
BookmarksJSON 格式的書籤樹
Preferences瀏覽器設定與擴充功能
Local Storage/每個網域的 HTML5 Local Storage
Session Storage/每個網域的工作階段專用儲存
Network Action Predictor之前輸入過的 URL
Shortcuts網址列捷徑與預測
Top Sites常造訪的網站

執行 Hindsight

命令列

# 基本分析 Chrome 設定檔
hindsight.exe -i "C:\Evidence\Users\suspect\AppData\Local\Google\Chrome\User Data\Default" -o C:\Output\chrome_analysis

# 指定瀏覽器類型
hindsight.exe -i "/path/to/profile" -o /output/analysis -b Chrome

# JSON 輸出格式
hindsight.exe -i "C:\Evidence\Chrome\Default" -o C:\Output\chrome --format jsonl

# 含快取解析(較慢但更完整)
hindsight.exe -i "C:\Evidence\Chrome\Default" -o C:\Output\chrome --cache

Web UI

# 啟動 Hindsight Web 介面
hindsight_gui.exe
# 開啟瀏覽器前往 http://localhost:8080
# 上傳或指定瀏覽器設定檔目錄
# 設定輸出格式與分析選項
# 產生並下載報告

遺留資料分析細節

URL 歷史與造訪記錄

-- Chrome History 資料庫結構(主要表格)
-- urls 表格:id, url, title, visit_count, typed_count, last_visit_time
-- visits 表格:id, url, visit_time, from_visit, transition, segment_id

-- 時間戳記為 Chrome/WebKit 格式:自 1601-01-01 起算的微秒數
-- 轉換:datetime((visit_time/1000000)-11644473600, 'unixepoch')

下載記錄

-- downloads 表格: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 表格: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):
    """將 Chrome 時間戳記轉換為 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:
    """分析 Chrome History 資料庫以取得鑑識證據。"""
    history_db = os.path.join(profile_path, "History")
    if not os.path.exists(history_db):
        return {"error": "History 資料庫未找到"}

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

    # 含時間戳記的 URL 造訪記錄
    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()]

    # 下載記錄
    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()]

    # 關鍵字搜尋
    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("用法: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 瀏覽器鑑識分析
================================================================

設定檔:/evidence/chrome-profile(Chrome 120.0.6099.130)
作業系統:Windows 10

[+] 解析 History 資料庫中...
    URL 記錄:          12,456
    下載記錄:         234
    搜尋字詞:         567

[+] 解析 Cookies 資料庫中...
    Cookie 記錄:       8,923
    加密 Cookie:      6,712

[+] 解析 Web Data(自動填入)中...
    自動填入項目:     1,234
    信用卡項目:       2(加密)

[+] 解析 Login Data 中...
    已儲存憑證:       45(加密)

[+] 解析書籤中...
    書籤項目:         189

--- 瀏覽記錄(最後 10 筆) ---
時間戳記(UTC)          | URL                                          | 標題                        | 造訪次數
2024-01-15 14:32:05.123  | https://mail.corporate.com/inbox             | 企業郵件                    | 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 - 安全雲端             | 3
2024-01-15 14:36:01.234  | https://mega.nz/folder/xYz123#upload        | MEGA - 上傳                 | 8
2024-01-15 14:42:15.567  | https://pastebin.com/raw/kL9mN2pQ           | Pastebin(原始內容)        | 1
2024-01-15 15:01:33.890  | https://192.168.1.50:8443/admin              | 管理後台                    | 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 登入                    | 5
2024-01-15 16:00:00.333  | https://whatismyipaddress.com                 | 我的 IP 是什麼              | 1
2024-01-15 16:05:12.444  | https://protonmail.com/inbox                 | ProtonMail                   | 3

--- 下載記錄(可疑) ---
時間戳記(UTC)          | 檔案名稱                    | URL 來源                               | 大小
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

--- Cookie(工作階段 Token) ---
網域                   | 名稱              | 到期時間            | Secure | HttpOnly
.corporate.com           | SESSION_ID        | 2024-01-16 14:32   | 是     | 是
.mega.nz                 | session           | 工作階段            | 是     | 是
.protonmail.com          | AUTH-TOKEN        | 2024-02-15 00:00   | 是     | 是

報告已儲存至:/analysis/hindsight_output/Hindsight_Report.xlsx

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

analyzing-docker-container-forensics

Investigate compromised Docker containers by analyzing images, layers,

相關技能