From d8fcfa2df7f3b44f46210122cba19e46a4ecc2e4 Mon Sep 17 00:00:00 2001 From: Erik Karulf Date: Fri, 13 Nov 2026 01:14:13 -0600 Subject: [PATCH] Address issue #19 --- DESIGN.md | 17 ++++++++++++++--- PROTOCOL.md | 6 ++++++ internal/transport/renew_test.go | 5 ++++- third_party/tailcat/quantumcat.go | 6 +++++- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 0d316cd..2b33b60 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -784,9 +784,20 @@ Because the ML-KEM client private key is freshly generated for the connection an Each renewal generates another independent ephemeral ML-KEM key. If an attacker captures normal process memory and current session keys, then loses access before a later renewal begins, the fresh ML-KEM shared secret makes the renewed -PSK independent of the captured state. After one successful uncompromised -renewal, that earlier snapshot is insufficient to follow the session. This -property does not require a persistent root or server-side ratchet state. +PSK independent of the captured state. PSK bootstrap completion alone does not establish recovery of application +traffic: `Renew` returns after PSK installation and scheduling a WireGuard +handshake. Existing send keys can still encrypt traffic, including the first +outbound packet after return, while that handshake is pending or lost. + +The recovery boundary is traffic encrypted with WireGuard keys derived from +the fresh PSK, after any in-flight handshake using the old PSK has ceased to +affect the active generation. Old receive keys may remain accepted during +WireGuard's overlap window, so fresh outbound encryption is also distinct from +rejecting all packets made with captured old keys. No fixed recovery deadline +is promised by this API. A newer handshake timestamp or a successful data-path +probe is diagnostic evidence, not proof of the PSK generation or retirement of +old receive keys. This property does not require a persistent root or +server-side ratchet state; the current API does not attest that boundary. This is recovery from an ended snapshot or offline compromise, not protection from continuing endpoint control. An attacker that remains able to execute in diff --git a/PROTOCOL.md b/PROTOCOL.md index 20bf77a..e7d2d49 100644 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -273,3 +273,9 @@ There are no acknowledgements or retries. Missing fragments cause loss of that datagram, never delivery of a partial message. Complete duplicate datagrams may still be delivered; the application owns replay handling. This framing does not change the bootstrap or WireGuard protocol. + +Renewal completion means fresh PSK installation and scheduling of a WireGuard +handshake. It does not attest a traffic-key transition: immediate application +traffic can still use old send keys; delayed/lost handshake packets extend that +period, and old receive keys can overlap afterward. See DESIGN ยง22.6. Neither +a later handshake timestamp nor a successful probe proves PSK generation. diff --git a/internal/transport/renew_test.go b/internal/transport/renew_test.go index c3446b9..a8d17eb 100644 --- a/internal/transport/renew_test.go +++ b/internal/transport/renew_test.go @@ -256,12 +256,15 @@ func TestTCPStreamSurvivesRenewalAndLostAcknowledgement(t *testing.T) { if routeAdds.Load() != 1 || c.PublicKey() != node || conn.LocalAddr().String() != addr { t.Fatal("renewal recreated transport identity or route") } + // This checks eventual handshake activity and flow continuity only. An old + // in-flight handshake can also advance this timestamp; this is not proof of + // the PSK generation or retirement of old receive keys. newHandshake := false for _, peer := range c.Status().Peer { newHandshake = peer.LastHandshake.After(initialHandshake) } if !newHandshake { - t.Fatal("renewed PSK never completed a fresh WireGuard handshake") + t.Fatal("no later WireGuard handshake observed") } // An existing node cannot be taken over by a different authenticated identity. diff --git a/third_party/tailcat/quantumcat.go b/third_party/tailcat/quantumcat.go index 3f8b0c5..6b0bb61 100644 --- a/third_party/tailcat/quantumcat.go +++ b/third_party/tailcat/quantumcat.go @@ -88,7 +88,11 @@ type AuthenticatedPeer struct { } // Renew repeats authentication without recreating the device, netstack, node -// address, or sockets. Existing WireGuard traffic keys survive the PSK update. +// address, or sockets. Success means fresh PSK installation and scheduling of +// a WireGuard handshake, not completion of that handshake or retirement of old +// traffic keys. Existing send and receive keys can survive the PSK update; +// immediate traffic may use them while a handshake is delayed or lost. Status +// timestamps and Probe do not attest which PSK generated active traffic keys. func (c *Client) Renew(ctx context.Context) error { c.renewMu.Lock() defer c.renewMu.Unlock()