wolfsshd: bind certificate auth to user, fail closed without FPKI#1019
Open
yosuke-wolfssl wants to merge 1 commit into
Open
wolfsshd: bind certificate auth to user, fail closed without FPKI#1019yosuke-wolfssl wants to merge 1 commit into
yosuke-wolfssl wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a certificate-authentication default that could allow a CA-signed client certificate to authenticate as an arbitrary requested SSH username when AuthorizedKeysFile is unset and the build lacks WOLFSSL_FPKI. The change ensures certificate authentication is bound to the requested user (via UPN parsing under FPKI), and otherwise fails closed.
Changes:
- Split the CA-only certificate-auth path in
wolfsshdto explicitly allow Windows token mapping, allow FPKI builds (UPN already checked), and reject non-Windows non-FPKI builds withoutAuthorizedKeysFile. - Update the scheduled X.509 interop workflow to build wolfSSL with
--enable-all(enablingWOLFSSL_FPKI) and add a negative test ensuring a cert forfredcannot authenticate asotheruser.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/wolfsshd/auth.c | Fail-closed behavior for CA-only certificate auth when no user-binding mechanism is available (non-Windows, non-FPKI, no AuthorizedKeysFile). |
| .github/workflows/x509-interop.yml | CI updated to exercise the secure binding path (WOLFSSL_FPKI) and add a regression negative-auth test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1019
Scan targets checked: wolfssh-bugs, wolfssh-src
No new issues found in the changed files. ✅
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.
wolfsshd: bind certificate auth to the requested user (fail closed without FPKI)
Summary
Fixes a high-severity authentication-defaults issue addressed by f_4578: on the
wolfSSHd certificate public-key path, a CA-signed certificate was accepted as
any requested SSH username when
AuthorizedKeysFilewas unset and the builddid not define
WOLFSSL_FPKI. The username-to-certificate binding(UPN-vs-username) is only compiled under
WOLFSSL_FPKI, which is off by default,so a default build using
TrustedUserCAKeyswould let any cert signed by thetrusted CA log in as
rootor any other user.This binds the certificate to the requested user on the CA-only path and fails
closed when no binding mechanism is available.
Changes
apps/wolfsshd/auth.c—RequestAuthentication()The CA-only certificate branch (cert present, no
AuthorizedKeysFile) is splitinto three explicit cases:
WIN32SetupUserTokenWin(unchanged)WOLFSSL_FPKIWOLFSSH_USERAUTH_REJECTEDWithout FPKI the certificate UPN/principal cannot be read, so the requested user
cannot be bound to the certificate. The operator must either build wolfSSL with
FPKI (UPN binding) or set
AuthorizedKeysFile(per-user key/cert mapping viacheckPublicKeyCb).Note:
WOLFSSL_FPKI(wolfSSL, enables UPN parsing in auth.c) andWOLFSSH_NO_FPKI(wolfSSH, skips certman's strict FASCN profile) areindependent; an FPKI-enabled wolfSSL with
-DWOLFSSH_NO_FPKIgets UPN bindingwithout requiring full FPKI profile extensions on the certificate.
.github/workflows/x509-interop.ymlThe scheduled interop job built wolfSSL without FPKI and authenticated
fredvia the CA-only path, so the auth change would have rejected it. Updated so the
interop job validates the secure binding path instead:
--enable-all(definesWOLFSSL_FPKI, enabling theUPN-vs-username binding).
-DWOLFSSH_NO_FPKIon the wolfSSHd build so the strict FPKI profile(FASCN) is not required of the
fredtest certificate....-all-...) so the new build config is notmasked by a stale cached (non-FPKI) wolfSSL.
fredmust not authenticateas a different user (
otheruser). The assertion requires the failure to be anauthentication denial (
Permission denied), so an unrelated ssh/transporterror cannot masquerade as a passing negative test.
Security impact
Before: any certificate signed by
TrustedUserCAKeyscould authenticate as anyusername on a default (non-FPKI) build with no
AuthorizedKeysFile.After: certificate auth requires the requested username to be bound to the
certificate (UPN under FPKI, or
AuthorizedKeysFilemapping); otherwise it isrejected.
Compatibility
This is a behavior change for non-Windows, non-FPKI deployments that relied on
CA-only certificate auth without
AuthorizedKeysFile— such logins now failclosed. Affected operators should enable FPKI or configure
AuthorizedKeysFile.Verification
--enable-all/ default): builds clean with-Werror.-Werror; confirmedonly the fail-closed reject branch is emitted (UPN block excluded).
apps/wolfsshd/test/test_configuration): no new failures(the one pre-existing
test_CheckPasswordHashUnixfailure is an unrelatedmacOS
crypt()quirk, reproduced on the unmodified tree).