SecurityRonin/veracrypt-forensic

GitHub: SecurityRonin/veracrypt-forensic

纯 Rust 编写的 VeraCrypt/TrueCrypt 加密卷取证解密与分析库,通过密码恢复主密钥并输出明文视图及分级取证发现。

Stars: 1 | Forks: 1

# veracrypt-forensic [![Crates.io: veracrypt-core](https://img.shields.io/crates/v/veracrypt-core.svg?label=veracrypt-core)](https://crates.io/crates/veracrypt-core) [![Crates.io: veracrypt-forensic](https://img.shields.io/crates/v/veracrypt-forensic.svg?label=veracrypt-forensic)](https://crates.io/crates/veracrypt-forensic) [![Docs.rs](https://img.shields.io/docsrs/veracrypt-core?label=docs.rs)](https://docs.rs/veracrypt-core) [![Rust 1.81+](https://img.shields.io/badge/rust-1.81%2B-blue.svg)](https://www.rust-lang.org) [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE) [![赞助](https://img.shields.io/badge/sponsor-h4x0r-ea4aaa?logo=githubsponsors)](https://github.com/sponsors/h4x0r) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/SecurityRonin/veracrypt-forensic/actions/workflows/ci.yml) [![覆盖率](https://img.shields.io/badge/coverage-100%25%20lines-brightgreen.svg)](docs/validation.md) [![禁止 unsafe](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance) [![安全公告](https://img.shields.io/badge/advisories-clean-success.svg)](https://rustsec.org) **通过密码解锁 VeraCrypt(或旧版 TrueCrypt)卷并读取 明文 —— 这是一个从零开始、纯 Rust 编写的解密器,已针对真实的 VeraCrypt 二进制程序和真实卷上的 `cryptsetup` 进行了逐字节的验证。** 无需 `veracrypt` 二进制程序,无需 `cryptsetup`,无需 FUSE,无需挂载:只需一个库,即可通过密码暴力破解头部 PRF 和 cipher,恢复主密钥,并将数据区解密为 AES-256 或 Twofish-256 XTS。 ``` use std::fs::File; use veracrypt::VeraVolume; // Unlock a VeraCrypt volume with its password (no PIM). let mut vol = VeraVolume::unlock_with_password(File::open("container.vc")?, b"passphrase")?; let mut first = [0u8; 512]; vol.read_at(0, &mut first)?; // first decrypted sector of the data area println!("{:?} / {}", vol.info().flavor, vol.info().cipher.name()); # Ok::<(), Box>(()) ``` ## 适用范围 此版本会对 **所有五种 VeraCrypt PRF** 的头部进行暴力破解,并解密 **两种单一 cipher**,同时支持 PIM 以及常规和隐藏卷: | 维度 | 支持 | |---|---| | PRF(头部密钥派生) | SHA-512 · SHA-256 · Whirlpool · Streebog-512 · RIPEMD-160 | | Cipher(数据区) | AES-256-XTS · Twofish-256-XTS | | PIM | 是 —— `unlock_with_pim` / `unlock_hidden_with_pim` | | 卷布局 | 常规(头部 @ 0)· 隐藏(头部 @ 64 KiB) | | 类型 | VeraCrypt (`VERA`) · 旧版 TrueCrypt (`TRUE`) | `VeraVolume::unlock_with_password(reader, password)` 会尝试每一种 PRF × cipher 组合, 直到其中一种能将头部解密为带有两个匹配 CRC-32 的有效 `VERA`/`TRUE` 签名,随后暴露出一个明文的 `Read + Seek` 视图(`read_at`)。 `unlock_hidden_with_password` 会读取位于 64 KiB 处的隐藏头部 —— 用于访问可否认的隐藏卷,或证明其存在。 所有三种单一 cipher —— **AES-256**、**Serpent-256**、**Twofish-256** —— 均受支持,每一种都通过经过审计的 RustCrypto crate 实现(Serpent 通过 `serpent::Serpent::new_from_slice` 实现,该方法接受完整的 256 位密钥)。**Cipher 级联**(AES-Twofish-Serpent 及其他)是目前唯一暂缓实现的功能。请参阅 [`docs/RESEARCH.md`](docs/RESEARCH.md)。 ## 双 crate 分离 遵循快速读取器/分析器标准: | Crate | 角色 | 输出 | |---|---|---| | **`veracrypt-core`** | 读取器 / 解密器(`aes` · `twofish` · `xts-mode` · `pbkdf2` · `sha2` · `whirlpool` · `streebog` · `ripemd`) | 明文 `Read + Seek` 视图 + 类型化的 `VolumeInfo` | | **`veracrypt-forensic`** | 基于已恢复事实的异常分析器 | 分级观察结果 | ### 分析器发现 | 代码 | 严重性 | 含义 | |---|---|---| | `VC-LEGACY-TRUECRYPT` | 低 | 该卷是旧版 TrueCrypt(而非 VeraCrypt)容器 | | `VC-HIDDEN-VOLUME-DECLARED` | 中 | 外部头部声明了隐藏卷(可否认加密指示符) | | `VC-CIPHER-INVENTORY` | 信息 | 已恢复的 PRF、cipher 以及数据区偏移量 | 发现只是**观察结果,而非最终结论** —— 结论由检查人员得出。 ## 信任但验证 - **每一个原语都是经过审计的 RustCrypto crate** —— `aes`、`twofish`、 `xts-mode`、`pbkdf2`、`hmac`、`sha2`、`whirlpool`、`streebog`、`ripemd`、 `crc32fast`。没有任何密码学代码是手工编写的。 - **无可挑剔的第一梯队 (Tier-1)**:在一个带有公开密码的真实 VeraCrypt 卷上, **三个独立实现**解密出的扇区 **逐字节一致** —— VeraCrypt 1.26.20(Idrix,该格式自身的参考实现)、 `cryptsetup` 2.7.0(一个独立的重新实现)以及此 crate。请参阅 [`docs/validation.md`](docs/validation.md)。 - 对不受信任的卷进行**无 panic、边界检查**解析; 在生产代码中禁止使用 `unwrap`/`expect` (`#![forbid(unsafe_code)]`); 头部解析器已经过模糊测试。 [隐私政策](https://securityronin.github.io/veracrypt-forensic/privacy/) · [服务条款](https://securityronin.github.io/veracrypt-forensic/terms/) · © 2026 Security Ronin Ltd
标签:DNS 反向解析, DOS头擦除, Rust, 可视化界面, 密码破解, 数字取证, 数据解密, 磁盘加密, 网络流量审计, 自动化脚本, 通知系统