51 lines
3.7 KiB
Markdown
51 lines
3.7 KiB
Markdown
# Threat model
|
|
|
|
Custos keeps one person's (or one household's) secrets in one encrypted file on their own disk, synced
|
|
as a plain file (e.g. by Arca to their own Nextcloud). This page says what that protects against and,
|
|
just as plainly, what it does not.
|
|
|
|
## Assets
|
|
|
|
- The secrets in the vault: passwords, API keys, TOTP seeds, Wi-Fi keys, card numbers, notes.
|
|
- The master password and the 256-bit vault key it unwraps.
|
|
|
|
## What is protected
|
|
|
|
| Attacker | Has | Gets | Why |
|
|
|:--|:--|:--|:--|
|
|
| Thief or sync server | The `.custos` file (any number of old versions) | Item count and sizes roughly (the ciphertext length), the KDF parameters. Nothing else. | XChaCha20-Poly1305 over the whole body; titles, URLs and usernames are inside it too. |
|
|
| Offline guesser | The file and a GPU farm | One Argon2id evaluation (64 MiB, 20 passes by default, ≈ 0.75 s on a desktop CPU) per guess | A 4-word memorable password with digits (~65 bits) is out of reach; a weak master password is not. **The master password is the whole defence here.** |
|
|
| Tamperer | Write access to the file | Can destroy it, or roll it back to an older version they saw. Cannot change, reorder, add or remove items unnoticed. | The header is the body's AAD; each slot's parameters are its wrap's AAD. |
|
|
| Someone who crashes the machine mid-save | — | Nothing | Atomic save: temp file, fsync, rename; the previous version is kept as `.bak`. |
|
|
|
|
## What is NOT protected
|
|
|
|
- **A compromised OS or a malicious process running as you.** While the vault is unlocked, the key and
|
|
the decrypted items are in the app's memory. Malware with your privileges can read that memory, log your
|
|
keystrokes as you type the master password, or read the screen. No password manager defends against this.
|
|
- **A memory dump while unlocked** (crash dump, hibernation file, swap). Secrets are held in zeroizing types
|
|
and wiped when dropped, which shrinks the window; it does not close it. Copies may remain where the
|
|
standard library or the JSON parser moved a buffer, in the webview (the desktop app shows a revealed
|
|
value there), and in OS buffers. Use full-disk encryption (BitLocker) for the hibernation file and swap.
|
|
- **The clipboard.** A copied secret is readable by every process until it is cleared (30 s in the
|
|
desktop app), and by any clipboard manager that ignores the "exclude from history" marker.
|
|
- **Auto-type** sends keystrokes to whatever window has focus. The app re-checks the target window before
|
|
typing, but a window that steals focus at the wrong moment can receive them.
|
|
- **Rollback.** Someone with write access to the synced file can replace it with an older version.
|
|
Custos does not detect that (there is no trusted counter to compare against).
|
|
- **Shoulder surfing and QR codes.** A revealed password or a shown QR code is readable by anyone who
|
|
can see the screen.
|
|
- **Metadata.** File size and modification times reveal roughly how much is stored and when it changed.
|
|
- **Side channels.** No effort beyond what the RustCrypto crates provide (constant-time tag comparison).
|
|
|
|
## Design rules that follow from this
|
|
|
|
- No custom cryptography: Argon2id (`argon2`), XChaCha20-Poly1305 (`chacha20poly1305`), the OS CSPRNG
|
|
(`rand`'s `SysRng`/`getrandom`), `zeroize`. All RustCrypto / rust-random.
|
|
- Secret-holding types never print their contents: `Debug` and `Display` give `[redacted]` (tested).
|
|
- Errors never contain secret material; a wrong password and a tampered slot give the same error.
|
|
- The reader checks KDF parameters against fixed limits before running Argon2, so a crafted file cannot
|
|
make it allocate unbounded memory.
|
|
- Generated passwords take their randomness only from the OS CSPRNG, and their reported entropy counts only
|
|
the random choices (a fixed pattern like capitalisation adds nothing).
|