8069679033
remove unused ssh_string in ssh_channel_open_forward_unix
...
Signed-off-by: Rémi Coulom <remi.coulom@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-07-25 19:52:37 +02:00
c2e9d39dbe
tests: Fix build script to work also on MacOS correctly
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 16:40:56 +02:00
ab44f606b2
tests: Add more valgrind supressions for krb5
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
444982b38a
tests: Avoid needless call to pthread_exit()
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
3df61a4e86
pkd: Cleanup OpenSSL context
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
961c79637c
options: Fix possible memory leaks on error conditions when setting keys for bind
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
7eefbbd478
tests: Cleanup OpenSSL in the forked server processes
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
c4c28c6473
tests: Skip test leaking handle under valgrind
...
This is leaking memory allocated in process_open(), which is stored in the
handles list in the sftpserver session. Given that the data is provided by the
use callbacks, we can not universally free them on our side, but we should, in
the long term, introduce some way for the implementers to free outstanding
handles that were not closed by misbehaving clients.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
08a32ac381
tests: Cleanup OpenSSL in tests when GSSAPI is built
...
also from the fuzzer tests
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
62762bbbc9
Cleanup the loaded pkcs11 provider
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
ab3e08c2b5
Finalize OpenSSL context from tests to make the valgrind output clean
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
809898b980
tests: Adjust valgrind supression to match new calls stack
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
51bd08027e
CentOS 9 and 10 were updated to OpenSSL 3.5
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-25 13:20:15 +02:00
0b4b71cc11
fix(callbacks): make is_callback_valid's behaviour consistent with its name
...
Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-07-24 16:10:54 +02:00
5d3ef7261c
refactor(callbacks): reformat to improve readability
...
Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-07-24 16:10:53 +02:00
9817392e26
pkd: Run hmac-sha1 tests with OpenSSH
...
This was initially in hurry disabled in
ca4c874a9e
because dropbear dropped support for
these HMACs. The follow-up commit enabled running these tests on old dropbear in
c17112f070
, but still did not run them on openssh,
when the new dropbear was installed.
This fixes up the above commit to run the HMAC-SHA1 tests with OpenSSH even if
the new dropbear is installed.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Sahana Prasad <sahana@redhat.com >
2025-07-24 16:09:55 +02:00
168302b9d6
Fix ssh_handle_key_exchange() timeout
...
See libssh-mirror#311 for background. But in some case, it's possible to
trigger the code in ssh_handle_key_exchange() to move session state
directly to SSH_SESSION_STATE_AUTHENTICATED. The exit condition for this
function is SSH_SESSION_STATE_AUTHENTICATING though, so when it happens,
ssh_handle_key_exchange() will time out eventually.
The fix is straightforward. Tested with the problematic
client (trilead-ssh2) and made sure the bad condition happened (and not
cause timeout)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-07-24 13:08:46 +02:00
82c8bbc504
tests: Add missing header file to unbreak build on freebsd
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Sahana Prasad <sahana@redhat.com >
2025-07-24 11:13:35 +02:00
1ea1782036
Add simple sshsig fuzzer
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Sahana Prasad <sahana@redhat.com >
2025-07-24 11:13:34 +02:00
c17112f070
Enable HMAC SHA1 tests for dropbear <2025.87
...
Signed-off-by: abdallah elhdad <abdallahselhdad@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-07-24 10:49:51 +02:00
28c0056bca
Add logging for private API functions
...
Signed-off-by: Nicolas Graves <ngraves@ngraves.fr >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com >
2025-07-10 11:21:44 +02:00
7e4f08e22a
Add logging to public API functions
...
Signed-off-by: Nicolas Graves <ngraves@ngraves.fr >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com >
2025-07-10 11:21:44 +02:00
aeb0b2ec6f
Add unittests for sshsig functions
...
Signed-off-by: Nicolas Graves <ngraves@ngraves.fr >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com >
2025-07-10 11:21:44 +02:00
67cf8e3702
Implement sshsig functions
...
Signed-off-by: Nicolas Graves <ngraves@ngraves.fr >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com >
2025-07-02 14:38:07 +02:00
309f36fa83
pki: Add key_to_type_hash helper
...
Signed-off-by: Nicolas Graves <ngraves@ngraves.fr >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com >
2025-07-02 14:38:07 +02:00
7a2a743a39
fix(string): handle empty string case in ssh_string_copy
...
Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-02 13:58:51 +02:00
ccb8cf88c8
Unbreak torture_config_make_absolute() on OpenBSD
...
The torture_config_make_absolute() and its _no_sshdir() version both
segfault on OpenBSD. The reason for this is that the storage returned
by getpwuid() is backed by mmap and is unapped by the getpwnam() call
in ssh_path_expand_tilde(), so a later access to home segfaults. The
possibility of this happening (getpwnam() overwriting values returned
by getpwuid()) is explicitly called out in POSIX.
A simple fix is to work with copies of username and homedir.
Signed-off-by: Theo Buehler <tb@openbsd.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-07-01 20:50:25 +02:00
b43392c31d
tests(string): add unit tests for ssh_string functions
...
Signed-off-by: Praneeth Sarode <praneethsarode@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-01 20:49:39 +02:00
5fc65e7270
agent: Fix resource leak
...
CID 1611718
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-07-01 20:48:52 +02:00
8310b8cc2b
Remove redundant line and change strlen(buffer) to sizeof(buffer) in examples/authentication.c
...
Signed-off-by: Navid Fayezi <navidfayezi.98@gmail.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-07-01 20:47:55 +02:00
b0063b52d8
Remove more redundant casts
...
Signed-off-by: Navid Fayezi navidfayezi.98@gmail.com
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-01 20:38:03 +02:00
33a947dcb0
Remove unnecessary char* cast in memset call in examples/examples_common.h
...
Signed-off-by: Navid Fayezi navidfayezi.98@gmail.com
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-07-01 20:38:03 +02:00
72c282434b
dh-gex: Reformat the dhgex_server_callbacks structure
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-24 10:14:29 +02:00
ba9642882d
dh-gex.c: Fix typo in the constant name
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-24 10:14:25 +02:00
a6b73219e2
packet: Implement missing packet filter for DH GEX
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-24 10:14:21 +02:00
e2afe196d8
CVE-2025-5372 libgcrypto: Simplify error checking and handling of return codes in ssh_kdf()
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
32833b40bc
libgcrypto: Reformat ssh_kdf()
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
bc4804aa9b
CVE-2025-5987 libcrypto: Correctly detect failures of chacha initialization
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
acb158e827
CVE-2025-5351 pki_crypto: Avoid double-free on low-memory conditions
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
faf9caafc6
pki_crypto: Reformat pki_key_to_blob()
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
8dc29f140b
CVE-2025-4878 legacy: Properly check return value to avoid NULL pointer dereference
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
7501ca1e08
examples: Fix possible pass of NULL into strchr()
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
2eb2af4426
CVE-2025-4878 Initialize pointers where possible
...
This is mostly mechanical change initializing all the pointers I was able to
find with some grep and manual review of sources and examples.
Used the following greps (which yield some false positives though):
git grep " \w* *\* *\w*;$"
git grep " ssh_session \w*;"
git grep " ssh_channel \w*;"
git grep " struct ssh_iterator \*\w*;"
git grep " ssh_bind \w*;"
git grep " ssh_key \w*;"
git grep " ssh_string \w*;"
git grep " ssh_buffer \w*;"
git grep " HMACCTX \w*;"
git grep " SHACTX \w*;"
grep -rinP '^(?!.*=)\s*(?:\w+\s+)*\w+\s*\*\s*\w+\s*;'
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
5d27f69494
string: Reformat
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
6fc1bf6901
session: Reformat ssh_get_publickey_hash
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
a85813e6e6
poll: Reformat ssh_poll_ctx_resize
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
f039edd85d
examples: Reformat sshnetcat.c
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 15:24:30 +02:00
1229ad650b
src: Reformat pki_gcrypt.c
...
clang-format -i pki_gcrypt.c
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2025-06-23 15:24:18 +02:00
937552aed2
pki: Reformat ssh_pki_copy_cert_to_privkey()
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 13:48:16 +02:00
f6709b03e6
misc: Reformat
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2025-06-23 13:48:16 +02:00