internal: refuse userauth before service request - #1292
Draft
ejohnstown wants to merge 1 commit into
Draft
ejohnstown wants to merge 1 commit into
ejohnstown wants to merge 1 commit into
Conversation
The server refuses user auth messages until the ssh-userauth service request is in, per RFC 4252 section 1, and disconnects on them as on any known id at the wrong time. A successful userauth request can no longer satisfy the accept loop and draw SERVICE_ACCEPT for a service the client never requested. - IsMessageAllowedServer() gates ids 50 to 79 on acceptState reaching ACCEPT_CLIENT_USERAUTH_REQUEST_DONE - regress: the filter refuses USERAUTH_REQUEST and INFO_RESPONSE when keyed and admits both after the service request - regress: a userauth request with no service request disconnects - regress: a userauth request pipelined behind the service request still gets SERVICE_ACCEPT, then its answer Issue: wolfSSL#1287
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The state transition correctly resolves the protocol violation and is covered by focused regression tests.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes issue #1287 by enforcing the SSH user-authentication service-request sequence.
Changes:
- Rejects user-auth messages before
ssh-userauthis requested. - Advances server state before processing pipelined authentication.
- Adds regression coverage for rejected and valid pipelined requests.
| File | Description |
|---|---|
src/internal.c |
Gates user-auth messages on service-request state. |
src/ssh.c |
Advances accept state before further reads. |
tests/regress.c |
Tests premature and pipelined authentication. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
The server refuses userauth messages until the ssh-userauth service request is in, RFC 4252 section 1, so a userauth request can no longer draw a SERVICE_ACCEPT for a service the client never asked for.
Issue: #1287