Threat Model
1. Identity & Key Hierarchy
Section titled “1. Identity & Key Hierarchy”Backdit separates long-lived Account Keys from replaceable per-machine Device Keys:
- 24-Word BIP-39 Seed: Generated with
256bits of CSPRNG entropy (bip39::WordCount::Words24). - HKDF-SHA256 Domain Separation: Expands the seed with salt
backdit/key-hierarchyinto five 32-byte keys:account-signing(Ed25519AccountId),file-root(XChaCha20-Poly1305),storage-recipient(X25519 HPKE),recovery(Capsules &PackIndex), andlocator(blind DHT lookup). - Device Authorization (
DeviceCertificate): Each node generates an install-local Ed25519 keypair (identity.bundle) signed byAccountId(365dexpiry,DeviceRevocationsupported). Compromising a device does not expose the 24-word mnemonic unless the mnemonic was left on that disk. - Memory Hygiene:
AccountKeys,ApiToken, and transient mnemonic structs wrapzeroize::Zeroizeon drop and print[REDACTED]inDebug.
2. Confidentiality, Integrity & Local-Path Guards
Section titled “2. Confidentiality, Integrity & Local-Path Guards”- Per-Stripe Nonce Derivation: Each file draws a random 24-byte base nonce and XORs its 32-bit
chunk_indexper stripe (derive_chunk_nonce) beforeXChaCha20-Poly1305encryption.PackIndexis encrypted separately. - Host Memory vs. Disk Boundary: Hosts verify Proof-of-Possession, receive incoming shards into OS-locked
LockedBuffermemory (mlock/VirtualLock, failing closed if locking fails and zeroizing on drop; covers theLockedBufferallocation itself rather than external library stack copies or full-system dumps), and seal them via RFC 9180 HPKE to the owner’sstorage-recipientkey (BKDTSEAL) before writingBKDTHOSTto disk (with optional localhost_store.keywrapping). - Local-Path Privacy:
TABLE_LOCAL_SOURCESis strictly local tometadata.redband never serialized into Recovery Capsules. - Protected-Root & Symlink Guards:
upload-localskips symlinks (is_symlink()) and validates canonical paths.download-localrejects..traversal, refuses overwriting existing files unlessoverwrite = true, and returns403 Forbiddenif a target resolves inside Backdit’sdata_dir,chunks_dir, or config directory.
3. Network, Sybil & API Hardening
Section titled “3. Network, Sybil & API Hardening”- Admission PoW & Connection Caps: Handshakes require
pow_difficulty = 16(8..=24), bounded connection limits (96in /96out onDesktop,1024in /256out onBootstrap/Seed),75%soft watermarks protecting the48-peer sticky cohort, andInboundConnectionSubnetGuard(<= 4concurrent inbound connections per public IPv4/24or IPv6/48and<= 24combined over/p2p-circuitrelays, closing excess connections viaswarm.close_connectionwhile exemptingnetwork.friends,bootnodes, and loopback/private addresses whenallow_local_network = true). - Kademlia Routing Diversity:
KademliaSubnetGuard(4,096-subnet LRU) enforces<= 2distinct peers per public/24or/48beforekademlia.add_address(exemptingnetwork.friends,bootnodes, and loopback/private whenallow_local_network = true). - Inbound Host Starter-Pool, Capsule, Dust & RPC Guards (
HostService):- Per-Subnet Starter-Pool Cap (
InboundSubnetGuard,4,096-subnet LRU): Caps aggregate unbacked debt across all accounts observed from any single public/24or/48(ConnectedPoint) at512 MiB(max_bootstrap_debt_bytes), and caps/p2p-circuitrelayed debt at(bootstrap_pool_cap / 4).max(512 MiB)(bypassing loopback/private whenallow_local_network = true, and exempting[[economy.trusted_accounts]]andnetwork.friends). - Unbacked
StoreCapsuleFlood Cap: Reciprocating partners and[[economy.trusted_accounts]]stay admitted up to usable disk; unreciprocated accounts are capped at4distinct accounts per public/24or/48and share a host-wide1%ofusable_bytes(32 MiB ..= 512 MiB) unbacked capsule budget. - Tiny-Shard (“Dust”) Object-Count Cap: Enforces
MAX_UNBACKED_OBJECTS_PER_ACCOUNT = 256objects while unbacked and256.max((bytes_hosted_for_peer + incoming_len) / 65_536)globally (64 KiBaverage object floor past256objects) without distorting byte-level accounting. - Per-Peer RPC Rate Limiting (
PeerRpcRateLimiter,2,048-peer LRU): Token-bucket throttling before disk/Merkle reads (Audit:30burst,5/s;Get:64burst,30/s;[[economy.trusted_accounts]]exempted), returningRemoteError::ResourceUnavailable(treated by Sentinel as unreachable without-10corruption penalty).
- Per-Subnet Starter-Pool Cap (
- Bounded Framing:
/backdit/placement-stream/1.0.0(BKDTNET1) caps control frames at256 KiB(MAX_FRAME_BYTES = 262,144) and enforces120sreplay windows (30sfuture skew).postcarddecoders enforce pre-decode byte caps and trailing-byte checks. - Signaling-Only Relays:
Bootstrap/Seedrelays limit circuits to256 KiB/120s(256reservations,64circuits) so bulk shards never amplify relay bandwidth. - Anti-Sybil Placement Diversity:
openuploads (underBackupPolicy::IndependentHosts) require14distinctAccountIds, prefer diverse observedConnectedPointconnection networks, and cap public subnets at<= 2shards per IPv4/24or IPv6/48(bypassed on loopback/private clusters whenallow_local_network = true, withRelayedconnections bucketed separately). - Local HTTP API Hardening: Binds
127.0.0.1:9011by default, validates a 32-byte Bearer token (api_token) in constant time, supports one-time#code=launch exchange (60sTTL), enforces same-origin CORS +script-src 'self'CSP +X-Frame-Options: DENY, and keeps/healthzsecret-free.
4. Known Residual Risks (v0.1.0)
Section titled “4. Known Residual Risks (v0.1.0)”- Unaudited Cryptography & Codebase: No independent third-party audit has been completed yet.
- Cold-Recovery Eclipse / Rollback: If an attacker eclipses all reachable DHT providers and serves an older valid signed capsule, the clean machine cannot distinguish withholding from propagation lag without operator review of
capsule_sequenceandconfirming_hosts(or an offlinebackdit recovery export). - Local Wall-Clock Trust in Bilateral Accounting:
balance_byte_secondsrelies on local wall-clock time (dtclamped to6h, rollback rebased). Extreme clock manipulation or DB loss without capsules alters local ledger views. - Multi-Subnet Sybil Cost (
openMode): Single-subnet/24and/48starter-pool, capsule, connection, and Kademlia caps limit single-block amplification, andPeerRpcRateLimiterboundsAudit/Getbursts, but coordinated attackers across many rented/24//48blocks or same-ASN hosts remain out of scope forv0.1.0(targeted forv0.2.0). Usefriends_onlyfor strict high-trust circles. - Loopback Exposure: If setting
BACKDIT_API_BIND=0.0.0.0inside Docker, always publish127.0.0.1:9011:9011or place it behind an authenticated TLS reverse proxy.
5. Threat vs. Protection Summary
Section titled “5. Threat vs. Protection Summary”| Threat | Protection in v0.1.0 |
Residual Limit |
|---|---|---|
| Curious host reading backups | Client Zstd + XChaCha20-Poly1305 (file_root) + encrypted PackIndex. |
Host observes approximate shard size and timing; pair with Restic/Borg/Kopia for outer wrapping. |
| Uploader pushing raw unsealed bytes or flooding capsules/dust | HPKE Proof-of-Possession + RFC 9180 HPKE sealing in LockedBuffer RAM before disk write; /24//48 512 MiB starter cap, 4-account/1% (32-512 MiB) unbacked capsule cap, 256-object/64 KiB dust floor, and PeerRpcRateLimiter. |
Multi-subnet rented botnets and ASN diversity remain open for v0.2.0; use friends_only to restrict uploaders completely. |
| Lazy host discarding shards | 64 KiB-block Merkle Proof-of-Storage + bounded full-fetch checks (-10 penalty + repair). |
Healthy stripes (12-13 shards) wait 24h grace before replacement. |
| Local path leakage to swarm | TABLE_LOCAL_SOURCES stays in local redb, omitted from Recovery Capsules. |
Full-disk encryption (LUKS/BitLocker) protects local machine state at rest. |
download-local overwriting Backdit keys/DB |
Canonical path guard blocks data_dir, chunks_dir, and config directory (403 Forbidden). |
Explicit overwrite = true can overwrite non-Backdit files in allowed folders. |
Browser CSRF / XSS / DNS rebinding on :9011 |
127.0.0.1 bind, constant-time Bearer token, same-origin CORS, strict CSP, X-Frame-Options: DENY. |
Any local process able to read api_token controls the daemon. |
| Relay traffic amplification | Signaling-only Circuit Relay v2 (256 KiB / 120s, 64 circuits). |
Relays still handle small control handshakes. |
| Malformed frames / panics | MAX_FRAME_BYTES = 262,144, bounded postcard, #![deny(clippy::unwrap_used, panic)] in prod. |
Software is unaudited alpha; fuzz coverage lives in tests/protocol_fuzzing_test.rs. |