SecurityRonin/browser-forensic
GitHub: SecurityRonin/browser-forensic
一款基于 Rust 的跨平台浏览器取证工具套件,支持解析多浏览器痕迹、检测反取证篡改行为并从 SQLite 空闲页中恢复已删除记录。
Stars: 0 | Forks: 0
[](https://github.com/SecurityRonin/browser-forensic/stargazers)
[](LICENSE)
[](https://github.com/SecurityRonin/browser-forensic/actions/workflows/ci.yml)
[](https://www.rust-lang.org/)
[](#install)
[](https://github.com/sponsors/h4x0r)
# browser-forensic
**解析 Chrome、Firefox 和 Safari 取证痕迹。检测历史记录清除。恢复已删除的记录。无运行时依赖。**
浏览器痕迹几乎存在于每一次调查中——它们能重建用户的时间线,暴露凭据泄露,并通常能揭示攻击的传递机制。问题在于工具:大多数解析器需要 Python,将你限制在 Windows 上,或者忽略了证据是否被篡改这一具有取证意义的问题。
`bw` 是一个单独的 Rust 静态二进制文件。将其指向浏览器数据库即可获取 JSON。将其指向配置文件目录即可获取包含完整性指标和恢复出的已删除记录的完整分诊报告。
```
cargo install --git https://github.com/SecurityRonin/browser-forensic bw-cli
bw history /path/to/Chrome/Default/History --format jsonl | jq 'select(.attrs.url | test("google.com"))'
```
**[完整文档 →](https://securityronin.github.io/browser-forensic/)**
## 安装
**从源码构建**
```
git clone https://github.com/SecurityRonin/browser-forensic.git
cd browser-forensic
cargo build --release
./target/release/bw --help
```
## 你可以用它做三件事
### 重建完整的浏览器时间线
```
# Chrome 历史记录 — 最近 30 天,按时间排序
bw history /path/to/Chrome/Default/History --format jsonl \
| jq -r '[.timestamp_ns, .attrs.url, .attrs.title] | @tsv' \
| sort | tail -100
# Firefox — 相同命令,不同路径
bw history /path/to/Firefox/Profiles/abc.default/places.sqlite --format jsonl
```
这三种浏览器都会生成相同的 `BrowserEvent` JSON schema。你的下游分析 pipeline 不需要知道是哪个浏览器生成的数据。
### 检测历史记录清除与篡改
```
bw integrity /path/to/Chrome/Default/History --format jsonl
```
```
{"HistoryCleared":{"browser":"Chromium","path":"/path/to/History","detected_at_ns":1700000000000000000}}
{"AutoIncrementGap":{"path":"/path/to/History","table":"urls","max_rowid":2,"auto_increment":847}}
{"VisitIdGap":{"path":"/path/to/History","expected_id":3,"found_id":851}}
```
在不到 100 毫秒内得出三个指标。`sqlite_sequence` 表记录了 847 次URL插入;但只剩下 2 行。ID 从 2 跳到了 851。用户清除了他们的历史记录——并且这个数据库准确记录了最后一条可见记录是何时写入的。
### 从 SQLite 空闲页中恢复已删除的记录
```
bw carve /path/to/Chrome/Default/History --format jsonl
```
SQLite 将已删除的行标记为空闲页,而不是立即覆盖它们。`bw carve` 会遍历空闲链表,扫描每个空闲页以查找 URL 模式,并返回所有留存的数据。与 `bw integrity` 结合使用,以确认哪些内容被删除以及哪些内容被恢复。
## 独特之处
| | browser-forensic | Hindsight | BrowsingHistoryView | plaso |
|--|:-:|:-:|:-:|:-:|
| 在 Linux / macOS 上运行 | ✓ | ✓ | — | ✓ |
| 单一静态二进制文件 | ✓ | — | — | — |
| 无需 Python 运行时 | ✓ | — | ✓ | — |
| Chrome + Firefox + Safari | ✓ | ✓ | ✓ | ✓ |
| 完整性 / 篡改检查 | ✓ | — | — | — |
| SQLite 空闲页恢复 | ✓ | — | — | — |
| WAL 恢复 | ✓ | — | — | — |
| 内存字节模式扫描 | ✓ | — | — | — |
| 可嵌入的 Rust 库 | ✓ | — | — | — |
| JSON / JSONL / CSV 输出 | ✓ | — | ✓ | 部分 |
## 浏览器覆盖范围
| 痕迹 | Chrome / Edge / Brave | Firefox | Safari |
|---|:-:|:-:|:-:|
| 历史记录 | ✓ | ✓ | ✓ |
| Cookies | ✓ | ✓ | ✓ |
| 下载记录 | ✓ | ✓ | ✓ |
| 书签 | ✓ | ✓ | ✓ |
| 扩展 / 附加组件 | ✓ | ✓ | — |
| 自动填充 | ✓ | — | — |
| 登录数据 (无密码) | ✓ | ✓ | — |
| 缓存 | ✓ | — | — |
| 会话状态 | ✓ | ✓ | — |
| 常访问站点 | — | — | ✓ |
| 配置文件元数据 (Local State) | ✓ | — | — |
| 完整性指标 | ✓ | ✓ | ✓ |
| SQLite 空闲页恢复 | ✓ | ✓ | ✓ |
| WAL 恢复 | ✓ | ✓ | ✓ |
## 完整性检查
`bw integrity` 检测原始的结构异常——关于数据库的可观察事实,而非取证结论:
**HistoryCleared / AutoIncrementGap** — `sqlite_sequence` 记录了 N 次插入;剩余行数少于 N。自增计数器是曾经插入的所有内容的影子,包括已删除的内容。
**VisitIdGap** — 访问 ID 必须是单调分配的。第 2 行和第 851 行之间出现 840 个 ID 的缺口,意味着有 840 条访问记录被插入然后被删除。
**TimestampNonMonotonic** — 会话内的访问时间戳不能倒退。早于前一次访问的时间戳表明存在记录注入或手动表操作。
**CookieTimestampAnomaly** — `creation_utc` 晚于 `last_access_utc` 的 cookie 不可能自然存在。访问时间戳早于 cookie 的创建时间——该记录是伪造的或时间戳被篡改过。
**WalPresent** — 数据库旁边存在一个 `-wal` 文件意味着存在未刷新的写入,且未反映在主文件中。WAL 包含最新的状态;忽略它会产生不完整的取证画面。
**SqliteIntegrityFailure** — `PRAGMA integrity_check` 报告结构损坏。这可能是良性原因(写入中断)或故意为之(反取证的页面篡改)。
**HistoryTombstoneFound** *(Safari)* — Safari 维护着一个用于已删除历史记录项的 `history_tombstones` 表。Tombstones 是历史记录被删除的直接证据,且 schema 中保留了删除时间戳。
**DownloadFileMissing** — 存在带有本地目标路径的下载记录,但文件不存在。下载已完成;文件已被移除。
## 全面分诊
```
# 发现用户主目录下的所有浏览器配置文件,
# 解析每个 artifact,运行完整性检查,并恢复空闲页面
bw triage --home /mnt/evidence/Users/jsmith --format jsonl > report.jsonl
```
分诊报告包括:
- 跨 Chrome、Firefox 和 Safari 解析的所有浏览器事件
- 从发现的每个数据库中提取的完整性指标
- 从 SQLite 空闲页和 WAL 文件中恢复的记录
- 发现的配置文件的清单(浏览器、名称、路径)
- 用于监管链文档的生成时间戳
## 输出 Schema
所有命令共享相同的 `BrowserEvent` 封装:
```
{
"timestamp_ns": 1700000000000000000,
"browser": "Chromium",
"artifact": "History",
"source": "/path/to/History",
"description": "https://example.com — Example Domain",
"attrs": {
"url": "https://example.com",
"title": "Example Domain",
"visit_count": 3
}
}
```
`timestamp_ns` 始终为 Unix 纳秒。`artifact` 是痕迹类型(`History`、`Cookies`、`Downloads`、`Bookmarks`、`Autofill`、`LoginData`、`Extensions`、`Cache`、`Session`、`Integrity`、`Carved`、`Memory`)。
## Crate 架构
工作区是分层的——每个 crate 都有单一的职责:
```
forensicnomicon format constants, epoch offsets, SQLite magic, artifact profiles
|
browser-core BrowserEvent, BrowserFamily, ArtifactKind, ForensicMeta, timestamp conversions
|
┌───┴──────────────────────────────────────────┐
│ │
browser-chrome Chrome/Chromium/Edge/ browser-discovery cross-platform profile
browser-firefox Brave/Firefox/Safari (macOS/Linux/Win) discovery
browser-safari artifact parsers
│
├── browser-integrity history clearing, visit ID gaps, WAL detection, timestamp anomalies
├── browser-carve SQLite free-page walking, WAL frame recovery
└── browser-memory byte-pattern URL/cookie scanning (no CONTAINER dependency)
|
browser-rt TriageReport orchestration — wires all crates into a single report
|
bw-cli `bw` — history / cookies / downloads / bookmarks / integrity / carve / triage
```
每个库 crate 都可以在你自己的 Rust 工具中独立使用。`browser-integrity`、`browser-carve` 和 `browser-memory` 接受 `Path` 或 `&[u8]`——它们与介质无关,不依赖于任何镜像格式或内存转储层。
| Crate | 描述 |
|---|---|
| `browser-core` | 领域类型,时间戳转换,ForensicMeta 查询 |
| `browser-chrome` | Chrome 历史记录、cookies、下载、书签、自动填充、登录数据、扩展、缓存、会话、Local State |
| `browser-firefox` | Firefox 历史记录、cookies、下载、书签、扩展、会话 (mozLz4)、登录数据 |
| `browser-safari` | Safari 历史记录、cookies、下载、书签、TopSites |
| `browser-discovery` | 查找主目录下的所有浏览器配置文件 |
| `browser-integrity` | 检测历史记录清除、访问 ID 缺口、时间戳异常、WAL 存在、tombstones |
| `browser-carve` | SQLite 空闲页恢复,WAL 帧恢复 |
| `browser-memory` | 用于内存取证的字节模式 URL/cookie 扫描——此层之下无运行时依赖 |
| `browser-rt` | RapidTriage 编排——`triage_profile()` + `triage()` → `TriageReport` |
| `bw-cli` | `bw` 命令行二进制文件 |
## 作为库使用
```
[dependencies]
browser-chrome = { git = "https://github.com/SecurityRonin/browser-forensic" }
browser-integrity = { git = "https://github.com/SecurityRonin/browser-forensic" }
browser-carve = { git = "https://github.com/SecurityRonin/browser-forensic" }
```
```
use browser_chrome::parse_history;
use browser_integrity::{check_history_integrity, IntegrityIndicator};
use browser_core::BrowserFamily;
let events = parse_history(path)?;
let indicators = check_history_integrity(path, BrowserFamily::Chromium)?;
for ind in &indicators {
match ind {
IntegrityIndicator::HistoryCleared { detected_at_ns, .. } => {
eprintln!("History was cleared at {detected_at_ns}");
}
IntegrityIndicator::VisitIdGap { expected_id, found_id, .. } => {
eprintln!("Visit ID gap: expected {expected_id}, found {found_id}");
}
_ => {}
}
}
```
## RapidTriage 生态系统
browser-forensic 是 [RapidTriage](https://github.com/SecurityRonin/rapidtriage) DFIR 工具包中的一个解析器库:
| Crate | 痕迹家族 |
|---|---|
| [browser-forensic](https://github.com/SecurityRonin/browser-forensic) | Chrome / Firefox / Safari |
| [winevt-forensic](https://github.com/SecurityRonin/winevt-forensic) | Windows 事件日志 |
| [srum-forensic](https://github.com/SecurityRonin/srum-forensic) | Windows SRUM / ESE |
| [memory-forensic](https://github.com/SecurityRonin/memory-forensic) | 进程内存,页表 |
| [forensicnomicon](https://github.com/SecurityRonin/forensicnomicon) | 痕迹目录,格式常量 |
[隐私政策](https://securityronin.github.io/browser-forensic/privacy/) · [服务条款](https://securityronin.github.io/browser-forensic/terms/) · © 2026 Security Ronin Ltd.
标签:API安全, Chrome取证, Firefox取证, HTTP工具, JSON输出, Rust, Safari取证, 单文件二进制, 历史记录提取, 取证分析套件, 可视化界面, 域渗透, 库, 应急响应, 数字取证, 数据恢复, 数据雕刻, 文档结构分析, 无运行时依赖, 浏览器取证, 电子数据取证, 痕迹分析, 网络安全, 网络流量审计, 自动化脚本, 记录恢复, 通知系统, 防篡改检测, 隐私保护, 静态编译