Skip to content

internal: try the client's key before a password - #1391

Open
ejohnstown wants to merge 2 commits into
wolfSSL:masterfrom
ejohnstown:userauth-method-order
Open

ejohnstown wants to merge 2 commits into
wolfSSL:masterfrom
ejohnstown:userauth-method-order

Conversation

@ejohnstown

@ejohnstown ejohnstown commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

The client picks userauth methods in its own order, publickey, then
keyboard-interactive, then password, as OpenSSH does. The key is offered
once and the others up to three times.

  • a client with nothing left to offer fails with WS_USER_AUTH_E
  • regress covers the order, the fallback and the retry bound
  • wolfsshd answers FAILURE, not a disconnect, to a key or certificate
    refused by policy, so the client can go on to a password

Issue: F-7640

@ejohnstown

Copy link
Copy Markdown
Contributor Author

@claude review

Comment thread apps/wolfsshd/auth.c Resolved

@claude claude 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.

Findings marked 🟡 are optional suggestions and need no follow-up push.

Comment thread src/internal.c Resolved

@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 #1391

Scan targets checked: wolfssh-src, wolfssh-bugs
Not reviewed (no scan target covers them): apps/wolfsshd/test/sshd_permitroot_prohibit_password.sh
Coverage: 7 of 7 in-scope changed file(s) opened by the reviewer

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: Max

A key or certificate refused by policy now gets USERAUTH_FAILURE
instead of a disconnect, as in OpenSSH sshd, so a client that tries
its key first can still go on to a password.

- PubkeyAuthentication no
- a root key under PermitRootLogin forced-commands-only without a
  ForceCommand
- a certificate when a Match block overrides TrustedUserCAKeys, or when
  the build cannot bind it to the user without FPKI or an
  AuthorizedKeysFile

Issue: F-7640
SendUserAuthRequest() picks the method in the client's order,
publickey, then keyboard-interactive, then password, as OpenSSH and
Dropbear do; the server's list only says what is on offer.
DoUserAuthFailure() offers the key once and a password or
keyboard-interactive up to three times.

- a callback success with no public key counts as a decline, and a
  decline is the one key try
- a key the server's signature algorithms rule out is skipped
- a client with nothing left to offer fails with WS_USER_AUTH_E
- drop the TPM-only publickey preference; portfwd asks only for a
  password
- regress: key first, password-only server, fallback, the bound and
  the three-method order

Issue: F-7640
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.

3 participants