docs(security): RFC — fix the mesh crypto handshake (N3-N5)#63
Conversation
…view Proposal only (no code). The wave audit found the mesh handshake is not authenticated: complete_initiator/responder compute only ee+ss and pass ss in both the es and se slots (real es/se DH never done, no transcript hash, AllowList never consulted), and its own MITM test asserts the attacker decrypts. Plus a constant HELLO MAC key with verify_mac never called, and static keys derived from the public NodeId. This RFC specifies the fix over the existing X25519 + ChaCha20 primitives (Noise-IK-style key agreement with real es/se + transcript hash + allow-list gating; per-link HELLO MAC from the session key with RX-path verification; out-of-band static-key provisioning), a test plan (including rewriting the inverted MITM test to assert failure), and the decisions needed from the owner. Crypto stays hand-written Rust (t27 cannot express crate-based crypto — see #61, #62). Needs sign-off on the approach before implementation. Refs #58. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> phi^2 + phi^-2 = 3
Implementation analysis — the two defects address DIFFERENT attacks (sharpens the design)Started prototyping the handshake fix; found a subtlety that confirms this needs design review before coding, and sharpens the RFC: es/se and the allow-list defend against different threats — both are required:
Consequence for the plan: the fix is not a one-line es/se swap; it is (a) es/se+transcript for forward secrecy AND (b) a phi^2 + phi^-2 = 3 |
…rt 1 of N3 The handshake computed only ee + ss and passed `ss` in BOTH the es and se slots, so it had no forward secrecy and did not bind ephemerals into the session. Fix: NoiseXX.ephemeral becomes a reusable StaticSecret (EphemeralSecret is consumed by its first diffie_hellman; we need two), and complete_initiator/ responder compute the real ee/es/se so both sides derive the same key. Verified: handshake_and_roundtrip + independent_handshakes pass, full suite 103 passed. SCOPE: forward-secrecy half of N3 only. Identity auth (allow-list gating -> the actual MITM defense), N4 (HELLO MAC), N5 (keystore) remain open per RFC #63 and need owner sign-off. Based on the pipeline-guard branch (needs #60's build fix). Draft — needs crypto review. Refs #58, #63. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> phi^2 + phi^-2 = 3
Triage — KEEPVerdict: KEEP — RFC document, chistyi add (80+ lines, 1 file). Pairs with code PR #65. Same cascade as other docs PRs: baseline CI red due to committed No action required. Stays DRAFT. phi^2 + phi^-2 = 3 |
Proposal for review before implementation. Addresses the 3 crypto defects from the wave audit: unauthenticated handshake (ee+ss only, ss passed as es/se, no transcript hash, AllowList unused, MITM test inverted), constant HELLO MAC key with verify_mac never called, and NodeId-derived static keys. Specifies the fix over the existing X25519+ChaCha20 primitives + a test plan + owner decisions. Crypto stays hand-written Rust (t27 can't express it, #62). See docs/SECURITY_crypto_handshake_RFC.md. phi^2 + phi^-2 = 3