1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2026-10-24 03:48:55 +03:00
Commit Graph

6695 Commits

Author SHA1 Message Date
Pavol Žáčik
77da3e02af libssh 0.12.1
Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
libssh-0.12.1
2026-07-16 11:51:04 +02:00
Jakub Jelen
770eafb74b CVE-2026-15370 tests: verify the SFTP longname is in expected format
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit 31fe9efb21)
2026-07-16 11:51:04 +02:00
Jakub Jelen
4f0c400929 CVE-2026-15370 sftpserver: Avoid stack buffer overrun while processing long filenames
Backported from commit b2065f71c9
and commit 347c69d278.

Reported by Tristan.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2026-07-16 11:51:04 +02:00
Pavol Žáčik
f2f1078d6d CVE-2026-59851 tests: add gssapi authentication tests with user mismatching the principal
Without any special configuration (e.g., in ~/.k5login), we should not
expect the principal alice@REALM to be able to authenticate as bob
against either sshd or a libssh server.

Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 098b427c87)
2026-07-16 11:51:04 +02:00
Pavol Žáčik
05d0fe43b5 CVE-2026-59851 test_server: add a better gssapi auth callback
The callback should check whether the principal
is authorized to log in as the user; krb5_kuserok
does exactly that.

Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 114b0dfc23)
2026-07-16 11:51:04 +02:00
Pavol Žáčik
73225a1774 CVE-2026-59851 gssapi-keyex: add a missing server callback dispatch
Like gssapi-with-mic, gssapi-keyex also requires
the server to decide whether the client that's
obtained a valid ticket for a specific principal
is authorized to log in under the requested user,
otherwise any client with a valid ticket would
be able to log in as an arbitrary local user.

Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit a45d20b752)
2026-07-16 11:51:04 +02:00
Jakub Jelen
7edddfc580 CVE-2026-59850 tests: Verify sending data after close does not trigger callbacks
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit 8784a20c59)
2026-07-16 11:51:04 +02:00
Jakub Jelen
7dfabb1fd2 CVE-2026-59850 channels: Avoid processing DATA packets on closed channels
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit a8a3fa352b)
2026-07-16 11:51:04 +02:00
Jakub Jelen
a540e27659 CVE-2026-59849 tests: Reproducer for infinite loops with non-default configurations
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit ba96c3c213)
2026-07-16 11:51:04 +02:00
Jakub Jelen
2a40a20b49 CVE-2026-59849 auth: Fix state machine to aovid infinite loop
After going through the whole list of certificates, the iterator was
set to NULL and at the beginning of the next loop reset to the start
of the list again, which caused infinite loop.

Adding one more intermediate state solves the issue.

Found by AISLE in partnership with Red Hat

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit bcfa191283)
2026-07-16 11:51:04 +02:00
Jakub Jelen
d9fef838e2 CVE-2026-59849 auth: Move certificate iterator on failure to prevent infinite loop
The loop will be infinite only when the server will not drop the connection
after infinite amount of pubkey auth requests.

Found by AISLE in partnership with Red Hat

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit bb96432364)
2026-07-16 11:51:04 +02:00
Pavol Žáčik
e3dc89de97 CVE-2026-59848 sftp: Initialize sftp_request_queue ptr in sftp_free
Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 00876f7658)
2026-07-16 11:51:04 +02:00
Pavol Žáčik
9563afc950 CVE-2026-59848 sftp: handle responses with unknown request IDs
This adds a new field to sftp_session_struct,
containing a list of outstanding request IDs.
An ID is added to the list when a request
is constructed and removed when the corresponding
request is received. If a client receives a response
with an unknown request ID, it reports an error.

Storing responses with unknown request IDs in
the response queue could be abused by a malicious
SFTP server which could deplete client memory
this way.

Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 26147eb476)
2026-07-16 11:51:04 +02:00
Jakub Jelen
d4847509b7 CVE-2026-59847 libcrypto: Fix symmetric issue during encryption
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit a5173c6ad2)
2026-07-16 11:51:04 +02:00
Jakub Jelen
c483a18735 CVE-2026-59847 libcrypto: Fix tag verification of AES-GCM ciphers
EVP_DecryptFinal() returns 0 errors, which was wrongly checked since
its introduction.

