Skip to content

internal: refuse an unsolicited INFO_RESPONSE - #1361

Open
ejohnstown wants to merge 1 commit into
wolfSSL:masterfrom
ejohnstown:kb-info-response-state
Open

ejohnstown wants to merge 1 commit into
wolfSSL:masterfrom
ejohnstown:kb-info-response-state

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor

The server takes a keyboard-interactive INFO_RESPONSE only while an
INFO_REQUEST is outstanding, and refuses any other as fatal.

  • WS_AUTH_PENDING keeps the exchange outstanding; a second-round setup
    that would block re-arms it
  • unit and regress tests for unsolicited, declined, and partial rounds

Issue: F-17085

Copilot AI balanced review requested due to automatic review settings November 2, 2026 18:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A post-flush callback error can leave kbSetupPending unset after an INFO_REQUEST is fully delivered, causing a legitimate peer response to be rejected if processing continues.

1 open issue
What changed in this PR

This PR hardens server-side keyboard-interactive authentication by rejecting INFO_RESPONSE messages when no INFO_REQUEST is outstanding.

Changes:

  • Add an outstanding-request check and preserve pending state across blocked authentication callbacks.
  • Add unit coverage for unsolicited responses, completed rounds, and pending retries.
  • Update regression fixtures to mark simulated INFO_REQUESTs as outstanding.
File Description
tests/​unit.c Add response-state and pending-retry tests.
tests/​regress.c Set outstanding-request state in response fixtures.
src/​internal.c Reject unsolicited responses and manage pending exchange state.

Review effort: Balanced

Comment thread src/internal.c Resolved
The server takes a keyboard-interactive INFO_RESPONSE only while an
INFO_REQUEST is outstanding, and refuses any other as fatal, as it
does one outside keyboard-interactive auth. A response kept for
redispatch on WS_AUTH_PENDING keeps the exchange outstanding.

- DoUserAuthInfoResponse() requires kbSetupPending and clears it only
  once the response is consumed, not on WS_AUTH_PENDING
- SendUserAuthKeyboardRequest() arms it once the request is delivered,
  even if the highwater callback then fails; a blocked setup re-arms it
- unit: unsolicited responses after no request, a declined setup, and
  failed or partial rounds; would-block retries; a highwater failure
- regress: the INFO_RESPONSE harness marks the exchange outstanding

Issue: F-17085

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #1361

Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 1 of 3 in-scope changed file(s) opened by the reviewer; not opened: tests/regress.c, tests/unit.c

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Lite

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.

4 participants