docs: ratchet wire spec + forward-secrecy/PCS threat-model claims #89
Loading…
Reference in a new issue
No description provided.
Delete branch "wt/t_29a71a55"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this is
Docs-only:
docs/PROTOCOL.md,docs/THREAT_MODEL.md,README.md. Nosrc/,tests/,Cargo.toml,crates/,android/or.forgejo/change.Base is
main(the parent cards, PR #87wt/t_dcafd1c8and PR #88wt/t_95ff7563, are both merged onto it — this card was stacked and no longerneeds the parent branch base).
PROTOCOL.md —
## Ratchet (v1 chat layer)New section, written so a second implementation can interoperate from the text
alone:
ratprefix, version0x01, 40-byte headerdh_pub[32] || N u32 BE || PN u32 BE, 12-byte random nonce,ChaCha20-Poly1305 ciphertext + tag; min 73 bytes; the 40 header bytes are the
AEAD associated data.
reason the plaintext-on-the-wire header was rejected for this architecture
(the Noise session already hides the frame; a plaintext header would only
hand an observer counters and ratchet-key changes).
HKDF-SHA256(salt = root, ikm = dh_out, info = "onionwire-ratchet-v1-kdfrk") -> 64 bytes = new_root || chain_key;KDF_CK(ck) = HMAC-SHA256(ck, 0x01) || HMAC-SHA256(ck, 0x02); thetwo-call
epoch_chainsrule with lo/hi by public-key order.-> HKDF salt
onionwire-ratchet-v1-bootstrap,root, and per-sideratchet-key || pubkey), plus the convergence argument and the bootstraptie-break (lower ratchet key rotates, and only after it has received).
PN, receive half,sending half),
MAX_SKIP = 2000,MAX_SKIPPED_KEYS = 2000oldest-insertedeviction, replay fails closed, bounds validated before any mutation.
ratchet_sessionsat rest in the SQLCipher store, device-local, nevertransmitted.
loc,prf,inv,rcp,tip,png,filand file chunks), and the prekey-change reset paragraph.ratrow, classified before the[a-z]{3}catch-all;
Versioningnotes theratversion byte is its own break.THREAT_MODEL.md
New section "Chat is ratcheted on top of the one-shot Noise session" with
gains (per-chain FS, PCS after a DH step, header not on the wire) and honest
limits (skipped-key window, prekey-bound bootstrap epoch, no deniability and no
non-repudiation, no one-time prekeys, compromised endpoint out of scope, no
metadata gain beyond Noise, and the no-server-side-outbox lock is not
re-opened). The at-rest section now lists the ratchet session blobs with the
rest of the ciphertext.
README.md
Operator-visible section "Chat ratchet (per friend, on device)": chat is
ratcheted inside Noise; only chat is;
/wipekeeps the ratchet state while/wipe-allremoves it; there is no reset command in v0.2.1 and a peer prekeychange (refreshed invite,
F3) is the only recovery; an unauthenticatedinbound frame is dropped with a stderr line and no TUI marker, so a desync is
diagnosed from the terminal.
Deviation from the card brief, named
or derived from the session handshake. It is not: the Noise handshake is
frozen and
session.rsis off limits, so the implementation derives thebootstrap epoch from the two signed prekeys. The doc documents the
derivation, not the brief's assumption.
statics does not reveal message keys. That is true for stored traffic (the
outer one-shot Noise ephemerals are independent) and true from the first DH
step on, but the bootstrap epoch's root and both initial ratchet secrets
are HKDF outputs of that same prekey DH with public pubkeys mixed in, so an
attacker holding both prekey secrets can reconstruct the first epoch. The
doc says exactly that instead of the stronger claim.
Known bug found while verifying (out of scope here)
A 4-byte frame
ratpanicsFrame::parse(src/ratchet.rs:693,frame[FRAME_PREFIX.len()]on a 4-byte slice), and it is reachable from a peerinside an authenticated Noise session. Reproduced out of tree with a temporary
test (deleted again, not part of this PR):
Filed as a follow-up card rather than fixed here, because this card forbids
src/. The spec keeps the MUST-reject wording that the fix should satisfy.