Repository navigation
echoserver: check scp exec, drop root for shell - #1378
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The regression test bypasses shell startup with -f, leaving shell credentials, PTY ownership and access, and prevention of execv() after setup failures unverified.
1 open issue
What changed in this PR
This PR aligns the echoserver’s SCP handling with wolfSSH’s command classifier and makes root-started shells run as the authenticated user.
Changes:
- Use
wolfSSH_ChannelCommandIsScp()to distinguish SCP transfers from other exec requests. - Set terminal ownership and user credentials before starting the shell, exiting on setup failure.
- Add a regression test confirming that
scpbackupis served as an echo session.
| File | Description |
|---|---|
tests/api.c |
Adds and registers the scpbackup exec regression test. |
examples/echoserver/echoserver.c |
Corrects SCP classification and drops shell-child privileges. |
Review effort: Balanced
|
@claude review |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1378
Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 2 of 2 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: Lite
8187435 to
5355176
Compare
wsExecStartCb() now takes an exec request as a transfer only when wolfSSH_ChannelCommandIsScp() does, the same test wolfSSH_accept() diverts on. A command such as "scpbackup" is served as a session. - tests: test_wolfSSH_SCP_ExecNotScp echoes data over a "scpbackup" exec channel Issue: F-14206
When the echoserver runs as root, the forkpty child hands the pty slave to the authenticated user, mode 0620, so the shell can reopen its terminal, then takes that user's groups, gid and uid and closes every descriptor above stderr before it execs the shell. It exits without a shell if any step fails or root can be regained. - configure: check for closefrom(), with a close() loop as fallback - a server that is not root starts the shell as before Issue: F-8857
5355176 to
0fd59cf
Compare
A send callback may return 0 once in a row at any point while file data remains, not only on the metadata call; a return that sends data resets the stall detector. The WS_CallbackScpSend doc and the comment at the stall check in DoScpSource now say so. Issue: F-13331
|
@wolfSSL-Fenrir-bot review max |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1378
Scan targets checked: wolfssh-src, wolfssh-bugs
Not reviewed (no scan target covers them): configure.ac
Coverage: 4 of 4 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

The echoserver takes an exec request as an SCP transfer only when
wolfSSH_ChannelCommandIsScp() does. A root-started server runs the
shell as the logged-in user; SCP and SFTP still run as the server.
and exits if any step fails
point while file data remains, not only on the metadata call
Issue: F-14206, F-8857, F-13331