Reported by Ben Smyth discuss@bensmyth.com

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit 6d6cb6cb4d)
2026-07-16 11:51:04 +02:00
Jakub Jelen
2e74267b03 CVE-2026-59846 Block shell metacharacters from usernames
When an attacker could sneak the dollar sign or backslash into the username
expanded for example in proxy command, it can result in printing environment
variables that might contain secrets.

This is a fixup of CVE-2023-6004 which fixed this for hostnames, but these
two metacharacters were left out from the username filter.

This keeps the list in one place to simplify maintenance.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit 6309df220e)
2026-07-16 11:51:04 +02:00
Jakub Jelen
53b8152623 CVE-2026-59845 socket: Properly check fork() return code
During execution of proxy command, when fork() fails, its return value
is stored in pid and when the parent process attempts to kill it,
it sends the kill signal to all processes the calling application has
access to (except for init).

This caused nard to debug issues when the system under the load was hitting
fork failures, which resulted in killing of all the system processes
(of given user).

Reported and first patch iteration provided by: Halil Oktay (oblivionsage).

This code missing fork return value check is in libssh since 2010
(f31a14b793), but this issue is exploitable only
since libssh 0.9.0 as previously there was no implementation of killing
ProxyCommand children.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit 92b6fb9c5e)
2026-07-16 11:51:04 +02:00
Pavol Žáčik
2544f22733 CVE-2026-59844 sftpserver: cap accepted values of len in SSH_FXP_READ
The client-provided length is directly used in
a malloc in process_read(), so not restricting it
leads to allocations bounded only by UINT32_MAX.

The new cap is the same as the one currently used
by OpenSSH.

Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 6dba2e06f0)
2026-07-16 11:51:04 +02:00
Pavol Žáčik
5568ae6c5a CVE-2026-59842 kex-gss: Add missing length checks of peer Curve25519 keys
Receiving a short Curve25519 public key would cause an
out-of-bounds read, potentially leaking small amounts
of heap data if an attacker sends a prefix of
a valid public key and the key exchange succeeds.

Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit ed9109dfc6)
2026-07-16 11:51:04 +02:00
Jakub Jelen
529c30c34a ci: Remove explicit macos image requirement
The gitlab removed macos 14 which resulted in failures. Instead of updating
and manually tracking specific macos version, we can leave the tag out to
keep up using the latest version.

https://docs.gitlab.com/ci/runners/hosted_runners/macos/#supported-macos-images

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/852>
(cherry picked from commit 60a4cd2b1a)
2026-07-13 17:34:36 +02:00
Jakub Jelen
348bff0323 Prevent memory leaks with repeated subsystem requests or channel requests
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/849>
(cherry picked from commit 7817e356a9)
2026-07-10 10:03:05 +02:00
Jakub Jelen
ce49129afd sftp: Harmonize return values from sftp server callbacks
Terminate also the SFTP server when the fatal error comes from the message
handlers.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/849>
(cherry picked from commit 1726018198)
2026-07-10 10:03:05 +02:00
Jakub Jelen
162fafbe34 tests: Verify repeated SFTP INIT messages are not allowed and negotiation works correctly
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/849>
(cherry picked from commit 4a6634739c)
2026-07-09 18:03:02 +02:00
Jakub Jelen
086f1ec88c sftp: Avoid handling repeated INIT messages
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/849>
(cherry picked from commit 9c11f84b3c)
2026-07-09 18:01:41 +02:00
Jakub Jelen
bfe25c6dde sftpserver: Send right version based on the client one
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/849>
(cherry picked from commit 6d2b270701)
2026-07-09 18:00:32 +02:00
Jakub Jelen
f347062fd9 tests: Verify we get expected SFTP version on server and client
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/849>
(cherry picked from commit ac1f059f70)
2026-07-09 17:58:12 +02:00
Jakub Jelen
63672a491e sftpserver: Avoid double converting version number
Fixes: #369

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/849>
(cherry picked from commit 35d1f96d8d)
2026-07-09 17:57:59 +02:00
Jakub Jelen
b9b43a0171 ci: Allow mbedtls 4.x build to fail temporarily
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/849>
(cherry picked from commit 576300419c)
2026-07-09 17:57:41 +02:00
Jiami Lin
4eb486dc09 packet: avoid logging uninitialized sequence number
ssh_packet_unimplemented() tries to unpack the uint32 sequence number from SSH_MSG_UNIMPLEMENTED. If the packet payload is malformed and does not contain the full sequence number, ssh_buffer_unpack() fails, but the function still logs seq. Return after the failed unpack so the uninitialized local variable is not formatted into the log message.

