Communitygithub.com

使用 Hindsight 分析浏览器取证

使用开源工具 Hindsight 解析基于 Chromium 的浏览器数据库(Chrome、Edge、Brave、Opera、Vivaldi),提取并关联浏览历史、下载、Cookie、缓存内容、自动填充数据、保存的密码和扩展信息,生成统一的时间线(输出格式:XLSX、JSON 或 SQLite)。适用于事件响应、内部威胁调查和刑事案件中重建用户活动。

使用 Hindsight 分析浏览器取证 是什么?

该技能指导用户使用 Hindsight(一款开源浏览器取证工具)解析基于 Chromium 的浏览器(Chrome、Edge、Brave、Opera、Vivaldi)的多个数据库文件,提取并关联 URL 访问记录、下载历史、缓存、书签、自动填充数据、保存的密码、浏览器扩展、HTTP Cookie、HTML5 本地存储、登录数据以及会话/标签信息。通过将数据整合为统一的时序时间线(支持 XLSX、JSON 或 SQLite 格式),调查人员能够高效地重建用户的 Web 活动,用于事件响应、内部威胁调查和刑事案件分析。技能涵盖前提条件(Python 3.8+、pyhindsight 安装)、浏览器配置文件路径、关键工件文件说明、命令行与 Web UI 运行方式、特定 SQL 查询示例,并提供了 Python 分析脚本,帮助用户直接进行数据库解析和报告生成。

兼容平台~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)的工件。它能从多个浏览器数据库文件中提取并关联数据,创建统一的 Web 活动时间线。Hindsight 可解析 URL、下载历史、缓存记录、书签、自动填充记录、保存的密码、浏览器偏好设置、浏览器扩展、HTTP Cookie、本地存储(HTML5 Cookie)、登录数据以及会话/标签信息。该工具可生成多种格式(XLSX、JSON、SQLite)的时序时间线,帮助调查人员重建用户的 Web 活动,适用于事件响应、内部威胁调查和刑事案件分析。

何时使用

  • 需要分析浏览器取证数据以调查安全事件时
  • 为此领域构建检测规则或威胁狩猎查询时
  • SOC 分析师需要针对此分析类型的结构化流程时
  • 验证相关攻击技术的安全监控覆盖范围时

先决条件

  • Python 3.8+ 并安装 Hindsight(pip install pyhindsight)
  • 能够访问取证镜像中的浏览器配置文件目录
  • 浏览器配置文件数据(未使用操作系统级加密)
  • 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 本地存储
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 界面

# 启动 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_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 访问及其时间戳
    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(已加密)

[+] 正在解析 Bookmarks...
    书签条目:         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(会话令牌) ---
域名                     | 名称              | 过期时间            | 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,

相关技能