Skip to content

wolfsshd: fix two auth.c defects - #1389

Merged
philljj merged 2 commits into
wolfSSL:masterfrom
ejohnstown:sshd-auth-cleanup
Nov 12, 2026
Merged

philljj merged 2 commits into
wolfSSL:masterfrom
ejohnstown:sshd-auth-cleanup

Conversation

@ejohnstown

Copy link
Copy Markdown
Contributor
  • SetupUserTokenWin frees its WCHAR user name copy on every path
  • CheckPasswordPAM matches the callback type, so --with-pam builds

Issue: F-8854, F-11676

SetupUserTokenWin frees its WCHAR copy of the user name in the common
cleanup with authInfo and the LSA handle, so a public key probe no
longer leaks it on Windows.

Issue: F-8854
CheckPasswordPAM takes the WOLFSSHD_AUTH argument that
CallbackCheckPassword requires, so a --with-pam build compiles again.
It is still a stub and returns WSSHD_AUTH_FAILURE for every password.

Issue: F-11676
@ejohnstown

Copy link
Copy Markdown
Contributor Author

@claude review

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

I reviewed this PR and found no bugs. Both fixes look correct, but the file is wolfsshd's authentication code, so a human look is still worthwhile.

What was reviewed:

  • The new CheckPasswordPAM signature matches CallbackCheckPassword in auth.h, which it is assigned to at auth.c:3305. WSSHD_AUTH_FAILURE is defined as 0, so the stub returns the same value as before (it still refuses every password). The change only makes the intent explicit.
  • usrW in SetupUserTokenWin starts as NULL and is allocated with WMALLOC(..., NULL, DYNTYPE_SSHD), which matches the new WFREE. Every path reaches the single cleanup block and nothing else frees it, so it can't be freed twice.
  • Not done: a --with-pam or Windows build. This review only read the code.
Extended reasoning...

The change touches only apps/wolfsshd/auth.c: the PAM password stub gets a corrected signature, and a Windows public-key token helper stops leaking a buffer. Both are in the SSH daemon's authentication path, which is security-sensitive, and the approval guidelines exclude auth code from auto-approval. The stub still returns 0 (WSSHD_AUTH_FAILURE) as before, so no auth decision changes. The free matches the allocation's heap and type and runs exactly once. Neither changed path is compiled in a default Linux build, so neither was build-checked here.

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

Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 1 of 1 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

@philljj
philljj merged commit a4a6514 into wolfSSL:master Nov 12, 2026
223 checks passed
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