Don't de-establish a live session on an unauthenticated accept - #47
Open
jagerman wants to merge 1 commit into
Open
Don't de-establish a live session on an unauthenticated accept#47jagerman wants to merge 1 commit into
jagerman wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.)