The receive loop looks for the newline in scpRecvMsgSz bytes and sets
sz from the newline offset after the loop, so copying scpRecvMsgSz
into sz after each read is never used.
Issue: CID-662317
wolfSSH_stream_read() keeps answering WS_REKEYING while a key exchange
runs, so a transport that dies mid-rekey is reported only by the
wolfSSH_worker() call that drives it. readPeer() now ends the session
on any worker result that is not a session status, instead of spinning.
Issue: CID-662153
HighwaterCheck() hands the application callback's result back through
wolfSSH_SendPacket() into wolfSSH_stream_read(), which returns it as a
byte count. A positive result now comes back as WS_SUCCESS.
- sftp: check buffer_set_size() in SendReadPacket's remainder loop, so
a count over the request ends the read instead of overrunning out
- tests: cover positive and negative callback results in ByteHighwater
Issue: CID-662152
wolfSSL before 5.9.4 applies only the issuing CA's name constraints to
a cert (CVE-2026-89133). Peer chains verify one cert at a time, so a
peer-supplied CA can then issue a leaf outside a trusted CA's namespace.
- configure warns after the summary when certs are on
- internal.h defines WOLFSSH_CERTS_OLD_NAME_CONSTRAINTS for that case
- certman.c raises a #warning from it, or #pragma message under MSVC,
in builds without config.h
Issue: F-13950
ClientPublicKeyCheck() takes a ClientHostCtx with the port as well as
the host. Off port 22 it looks up [host]:port, as OpenSSH writes it,
and takes a bare host line only when no [host]:port line has a key of
that type. The refusal prints the [host]:port line to add.
- a name field may be a comma list or a hashed |1|salt|hash name
- client, scpclient, sftpclient, portfwd and tpmcertclient pass the port
- client-hostkey.test covers port, fallback, comma and hashed names
The plain host key parsers check the blob's name against the negotiated
algorithm; the certificate parsers skipped it. A server could then name
a certificate as a plain key, and a host key callback that reads the
name, as the example clients do, never checked it against the host.
- Test a misnamed chain in test_ParseECCPubKeyCert, and name the P-384
curve mismatch case for P-384
The test quoted the whole wolfsftp command line as one word, so the
shell found no such program and its exit status 127 passed as the
expected refusal. Quote each argument instead, and fail when the client
can't be run.
tpmcertclient links the example client's common code and registers its
host key check, with the -h host as the context. The library verifies
the chain to the -A CA; the check requires the leaf to name the host.
- Test the name check in testsuite.test with keys/ certificates
- Add a tpm-ssh job refusing the certificate when asked for localhost
Issue: F-10588
portfwd links the example client's common code and registers its host
key check, with the SSH server's host name as the context. -Y accepts
any key, with a warning.
- Pass -Y in fwd.test and fwd-bulk.test
- Cover a refused unknown key in client-hostkey.test
Issue: F-10587
The client, scpclient and sftpclient accept a plain host key only when
a "host type key" line of ~/.ssh/known_hosts holds it. An unknown or
changed key is refused, printing its fingerprint and the line to add.
-Y accepts any key, with a warning.
- Check that an x509v3 host certificate names the host by DNS or IP
subjectAltName, or by common name without one; -X waives a mismatch
- Pass -Y in the tests and CI jobs that connect to a throwaway server
- Seed known_hosts for openssh-interop.test from sshd's host keys
- Add client-hostkey.test for unknown, known, stale and changed keys
Issue: F-7620
modes_store() records whether tcgetattr() read the stdin modes.
modes_clear() and modes_reset() do nothing when it did not, and a
failed raw-mode tcsetattr() leaves nothing for modes_reset() to restore.
Issue: CID-661743, CID-661746
GetConfigInt() checks each step against 0x7FFFFFFF, so the value, the
time multiplier and the running total are now int, the same width as
the limit. The return type stays long for the callers.
Issue: CID-661742
wolfSSH_SFTP_buffer_read() now takes its size as a word32, the type of
the buffer size its callers pass, and rejects a size over 0x7FFFFFFF
before it is returned as an int. wolfSSH_SFTP_DoName() also rejects a
read offset past the size, so its size minus idx cannot wrap.
Issue: CID-661741, CID-661744, CID-661745, CID-661747,
CID-661748, CID-661749, CID-661750, CID-661751
ClientPublicKeyCheck() follows StrictHostKeyChecking=ask. A missing or
empty known_hosts has no entries and prompts, creating ~/.ssh with mode
0700 on yes; one it cannot read refuses, as does EOF at the prompt. A
line holding the key accepts wherever it is in the file.
- Size the base64 host key buffer from the blob, so ML-DSA keys fit
- Keep scanning past a stale same-type line for the host
- Check the certificate IP only once known_hosts accepts, and let the
override waive only the IP mismatch
- Cover these in regress.test and sshclient.test
Issue: F-14635, F-15505, F-15508, F-15664
A leaf below a peer-supplied subordinate CA must still meet the name
constraints of the CAs above that CA. The test verifies a three-cert
chain under a constrained root as both server and client. It needs
wolfSSL 5.9.4 or later, but not cert generation.
- keys/nc-*.der: constrained root, CA excluding a subtree, CA, 3 leaves;
gen-nameconstraints.sh regenerates them, configure links them
- leaf in the permitted subtree verifies; leaves outside it and in the
excluded subtree are rejected, alone and within the chain
- wolfSSL must reject each bad leaf with ASN_NAME_INVALID_E, so a
broken fixture cannot pass as a rejection
- add WOLFSSL_V5_9_4 to internal.h
Issue: F-13950
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
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
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
wolfSSH_FwdDefaultActions() serves one forward per session. A
tcpip-forward or direct-tcpip setup that arrives while a listener or
connection is live is refused, and so is a port over 65535, before
anything narrows it to 16 bits. A cancel that lands while a forwarded
connection is open closes only the listener; closing that connection's
channel then frees the slot. server_worker() closes what is left.
- a direct forward whose target hung up may be replaced by a new one
- REMOTE_CLEANUP drops an accepted connection no channel carries yet,
and refuses a cancel while a direct forward is still connecting
- a channel close closes the forwarded connection only once it is
CONNECTED, so a late close of the slot's previous channel spares a
connection still waiting for its own
- a closed forward goes to LISTEN with a listener, else to INIT
- a forwarded connection that ends frees originName; a remote forward
keeps hostName
- a new setup frees stale hostName and originName and clears the
slot's channel id
- server_worker() closes fwdCtx listenFd and appFd at teardown
- api: test_wolfSSH_FwdEchoserverSlot drives an in-process echoserver
through the limit, the port bound, cancel, and a late close, and
reaches the forward over IPv4 even under TEST_IPV6
Issue: F-16817, F-16818
ReceiveScpFile clears scpFileBufferSz before it reads, so an empty file
hands the receive callback a zero-length chunk. A source run leaves the
buffer capacity in that field, and a later sink of an empty file on the
same session passed the whole stale buffer to the callback as data.
- ReceiveScpFile: zero scpFileBufferSz before the early return
- add wolfSSH_TestDoScpSink under WOLFSSH_TEST_INTERNAL
- unit: ScpSinkEmptyFileAfterSource checks the empty-file chunk size
The sink wipes each received chunk once the receive callback has it,
and the source wipes the bytes it has sent. Freeing the buffer wipes
its full DEFAULT_SCP_BUFFER_SZ allocation, since scpFileBufferSz holds
only the last chunk length on the sink side and is zero by teardown.
ReceiveScpFile zeroes the buffer when it allocates it, as ScpSourceInit
does, so no stale heap bytes sit past the received chunk.
- DoScpSink: zero the chunk before resetting scpFileBufferSz
- DoScpSource: zero the sent span after compacting the buffer
- ScpSourceInit, SshResourceFree: zero the whole allocation
- add wolfSSH_TestDoScpSource under WOLFSSH_TEST_INTERNAL
- tests: check the buffer is clear after the SCP rekey transfers
- unit: ScpFileBuffer_zeroedOnFree reads the buffer back after
SshResourceFree and after ScpSourceInit replaces it
Issue: F-8847, F-8844, F-10595
On Windows, ScpNewDir now keeps the name FindFirstFile returns and
FindNextDirEntry hands it out before calling FindNextFile, so the
first directory entry is sent. The path-length check in
ScpProcessEntry measures the entry name it appends.
- add a Windows-only firstEntry buffer to ScpDir
- drop the GetFullPathNameA of the stale fileName buffer
- ScpNewDir refuses a path with no room for the "/*" wildcard
Issue: F-13317, F-13318
As with OpenSSH scp, the client sends the remote path to the server's
shell as given, with "--" before a path starting with "-". A control
character in the path is refused with WS_BAD_ARGUMENT, since it would
end or split the command.
- wolfSSH_SCP_from works on a copy of dst, not the caller's const string
- wolfscp.h: the remote shell expands the path; callers quote it
- scpclient: test only for WS_FATAL_ERROR in the retry loop
- tests: add MakeScpCmd cases, parsed back off Windows, and check
SCP_from leaves dst unchanged
Issue: F-12624, F-13319, F-12546
The default send callback skips a FIFO, socket, device, or a file of
4 GiB or more with a warning. On WS_SCP_CONTINUE, DoScpSource sends a
warning record and asks a recursive walk for its next entry; a skipped
single file or recursive root ends the transfer. As in OpenSSH scp,
both sides fail a transfer after a warning, the source with exit 1.
- wFopenNoFollow opens non-blocking and refuses a non-regular file, so
a single-file FIFO request cannot block
- a callback error goes out as a fatal (0x02) record and stays the
session error; mid-file the transfer is dropped instead
- ReceiveScpMessage handles one record per call and keeps the rest of
the read; a record cut off by EOF also fails the transfer
- the warning is cut to fit the sink's message buffer, and DoScpSource
clears scpFileSz with the other per-file state
- tests: special files, a 4 GiB + 1 file, warning and error records,
skips and unopenable sources on each side, mid-file skips
Issue: F-15503, F-15507
ParseScpCommand stops looking for options once -t or -f has taken the
rest of the command as the path, and skips a "--" before it. A target
with no directory part names a file in the current directory, unless
it names an existing directory, which stays the target as in OpenSSH.
- ScpCheckForRename keeps a bare name whole and uses "." as its base,
and leaves ".", "..", and an existing directory as they are
- GetScpFileMode checks the start index and the full mode field before
reading
- DoScpRequest returns WS_SUCCESS when data follows a finished transfer
- tests: add ParseScpCommand cases, with directory targets and path
checks skipped on Windows, and GetScpFileMode index cases
- scp.test: copy to and from "." in both directions
Issue: F-15504, F-15501, F-11655, F-13320
The built-in NO_FILESYSTEM SCP callbacks now start each file with fresh
state, abort a send whose file name cannot be extracted, and abort a
received file that does not fit the buffer.
- wsScpRecvCallback NEW_FILE terminates the name, sets nameSz and
resets idx and fileSz
- wsScpRecvCallback aborts a file or part larger than the buffer
- wsScpSendCallback resets idx and aborts on an ExtractFileName error
before the status callback and the name compare
- wsScpSendCallback documents that it reports mTime as aTime, since
ScpBuffer has no access time and 0 would stamp the epoch
- tests: two files in one session, a bad peer file name, the reported
times, a reused send buffer and oversize files
Issue: F-11667, F-13902, F-13906
RecvRMDIR answers a path GetAndCleanPath cannot resolve with FAILURE
straight away, as RecvMKDIR does, so the failure log never prints the
unfilled dir buffer.
- TestSftpFailedRequestsAnswered sends RMDIR an over-long path
A server handler that cannot parse its request, because a field runs
past the end of the packet, queues an SSH_FX_BAD_MESSAGE status for the
request id through SFTP_SendBadMessage instead of returning silently.
- Covers REALPATH, OPEN, OPENDIR, MKDIR, RMDIR, REMOVE, READ, WRITE,
READDIR, STAT, LSTAT, FSTAT, SETSTAT, FSETSTAT and CLOSE
- The WRITE handle and RENAME path failures now say BAD_MESSAGE, not
FAILURE
- CLOSE reads its handle length with GetSize
- TestSftpFailedRequestsAnswered sends truncated packets to each handler
RecvRemove keeps the return of WREMOVE, and the Nucleus debug block
compares that against the NUF_* codes instead of ret, which still held
WS_SUCCESS there.
Issue: F-17052
The SFTP server handlers queue an SSH_FXP_STATUS for a request they
refuse, so the client is never left waiting on its request id.
A request's attribute flag bits outside the v3 set are rejected, which
draft-ietf-secsh-filexfer-02 section 5 calls a protocol error; reply
parsing still ignores them.
- OPEN, OPENDIR, MKDIR, REALPATH and REMOVE answer FAILURE for a path
that does not resolve, such as one of WOLFSSH_MAX_FILENAME bytes
- FSTAT and READDIR answer FAILURE for a wrong-size or unknown handle
- READ clamps a length over WOLFSSH_MAX_SFTP_RW to a short read, as
OpenSSH's sftp-server does and filexfer-02 section 3 allows
- OPEN, MKDIR, SETSTAT and FSETSTAT answer BAD_MESSAGE for attributes
that do not parse
- Add TestSftpFailedRequestsAnswered and a REALPATH test hook
Issue: F-17050, F-17051, F-17076, F-17077
ES_ERROR now jumps to an echoserverFail label instead of returning, and
the label frees whatever is set up at that point: the listen socket,
unconsumed option lists, keyboard prompts, doneLock, pwMapList, the CTX,
the TPM host key and wolfSSH_Init(). The test harness keeps running
after echoserver_test() returns, so these were live-process leaks.
- pwMapList and kbAuthData are zeroed on entry; flags track doneLock
and wolfSSH_Init(), each set only once its init succeeds
- usage errors take the same path and keep MY_EX_USAGE
- loop failures free their ssh and thread context before the jump
- drop the inline frees the cert-store and prompt paths now duplicate
- api.c: drive usage, algo-list and key-load failures for LSan; the
key-load case is skipped on Zephyr and Nucleus, which lack -j
Issue: F-17053
A failed automatic negotiation now frees only the VERSION receive
state, leaving the calling operation's state for it to clean up.
wolfSSH_SFTP_ClearState releases what LS, GET, and PUT hold across
calls.
- SFTP_STAT fails with WS_BUFFER_E on a malformed ATTRS reply
- RMDIR returns WS_PERMISSIONS on a permission failure and sets
WS_SFTP_STATUS_NOT_OK for other statuses
- ClearState frees the LS name list and closes the local file of an
interrupted GET or PUT
- tests: unit cases for each, with a guard allocator catching the
write after free and the LS leak
Issue: F-17045, F-17049, F-17046, F-17048
wolfSSL defines wolfSSL_SetAllocators() and wolfSSL_GetAllocators() only
under USE_WOLFSSL_MEMORY, so a wolfSSL built with NO_WOLFSSL_MEMORY or
XMALLOC_USER left unit.test and regress.test unable to link. The
capturing-allocator tests in unit.c and the SFTP allocation-failure
tests in regress.c now also require USE_WOLFSSL_MEMORY.
DoAddIdentity() compares the key-type length against the bytes left
rather than adding it to the offset, so a length near UINT32_MAX can no
longer wrap past the check.
- api.c sends an ADD_IDENTITY reply with a 0xFFFFFFFF key-type length
Issue: F-11937
wolfSSH_AGENT_worker() returns WS_UNIMPLEMENTED_E instead of calling
SendSuccess() and DoMessage() with NULL arguments and claiming success.
It has no callers. SendSuccess() is unused without it, so it joins
SendRequestIdentities() under #if 0.
Issue: F-10562
SendFailure() wipes and frees the reply once it is bundled, as the
other senders do. wolfSSH_AGENT_SignRequest() gets one through
DoUnimplemented() for a reply id it does not handle, and dropped the
pointer at cleanup.
- api.c drives SignRequest with an EXTENSION_FAILURE reply and, under
USE_WOLFSSL_MEMORY, counts allocations across the second exchange
Issue: F-16054
AgentMsgFree() force-zeroes and releases agent->msg, which can hold
key blobs, comments, data to sign and signatures. Every site that freed
agent->msg now goes through it, and the context teardown wipes with
WS_FORCEZERO, which the compiler cannot drop before the free.
- AgentInit() failure path and wolfSSH_AGENT_free() use WS_FORCEZERO
instead of WMEMSET
- api.c: a free hook checks the sign-request message and one left
outstanding at wolfSSH_free() are wiped before release
Issue: F-13999, F-14000
DoGlobalRequestFwd() sets WS_RESOURCE_E for a port-0 tcpip-forward the
callback gave no port for, whether or not a callback is set. Only the
cleanup call stays behind the fwdCb check. The guard is always true on
that path today, so behavior is unchanged; the existing port-0 regress
tests cover it.
Issue: F-10557
DoChannelOpen() refuses a peer CHANNEL_OPEN with OPEN_RESOURCE_SHORTAGE
once WOLFSSH_MAX_CHANNELS channels are open, before allocating anything.
Each channel holds a window-sized buffer, so uncapped forward or agent
opens could exhaust memory. The session stays up after a refusal.
- WOLFSSH_MAX_CHANNELS defaults to 64 and is overridable at build time
- regress test opens channels to the cap, checks the next is refused
and that a close makes room again
- regress tests that open a second channel build only with a cap of at
least 2; below that, TestSecondSessionChannelRejected expects
OPEN_RESOURCE_SHORTAGE
Issue: F-12620
The ubuntu-latest label is moving to Ubuntu 26.04, where the
ubuntu-24.04 .deb bundles are skipped and clang-14/15 have no apt
candidate. Run every workflow that pulls a bundle on ubuntu-24.04.
- runs-on and matrix os entries name ubuntu-24.04
- cache keys carry ubuntu-24.04 so a cache matches its distro
wolfSSH_SFTP_MKDIR() encodes atr with SFTP_SetAttributes(), as the
other attribute-carrying requests do. A NULL atr requests permissions
0777, the request every MKDIR used to send.
- sftpclient: pass NULL instead of an uninitialized atr
- api: a 0700 request makes a 0700 directory on the echoserver
Issue: F-14634
wolfSSH_GetText() builds the text locally and copies it into str, so
str is always terminated and the return is the full text length,
whichever function WSNPRINTF maps to. A return of strSz or more means
truncation; an unknown id or unnegotiated KEX gives "" and 0.
- echoservers: test truncation with ret >= strSz
- api: empty, exact, truncated, and DH texts
Issue: F-17102
wolfSSH_SetTerminalResizeCb() and wolfSSH_SetTerminalResizeCtx() do
nothing for a NULL session, like the other session setters.
- api: NULL and valid session through both setters
Issue: F-17101
DoAsn1Key() encodes a public key into the caller's *out when one is
supplied, as the private-key path already does, and returns WS_BUFFER_E
when *outSz is too small. It allocates only when *out is NULL.
- GetPubKeyOut() picks the buffer for every public-key encoder
- api: RSA, ECC, Ed25519 and ML-DSA-44 reads into a caller buffer, and
one byte short
Issue: F-11652
wolfSSH_SendIgnore() carries buf in the SSH_MSG_IGNORE it sends. A
NULL buf with a zero bufSz still sends 128 zero bytes, and a NULL buf
with a nonzero size is WS_BAD_ARGUMENT. So is a payload whose packet,
with worst-case padding and MAC, would pass the peer's MAX_PACKET_SZ
check; this also keeps the PreparePacket() size sums from wrapping.
- internal: MAX_IGNORE_DATA_SZ bounds the payload like the peer check
- regress: check the payload and the NULL default on the wire
- regress: 0xFFFFFFFB and one over the bound fail cleanly
- regress: the largest payload reaches a peer, plain and keyed, with
the byte highwater off so a low DEFAULT_HIGHWATER_MARK cannot rekey
Issue: F-7512
DoReceive() wipes a packet that DoPacket() refuses before dispatch: a
message id the state does not allow, such as a USERAUTH_REQUEST after
auth, padding under the minimum, or a length that overflows. Only a
pending auth keeps its packet, since the next call dispatches it again.
- tests: a post-auth password request and a short-padding packet are
wiped; a pending password request is kept until it completes
Issue: F-17105
DefaultUserAuth() holds a failed attempt to a per-user minimum, modeled
on OpenSSH sshd: 5 ms plus up to 4.29 ms from a keyed hash of the
username, doubled while the time already spent exceeds it, and skipped
past 5 s. It sleeps and rechecks until the minimum has passed. The
library itself stays non-blocking.
- wolfSSHD_AuthInit() draws the per-daemon key before any fork
- the hash is SHA-256, else SHA-512 or SHA-384; with none, the floor
- Windows times the wait with QueryPerformanceCounter
- tests for the delay range, the doubling, an early-waking sleep, and
a failing request
Issue: F-11938
The client pads a password USERAUTH_REQUEST and a keyboard-interactive
INFO_RESPONSE up to a multiple of 64 bytes, as OpenSSH does, so the
packet length no longer tracks the secret's length to the cipher block.
- BundlePacketPad() adds whole blocks of padding up to a bucket
- a packet held during our rekey keeps its bucket in keyingHold and is
padded to it on release
- regress test checks 1 to 64 byte secrets over the none cipher,
AES-CTR with HMAC, and AES-GCM, sent directly and after a hold
Issue: F-13390
With WOLFSSH_ALLOW_NONE_CIPHER, a server whose NEWKEYS installed the
none cipher in either direction answers password and
keyboard-interactive requests, and an INFO_RESPONSE after a rekey to
none, with USERAUTH_FAILURE before the userauth callback sees a secret,
and leaves both methods out of the method list.
- DoNewKeys() and SendNewKeys() record a none cipher per direction
- a refused request or response clears authId, so a later INFO_RESPONSE
is rejected
- unit tests drive both methods with each direction cleartext, and a
rekey to none with a prompt outstanding
Issue: F-10578