Signed-off-by: Jiami Lin <jiami3us@icloud.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/834>
(cherry picked from commit 9075952491)
2026-07-09 17:54:34 +02:00
David Cermak
0417a744b5 string: Made ssh_string_new() to zero-init payload on creation
Additional hardening realated to 3ce8bf3289 fix that
switches ssh_string_new() to calloc() so the payload bytes
are zero-initialised. ssh_string is used throughout libssh as a
byte container for wire data and crypto material; the uninitialised
payload is never semantically meaningful, and zeroing it kills the
"forgot to check read_len" class of bugs at the source.

Signed-off-by: David Cermak <d_cermak@centrum.cz>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/829>
(cherry picked from commit d94a96bf23)
2026-07-09 17:53:58 +02:00
Jakub Jelen
bcd8b9460b Fix semantics of strchr() for C23
In c23, strchr finally returns const char for const char pointers, which broke
CI after updating to Fedora 44 (gcc 16). The same issue surfaced on tumbleweed.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/830>
(cherry picked from commit bc3c8181e1)
2026-07-09 17:53:45 +02:00
Jakub Jelen
407d4f8141 tests: Implement code coverage for ssh_userauth_kbdint_getprompt()
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/827>
(cherry picked from commit 23b406f48e)
2026-07-09 17:52:52 +02:00
Jakub Jelen
04330f3ea2 auth: Avoid off-by-one overflow during kbdint authentication
Based on incomplete !754

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/827>
(cherry picked from commit 45cd13469c)
2026-07-09 17:50:48 +02:00
Colin Baumgarten
3d59361dc2 torture_packet: Improve checking of ssh_packet_socket_callback() return value
ssh_packet_socket_callback() will not return error codes like
SSH_ERROR on failure. Instead it will always return an unsigned
size_t value representing the number of bytes which have been
processed.

So adjust the assert in the test accordingly, making sure that all
input bytes have actually been processed.

Signed-off-by: Colin Baumgarten <colin.baumgarten@hubersuhner.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/824>
(cherry picked from commit a33da974ef)
2026-07-09 17:50:41 +02:00
Colin Baumgarten
61eea4c72b packet: Avoid redundant recursive calls in the socket data callback
After processing a packet and before returning the processed size,
ssh_packet_socket_callback() recursively calls itself if there are
still unprocessed bytes remaining in the socket buffer.

This is redundant because this function is already called in a loop
by its only caller until the socket buffer is drained or only a
partial packet remains.

The recursive call was introduced with c92f54102e at a time
where ssh_packet_socket_callback() was not yet called in a loop.
The loop was only introduced later by 186116f34a.

So remove the redundant recursive call, but leave a log message in
place to allow following packet processing from the logs.

Signed-off-by: Colin Baumgarten <colin.baumgarten@hubersuhner.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/824>
(cherry picked from commit 655601d357)
2026-07-09 17:50:31 +02:00
Colin Baumgarten
7c5da6dfd9 packet: Fix socket data callback return value on rekey failure
Both callers of ssh_packet_socket_callback() assume that it will
always return the number of bytes processed. They don't properly
handle negative return values like SSH_ERROR, even though the
function's doc-comment mentions them.

Handling negative values would not be straightforward because
the return type is unsigned (size_t).

So instead of fixing the callers, adjust the only place where a
negative value is returned right now (rekey failure) and align
it with the handling of all other possible errors in the same
function.

Signed-off-by: Colin Baumgarten <colin.baumgarten@hubersuhner.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/824>
(cherry picked from commit 1bd5c2b043)
2026-07-09 17:50:25 +02:00
Jakub Jelen
a128a3da8f dh-gex: Add missing goto error
Originally reported by Saransh Rana.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/825>
(cherry picked from commit 322b456790)
2026-07-09 17:50:19 +02:00
Pavol Žáčik
e3ec71152c gssapi: fail if the selected OID is not in client-supplied OIDs
This should not happen because the OID is selected
from a subset of client-supplied OID in gss_acquire_cred,
i.e., it would imply a bug in krb5. But better be safe,
it would later cause an out-of-bounds read in
ssh_gssapi_send_response.

