Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
openssh-testuser.26950
openssh-CVE-2020-14145-information-leak.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openssh-CVE-2020-14145-information-leak.patch of Package openssh-testuser.26950
From 5d48e59d4d9044fd3e658b616516178a561d2fbc Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson <hpj@suse.com> Date: Wed, 26 Oct 2022 10:01:45 +0200 Subject: [PATCH] openssh-CVE-2020-14145-information-leak --- sshconnect2.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/sshconnect2.c b/sshconnect2.c index a2ea8336..085478cc 100644 --- a/sshconnect2.c +++ b/sshconnect2.c @@ -99,12 +99,25 @@ verify_host_key_callback(Key *hostkey, struct ssh *ssh) return 0; } +/* Returns the first item from a comma-separated algorithm list */ +static char * +first_alg(const char *algs) +{ + char *ret, *cp; + + ret = xstrdup(algs); + if ((cp = strchr(ret, ',')) != NULL) + *cp = '\0'; + return ret; +} + static char * order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) { - char *oavail, *avail, *first, *last, *alg, *hostname, *ret; + char *oavail = NULL, *avail = NULL, *first = NULL, *last = NULL; + char *alg = NULL, *hostname = NULL, *ret = NULL, *best = NULL; size_t maxlen; - struct hostkeys *hostkeys; + struct hostkeys *hostkeys = NULL; int ktype; u_int i; @@ -116,6 +129,26 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) for (i = 0; i < options.num_system_hostfiles; i++) load_hostkeys(hostkeys, hostname, options.system_hostfiles[i]); + /* + * If a plain public key exists that matches the type of the best + * preference HostkeyAlgorithms, then use the whole list as is. + * Note that we ignore whether the best preference algorithm is a + * certificate type, as sshconnect.c will downgrade certs to + * plain keys if necessary. + */ + best = first_alg(options.hostkeyalgorithms); + if (lookup_key_in_hostkeys_by_type(hostkeys, + sshkey_type_plain(sshkey_type_from_name(best)), NULL)) { + debug3("%s: have matching best-preference key type %s, " + "using HostkeyAlgorithms verbatim", __func__, best); + ret = xstrdup(options.hostkeyalgorithms); + goto out; + } + + /* + * Otherwise, prefer the host key algorithms that match known keys + * while keeping the ordering of HostkeyAlgorithms as much as possible. + */ oavail = avail = xstrdup(KEX_DEFAULT_PK_ALG); maxlen = strlen(avail) + 1; first = xmalloc(maxlen); @@ -144,6 +177,8 @@ order_hostkeyalgs(char *host, struct sockaddr *hostaddr, u_short port) if (*first != '\0') debug3("%s: prefer hostkeyalgs: %s", __func__, first); + out: + free(best); free(first); free(last); free(hostname); -- 2.38.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor