# Threat Model

## Assets

- Vault ciphertext (`vault.cbor`)
- Master passphrase
- Derivative secrets: KEK, DEK, per-record keys
- Record contents (credentials, identities, notes, financial data, API keys, wallets)

## Adversaries

1. **Local attacker without passphrase**
   - Physical access to host post-shutdown
   - Read access to vault ciphertext
   - Observes OS-level logs/temp files
2. **Local attacker with process access**
   - Malware running as same user
   - Attempts memory scraping, clipboard snooping
   - Observes command stdout/stderr
3. **Remote attacker**
   - Network-level eavesdropping
   - MITM during transport of backups
4. **Coercion / duress**
   - Compelled disclosure; must prove readiness to handle Shamir shares

## Assumptions

- Host kernel and hardware behave correctly (still recommended to use trusted, patched OS)
- Rust toolchain is uncompromised
- Operator controls physical access to machine during session
- Backups are stored encrypted/offline when not in use
- Passphrase entropy is sufficient (recommend 6+ diceware words)

## Mitigations

| Attack vector | Mitigation |
| --- | --- |
| Offline ciphertext recovery | Argon2id (256 MiB by default) + ML-KEM-1024 cascaded wrapping + XChaCha20-Poly1305 payloads |
| Memory scraping | `mlock` (Unix), `SecretBlob` + `Zeroizing`, no copies to clipboard/logs/stdout |
| Temp/log leakage | Atomic writes via `NamedTempFile`, fsync, strict perms, no plaintext writes |
| Credential reuse | Structured records with tags/query to support hygiene reviews |
| Passphrase coercion | Optional Shamir shares (`recovery split`) stored offline, duress workflows documented in `docs/OPERATIONS.md` |
| Forge/tamper | Authenticated headers + payload MAC; `black-bag doctor` verifies integrity |

## Residual Risks

- Compromise of running OS or supervisor can still capture secrets at input time
- Memory locking is best-effort and OS dependent (non-Unix builds fall back gracefully)
- Operator error (weak passphrase, careless backups) is outside the tool’s control
- No hardware anchoring (TPM/Yubi) by design; purely software trust base

## Recommended Operator Practices

1. Use strong passphrases (diceware, >100 bits entropy).
2. Run on encrypted disks with secure boot enabled.
3. Keep backups offline; transport via encrypted channels only.
4. Rotate KEKs periodically (`black-bag rotate`).
5. Schedule regular self-tests (`black-bag doctor`) and record audits (`list --query`).

