Skip to content

Don't de-establish a live session on an unauthenticated accept - #47

Open
jagerman wants to merge 1 commit into
session-foundation:devfrom
jagerman:session-accept-auth-before-reset
Open

Don't de-establish a live session on an unauthenticated accept#47
jagerman wants to merge 1 commit into
session-foundation:devfrom
jagerman:session-accept-auth-before-reset

Conversation

@jagerman

Copy link
Copy Markdown
Member

handle_session_accept reset _is_established/_outbound_tag before the parse/verify try block, with the intent that a failed accept triggers a fresh session init. But the "B" payload is a sealed (anonymous-sender) box, so an on-path party that knows the session tag could forge a malformed type-"a" handshake and force a live, established session back to unestablished (stalling outbound data until re-establishment) before the forged accept fails verification.

Mutate no live session state until the remote's identity signature verifies. Keep the "reset to trigger a new init" behaviour, but only for failures after authentication (decapsulation / key derivation) -- a genuine-but-broken accept -- by moving the reset into an inner catch around the post-signature block. A forged/garbage accept now fails at or before the signature check and leaves the established session intact.

The genuine restart-recovery path is unaffected: a restarted remote signs with its unchanged identity key and decapsulates with our pending ephemeral keys, so it lands on the success path as before.

The deprecated 1.0 handle_session_accept_deprecated path is left as-is: its accept carries no signature to gate on, so it needs separate thought.

(This is adapted from the report and (not quite complete) fix for this issue in #44.)

handle_session_accept reset _is_established/_outbound_tag before the
parse/verify try block, with the intent that a failed accept triggers a
fresh session init. But the "B" payload is a sealed (anonymous-sender)
box, so an on-path party that knows the session tag could forge a
malformed type-"a" handshake and force a live, established session back
to unestablished (stalling outbound data until re-establishment) before
the forged accept fails verification.

Mutate no live session state until the remote's identity signature
verifies. Keep the "reset to trigger a new init" behaviour, but only for
failures *after* authentication (decapsulation / key derivation) -- a
genuine-but-broken accept -- by moving the reset into an inner catch
around the post-signature block. A forged/garbage accept now fails at or
before the signature check and leaves the established session intact.

The genuine restart-recovery path is unaffected: a restarted remote signs
with its unchanged identity key and decapsulates with our pending
ephemeral keys, so it lands on the success path as before.

The deprecated 1.0 handle_session_accept_deprecated path is left as-is:
its accept carries no signature to gate on, so it needs separate thought.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant