Antonio Larrosa
da2c6cc517
* No changes for askpass, see main package changelog for details. - Fix a dbus connection leaked in the logind patch that was missing a sd_bus_unref call (found by Matthias Gerstner): * logind_set_tty.patch - Add a patch that fixes a small memory leak when parsing the subsystem configuration option: * fix-memleak-in-process_server_config_line_depth.patch - Update to openssh 9.8p1: = Security * 1) Race condition in sshd(8) (bsc#1226642, CVE-2024-6387). A critical vulnerability in sshd(8) was present in Portable OpenSSH versions between 8.5p1 and 9.7p1 (inclusive) that may allow arbitrary code execution with root privileges. Successful exploitation has been demonstrated on 32-bit Linux/glibc systems with ASLR. Under lab conditions, the attack requires on average 6-8 hours of continuous connections up to the maximum the server will accept. Exploitation on 64-bit systems is believed to be possible but has not been demonstrated at this time. It's likely that these attacks will be improved upon. Exploitation on non-glibc systems is conceivable but has not been examined. Systems that lack ASLR or users of downstream Linux distributions that have modified OpenSSH to disable per-connection ASLR re-randomisation (yes - this is a thing, no - we don't understand why) may potentially have an easier path to exploitation. OpenBSD is not vulnerable. OBS-URL: https://build.opensuse.org/package/show/network/openssh?expand=0&rev=272
126 lines
3.6 KiB
Diff
126 lines
3.6 KiB
Diff
---
|
|
fips.c | 5 +++++
|
|
kex.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
2 files changed, 65 insertions(+), 1 deletion(-)
|
|
|
|
--- a/fips.c
|
|
+++ b/fips.c
|
|
@@ -48,6 +48,11 @@
|
|
|
|
static int fips_state = -1;
|
|
|
|
+#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
|
+# define FIPS_mode() EVP_default_properties_is_fips_enabled(NULL)
|
|
+# define FIPS_mode_set(x) EVP_default_properties_enable_fips(NULL,x)
|
|
+#endif
|
|
+
|
|
/* calculates HMAC of contents of a file given by filename using the hash
|
|
* algorithm specified by FIPS_HMAC_EVP in fips.h and placing the result into
|
|
* newly allacated memory - remember to free it when not needed anymore */
|
|
--- a/kex.c
|
|
+++ b/kex.c
|
|
@@ -41,6 +41,9 @@
|
|
#include <openssl/crypto.h>
|
|
#include <openssl/dh.h>
|
|
#include <openssl/kdf.h>
|
|
+# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
|
+# include <openssl/core_names.h>
|
|
+# endif
|
|
#endif
|
|
|
|
#include "ssh.h"
|
|
@@ -1191,14 +1194,61 @@ derive_key_via_openssl(struct ssh *ssh,
|
|
{
|
|
struct kex *kex = ssh->kex;
|
|
EVP_KDF_CTX *hashctx = NULL;
|
|
- const EVP_MD *md = NULL;
|
|
u_char *digest = NULL;
|
|
int r = SSH_ERR_LIBCRYPTO_ERROR;
|
|
|
|
+# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
|
+ OSSL_PARAM params[6], *p = params;
|
|
+ char type = (char) id;
|
|
+ EVP_KDF *kdf = EVP_KDF_fetch (NULL, "SSHKDF", NULL);
|
|
+ if (!kdf)
|
|
+ goto out;
|
|
+ hashctx = EVP_KDF_CTX_new (kdf);
|
|
+# else
|
|
+ const EVP_MD *md = NULL;
|
|
hashctx = EVP_KDF_CTX_new_id (EVP_KDF_SSHKDF);
|
|
+# endif
|
|
if (!hashctx)
|
|
goto out;
|
|
|
|
+# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
|
+ switch (kex->hash_alg)
|
|
+ {
|
|
+ case SSH_DIGEST_MD5:
|
|
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
|
|
+ SN_md5, strlen(SN_md5));
|
|
+ break;
|
|
+ case SSH_DIGEST_SHA1:
|
|
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
|
|
+ SN_sha1, strlen(SN_sha1));
|
|
+ break;
|
|
+ case SSH_DIGEST_SHA256:
|
|
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
|
|
+ SN_sha256, strlen(SN_sha256));
|
|
+ break;
|
|
+ case SSH_DIGEST_SHA384:
|
|
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
|
|
+ SN_sha384, strlen(SN_sha384));
|
|
+ break;
|
|
+ case SSH_DIGEST_SHA512:
|
|
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
|
|
+ SN_sha512, strlen(SN_sha512));
|
|
+ break;
|
|
+ default:
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+ *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
|
|
+ sshbuf_ptr(shared_secret), sshbuf_len(shared_secret));
|
|
+ *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SSHKDF_XCGHASH,
|
|
+ hash, (size_t) hashlen);
|
|
+ *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SSHKDF_SESSION_ID,
|
|
+ sshbuf_ptr(kex->session_id), (size_t) sshbuf_len(kex->session_id));
|
|
+ *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_SSHKDF_TYPE,
|
|
+ &type, sizeof(type));
|
|
+ *p = OSSL_PARAM_construct_end();
|
|
+
|
|
+# else
|
|
md = get_openssl_md_for_hash_alg (kex->hash_alg);
|
|
if (!md)
|
|
goto out;
|
|
@@ -1215,6 +1265,7 @@ derive_key_via_openssl(struct ssh *ssh,
|
|
sshbuf_ptr(kex->session_id),
|
|
(size_t) sshbuf_len(kex->session_id)) != 1)
|
|
goto out;
|
|
+# endif
|
|
|
|
digest = calloc (1, need);
|
|
if (!digest) {
|
|
@@ -1222,7 +1273,11 @@ derive_key_via_openssl(struct ssh *ssh,
|
|
goto out;
|
|
}
|
|
|
|
+# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
|
+ if (EVP_KDF_derive (hashctx, digest, need, params) != 1)
|
|
+# else
|
|
if (EVP_KDF_derive (hashctx, digest, need) != 1)
|
|
+# endif
|
|
goto out;
|
|
|
|
*keyp = digest;
|
|
@@ -1233,6 +1288,10 @@ derive_key_via_openssl(struct ssh *ssh,
|
|
if (hashctx)
|
|
EVP_KDF_CTX_free(hashctx);
|
|
|
|
+# if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
|
|
+ EVP_KDF_free(kdf);
|
|
+# endif
|
|
+
|
|
if (digest)
|
|
free(digest);
|
|
|