SPB Git

Repository Public

THREAT_MODEL.md 8.1 KB 56 lines markdown

1# SP Vault — threat model23Scope: the personal zero-knowledge vault (web, macOS, iOS, API on MacLustr). The managed-secrets subsystem4(server-side secret use for agents and brokered operations) has a **different, weaker** model, see5`services/managed-secrets/THREAT_MODEL.md`. Protocol reference: `docs/crypto-spec/SPV1.md`.67## Assets891. Vault plaintext (credentials, TOTP seeds, notes, cards, documents, attachments, names, tags).102. Key material: Account Root Key (ARK), account keyset, vault keys, recovery key, device private keys.113. Integrity and availability of the vault (no silent loss, rollback or substitution).124. Metadata (who, when, how much).1314## Trust assumptions1516* The user's unlocked device and its OS are trusted while in use. Nothing in this design survives a fully17  compromised unlocked endpoint.18* Apple Secure Enclave, CryptoKit, WebCrypto and the pinned dependencies behave as specified.19* The server (MacLustr node, tunnel gateway, database, backups, operators) is **not** trusted for20  confidentiality or integrity of vault content; it is trusted only for availability.2122## Adversaries and outcomes2324| # | Scenario | Defences | Residual risk |25|---|---|---|---|26| T1 | **Malicious or compromised server / database or backup theft** | Client-side encryption; server holds only ciphertext, public keys and `SHA-256` of the recovery authenticator; device list is certified by the account signing key so the server cannot enrol a device; AAD binds every record to vault/id/type/revision. | Metadata in SPV1 §8. Denial of service, deletion, withholding of recent writes, rollback of a never-synced device. Traffic analysis. |27| T2 | **Malicious server serving hostile JavaScript to the web app** | Strict CSP (no inline script, no third-party origins), Trusted Types, SRI-style build manifest with published hashes, reproducible build, deployment only through `mld` from a signed git commit. | **Not eliminated**: a server that controls the HTML controls the web client. The native apps are the high-assurance clients; the web app says so in Settings → Security. |28| T3 | **Stolen locked device** | ARK is never stored unwrapped; unwrapping needs the Secure Enclave key, which requires biometrics or the device passcode; the local database holds record ciphertext only (never decrypted content) plus sync metadata in clear (vault/record ids, member handles and public keys, cursors); data-protection class `…WhenUnlockedThisDeviceOnly`; remote revocation removes the envelope and sessions. | An attacker who knows the device passcode can unlock (policy `userPresence`; strict biometric-only mode is an option). Revocation does not reach an offline device. |29| T4 | **Stolen unlocked / compromised endpoint (malware, forensic image of a running app)** | Auto-lock on inactivity, on sleep and on background; secrets zeroed on lock where the runtime allows; no plaintext on disk outside the encrypted store; hardened runtime, sandbox. | Full compromise of an unlocked endpoint discloses everything it can decrypt. After such an event: revoke the device and **rekey the account** (SPV1 §6), then rotate the stored credentials themselves. |30| T5 | **Phishing of the server login** | Passkeys only (origin-bound, no password to type); no SMS/e-mail fallback. | Social engineering to approve a device pairing: mitigated by the tag check + 6-digit comparison + explicit device details; cannot be fully prevented. |31| T6 | **Phishing of stored credentials (lookalike domains)** | Fill only on exact registrable-domain match computed with the Public Suffix List, never on `http:` for a saved `https:` login; IDN shown in punycode when scripts are mixed; lookalike warning (confusable skeleton vs saved hosts); destination origin shown before filling. On Apple platforms matching is performed by the OS for the AutoFill extension (service identifiers). | A user can still copy a password manually into a hostile page. |32| T7 | **Browser extension compromise / hostile extension in the web vault's page** | No extension is shipped in v1. CSP + Trusted Types reduce injection; secrets are rendered only on explicit reveal. | An extension with full page access can read whatever the page shows or holds in memory. Use native clients. |33| T8 | **Supply-chain attack** | Minimal dependencies, exact pins + lockfile with integrity hashes, `pnpm audit`, SBOM (CycloneDX), secret scanning, no post-install scripts (`ignore-scripts`), Swift uses only Apple frameworks. | A malicious release of a pinned dependency adopted during an update. Updates are reviewed diffs. |34| T9 | **Brute force** | No password anywhere: keys are 256-bit random. Recovery authenticator is 256-bit; endpoints are rate-limited per IP and per account regardless; pairing codes are 128-bit, single use, 5 min. | — |35| T10 | **Replay / request forgery** | WebAuthn challenges single-use with expiry and origin + RP ID verification; session tokens random 256-bit, stored hashed, rotated on privilege change; `SameSite=Strict` `__Host-` cookie + custom header + Origin check for the web; idempotency keys; `base_rev` on writes. | — |36| T11 | **Rollback / stale state** | Client-side high-water marks for `seq` and per-record `rev`; AAD binds `rev`; state digest comparison between devices. | SPV1 §7 limits (freshness for an offline or new device). |37| T12 | **Sync conflict causing data loss** | Server never overwrites on stale `base_rev`; the client keeps the losing version as a conflict copy that the user reviews; previous revisions retained in history; trash with 30-day retention. | — |38| T13 | **Recovery abuse** | Recovery needs the 256-bit recovery key (never on the server). Recovery events are audited, shown on every device and end all other sessions' *pending* states; RK rotation is offered after each use. No operator backdoor exists. | Anyone holding the printed recovery kit owns the vault. Losing every device **and** the kit is permanent loss, stated during onboarding. |39| T14 | **Cross-tenant access (IDOR, enumeration)** | Every query is scoped by the session's account and by server-side membership rows; identifiers are random UUIDs; uniform errors and timing for unknown handles; tests in `tests/security`. | — |40| T15 | **Malicious agent / prompt injection (SP Vault for Agents)** | Agents never get the personal vault. They hold a scoped identity; each grant names one secret, an action class (`operate` vs `read`), a lease TTL and a use budget; high-risk actions wait for a human approval made in an authenticated client; all tool output is treated as data; kill switch revokes every lease at once; hash-chained audit log. | A secret delivered in `read` mode can be disclosed by its recipient. Brokered `operate` mode is preferred and labelled. |41| T16 | **Insider / operator on the cluster** | Same as T1 for the personal vault. For managed secrets the operator of the node **can** decrypt (key on the node, mode 0600, separate from backups): stated in the UI wherever a secret is moved there. | By design for managed secrets. |42| T17 | **Leak through logs, crash reports, notifications, clipboard, screenshots** | Server logs carry request id, route template, status, duration only; no bodies. Clients: no analytics, no third-party crash reporter; app-switcher privacy cover; clipboard marked concealed/local-only with expiry where the OS supports it and cleared after a delay best-effort. | Clipboard managers and universal clipboard may already have copied the value. |43| T18 | **Malicious ciphertext / parser attacks** | Strict schema validation before and after decryption; size limits; fuzz tests on envelope and import parsers; AEAD failure is fatal for that record only and surfaced. | — |4445## Out of scope4647Rubber-hose coercion, hardware attacks on the Secure Enclave, a compromised Apple ID that syncs the login passkey48(the passkey alone gives no vault access — a certified device or the recovery key is still required), nation-state49traffic correlation.5051## Launch gates5253Independent security review of SPV1 and both implementations, external penetration test of the API and web app,54real-device tests of Keychain / biometrics / AutoFill, and a restore drill are **required before real credentials55are migrated**. Their status is tracked in `SECURITY.md`.56
Files main
Menu

Theme