Reported and patch provided by Meta (vulns@meta.com).

Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 81a7e92c44)
2026-07-09 17:50:06 +02:00
Nuhiat-Arefin
ffd06b1cd0 fix: initialize known_hosts output entry
ssh_session_get_known_hosts_entry() could return SSH_KNOWN_HOSTS_OK without initializing *pentry, leaving callers with an undefined output pointer.

Initialize *pentry to NULL at function entry so every return path leaves the output in a defined state.

Signed-off-by: Nuhiat-Arefin <nuhiatarefin@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/814>
(cherry picked from commit 6cd0e6e52a)
2026-07-09 17:49:35 +02:00
Jakub Jelen
49df3fa0dc channels: Avoid remote window overflow
Reported-by: Rinku Das <rinkudaskajal7857@gmail.com>
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit d0f5747ab7)
2026-07-09 17:48:46 +02:00
Jakub Jelen
69fb4bd006 sftpserver: Check return value of sftp_client_message_get_filename()
Originally reported by nevv.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit 5eb9e6896e)
2026-07-09 17:48:39 +02:00
Pavol Žáčik
fea3f9772f hybrid_mlkem: Fix incomplete error handling of short ML-KEM keys
Reported by Haruki Oyama.

Independently reported by Vulnerability Disclosure <vulns@meta.com>

Signed-off-by: Pavol Žáčik <pzacik@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 3ce8bf3289)
2026-07-09 17:47:47 +02:00
Jakub Jelen
8e67e58b1f kex: Allow MLKEM key exchanges in FIPS mode
Based on stale MR !802 and implementation in Fedora OpenSSH

Closes #356

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/821>
(cherry picked from commit 458d649594)
2026-07-09 17:46:04 +02:00
Jakub Jelen
7faa2e3b1d packet: Avoid hidden integer underflow
Originally reported by Brian Carpenter b@deepforkcyber.com

Based on the never complted MR !724

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/819>
(cherry picked from commit 49ad84283e)
2026-07-09 17:45:48 +02:00
Jakub Jelen
a6b1d2650e sftpserver: Avoid NULL pointer dereference on wrong initialization
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Pavol Žáčik <pzacik@redhat.com>
(cherry picked from commit dce230e49d)
2026-07-09 17:45:29 +02:00
Manas Trivedi
9e8ba7887f sftp: set missing error codes in sftp_init failure paths
Ensure ssh and sftp error codes are consistently set across all
failure paths in sftp_init(). One branch previously returned
-1 leading to ambiguous error reporting.

Signed-off-by: Manas Trivedi <manas.trivedi.020@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 8dc59ae8ac)
2026-07-09 17:44:43 +02:00
Jakub Jelen
4f5d675a11 dh: Validate peer public key
The RFC 4253, Section 8 says that the

   Values of 'e' or 'f' that are not in the range [1, p-1] MUST NOT be
   sent or accepted by either side.  If this condition is violated, the
   key exchange fails.

Originally reported by Oren Yomtov

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Aris Adamantiadis <aris@0xbadc0de.be>
(cherry picked from commit d8ccda1d6f)
2026-07-09 17:44:11 +02:00
Manas Trivedi
71bee76876 tests: add coverage for NULL session in ssh_channel_is_open
Signed-off-by: Manas Trivedi <manas.trivedi.020@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 9f7c596ca5)
2026-07-09 17:42:37 +02:00
Manas Trivedi
beca34289e channels: add NULL session check in ssh_channel_is_open
Prevent potential NULL pointer dereference when accessing
channel->session->alive.

Signed-off-by: Manas Trivedi <manas.trivedi.020@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 34bbb48561)
2026-07-09 17:42:32 +02:00
Colin Baumgarten
ca5b7dad4d sftpserver: Fix client messages being ignored if sent at a high rate
When using OpenSSH scp to read files larger than a few hundred
kilobytes, downloads stall and never finish. A workaround is to
pass -Xnrequests=1 to scp, which will cause scp to only do a
single concurrent SFTP read request at a time.

The cause for the problem is that if SFTP client messages are
received at a high rate, sftp_channel_default_data_callback() will
potentially be called with multiple messages in the incoming data
buffer, but only the first message will be extracted and handled.

So add a loop to extract as many SFTP client messages as available
from the incoming data buffer.

Signed-off-by: Colin Baumgarten <colin.baumgarten@hubersuhner.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 3154a4ab8d)
2026-07-09 17:42:13 +02:00