Added upstream patches to fix the CVE
- ported the patches as they were not directly applicable
Change-Id: I9436e840d899dc0faa03a0d3933b7ca9fe1739fe
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6690
Tested-by: michellew <michellew@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,143 @@ |
| 0 |
+From 779974d35b4859c07bc3cb8a12c74b43b0a7d1e0 Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: djm <djm@openbsd.org> |
|
| 2 |
+Date: Tue, 31 Jul 2018 03:10:27 +0000 |
|
| 3 |
+Subject: [PATCH] =?UTF-8?q?delay=20bailout=20for=20invalid=20authenticatin?= |
|
| 4 |
+ =?UTF-8?q?g=20user=20until=20after=20the=20packet=20containing=20the=20re?= |
|
| 5 |
+ =?UTF-8?q?quest=20has=20been=20fully=20parsed.=20Reported=20by=20Dariusz?= |
|
| 6 |
+ =?UTF-8?q?=20Tytko=20and=20Micha=C5=82=20Sajdak;=20ok=20deraadt?= |
|
| 7 |
+MIME-Version: 1.0 |
|
| 8 |
+Content-Type: text/plain; charset=UTF-8 |
|
| 9 |
+Content-Transfer-Encoding: 8bit |
|
| 10 |
+ |
|
| 11 |
+--- |
|
| 12 |
+ auth2-gss.c | 11 +++++++---- |
|
| 13 |
+ auth2-hostbased.c | 11 ++++++----- |
|
| 14 |
+ auth2-pubkey.c | 25 +++++++++++++++---------- |
|
| 15 |
+ 3 files changed, 28 insertions(+), 19 deletions(-) |
|
| 16 |
+ |
|
| 17 |
+diff --git a/auth2-gss.c b/auth2-gss.c |
|
| 18 |
+index 1ca8357..eb9ee39 100644 |
|
| 19 |
+--- a/auth2-gss.c |
|
| 20 |
+@@ -1,4 +1,4 @@ |
|
| 21 |
+-/* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 markus Exp $ */ |
|
| 22 |
++/* $OpenBSD: auth2-gss.c,v 1.29 2018/07/31 03:10:27 djm Exp $ */ |
|
| 23 |
+ |
|
| 24 |
+ /* |
|
| 25 |
+ * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. |
|
| 26 |
+@@ -68,9 +68,6 @@ userauth_gssapi(Authctxt *authctxt) |
|
| 27 |
+ u_int len; |
|
| 28 |
+ u_char *doid = NULL; |
|
| 29 |
+ |
|
| 30 |
+- if (!authctxt->valid || authctxt->user == NULL) |
|
| 31 |
+- return (0); |
|
| 32 |
+- |
|
| 33 |
+ mechs = packet_get_int(); |
|
| 34 |
+ if (mechs == 0) {
|
|
| 35 |
+ debug("Mechanism negotiation is not supported");
|
|
| 36 |
+@@ -109,6 +106,12 @@ userauth_gssapi(Authctxt *authctxt) |
|
| 37 |
+ return (0); |
|
| 38 |
+ } |
|
| 39 |
+ |
|
| 40 |
++ if (!authctxt->valid || authctxt->user == NULL) {
|
|
| 41 |
++ debug2("%s: disabled because of invalid user", __func__);
|
|
| 42 |
++ free(doid); |
|
| 43 |
++ return (0); |
|
| 44 |
++ } |
|
| 45 |
++ |
|
| 46 |
+ authctxt->methoddata = (void *)ctxt; |
|
| 47 |
+ |
|
| 48 |
+ packet_start(SSH2_MSG_USERAUTH_GSSAPI_RESPONSE); |
|
| 49 |
+diff --git a/auth2-hostbased.c b/auth2-hostbased.c |
|
| 50 |
+index 1b3c3b2..1ec2cce 100644 |
|
| 51 |
+--- a/auth2-hostbased.c |
|
| 52 |
+@@ -1,4 +1,4 @@ |
|
| 53 |
+-/* $OpenBSD: auth2-hostbased.c,v 1.26 2016/03/07 19:02:43 djm Exp $ */ |
|
| 54 |
++/* $OpenBSD: auth2-hostbased.c,v 1.36 2018/07/31 03:10:27 djm Exp $ */ |
|
| 55 |
+ /* |
|
| 56 |
+ * Copyright (c) 2000 Markus Friedl. All rights reserved. |
|
| 57 |
+ * |
|
| 58 |
+@@ -66,10 +66,6 @@ userauth_hostbased(Authctxt *authctxt) |
|
| 59 |
+ int pktype; |
|
| 60 |
+ int authenticated = 0; |
|
| 61 |
+ |
|
| 62 |
+- if (!authctxt->valid) {
|
|
| 63 |
+- debug2("userauth_hostbased: disabled because of invalid user");
|
|
| 64 |
+- return 0; |
|
| 65 |
+- } |
|
| 66 |
+ pkalg = packet_get_string(&alen); |
|
| 67 |
+ pkblob = packet_get_string(&blen); |
|
| 68 |
+ chost = packet_get_string(NULL); |
|
| 69 |
+@@ -115,6 +111,11 @@ userauth_hostbased(Authctxt *authctxt) |
|
| 70 |
+ goto done; |
|
| 71 |
+ } |
|
| 72 |
+ |
|
| 73 |
++ if (!authctxt->valid || authctxt->user == NULL) {
|
|
| 74 |
++ debug2("%s: disabled because of invalid user", __func__);
|
|
| 75 |
++ goto done; |
|
| 76 |
++ } |
|
| 77 |
++ |
|
| 78 |
+ service = datafellows & SSH_BUG_HBSERVICE ? "ssh-userauth" : |
|
| 79 |
+ authctxt->service; |
|
| 80 |
+ buffer_init(&b); |
|
| 81 |
+diff --git a/auth2-pubkey.c b/auth2-pubkey.c |
|
| 82 |
+index 20f3309..601a153 100644 |
|
| 83 |
+--- a/auth2-pubkey.c |
|
| 84 |
+@@ -1,4 +1,4 @@ |
|
| 85 |
+-/* $OpenBSD: auth2-pubkey.c,v 1.60 2016/11/30 02:57:40 djm Exp $ */ |
|
| 86 |
++/* $OpenBSD: auth2-pubkey.c,v 1.83 2018/07/31 03:10:27 djm Exp $ */ |
|
| 87 |
+ /* |
|
| 88 |
+ * Copyright (c) 2000 Markus Friedl. All rights reserved. |
|
| 89 |
+ * |
|
| 90 |
+@@ -79,16 +79,12 @@ userauth_pubkey(Authctxt *authctxt) |
|
| 91 |
+ {
|
|
| 92 |
+ Buffer b; |
|
| 93 |
+ Key *key = NULL; |
|
| 94 |
+- char *pkalg, *userstyle, *fp = NULL; |
|
| 95 |
+- u_char *pkblob, *sig; |
|
| 96 |
++ char *pkalg = NULL, *userstyle = NULL, *fp = NULL; |
|
| 97 |
++ u_char *pkblob = NULL, *sig = NULL; |
|
| 98 |
+ u_int alen, blen, slen; |
|
| 99 |
+ int have_sig, pktype; |
|
| 100 |
+ int authenticated = 0; |
|
| 101 |
+ |
|
| 102 |
+- if (!authctxt->valid) {
|
|
| 103 |
+- debug2("%s: disabled because of invalid user", __func__);
|
|
| 104 |
+- return 0; |
|
| 105 |
+- } |
|
| 106 |
+ have_sig = packet_get_char(); |
|
| 107 |
+ if (datafellows & SSH_BUG_PKAUTH) {
|
|
| 108 |
+ debug2("%s: SSH_BUG_PKAUTH", __func__);
|
|
| 109 |
+@@ -149,6 +145,11 @@ userauth_pubkey(Authctxt *authctxt) |
|
| 110 |
+ } else {
|
|
| 111 |
+ buffer_put_string(&b, session_id2, session_id2_len); |
|
| 112 |
+ } |
|
| 113 |
++ if (!authctxt->valid || authctxt->user == NULL) {
|
|
| 114 |
++ debug2("%s: disabled because of invalid user",
|
|
| 115 |
++ __func__); |
|
| 116 |
++ goto done; |
|
| 117 |
++ } |
|
| 118 |
+ /* reconstruct packet */ |
|
| 119 |
+ buffer_put_char(&b, SSH2_MSG_USERAUTH_REQUEST); |
|
| 120 |
+ xasprintf(&userstyle, "%s%s%s", authctxt->user, |
|
| 121 |
+@@ -184,12 +185,17 @@ userauth_pubkey(Authctxt *authctxt) |
|
| 122 |
+ key = NULL; /* Don't free below */ |
|
| 123 |
+ } |
|
| 124 |
+ buffer_free(&b); |
|
| 125 |
+- free(sig); |
|
| 126 |
+ } else {
|
|
| 127 |
+ debug("%s: test whether pkalg/pkblob are acceptable for %s %s",
|
|
| 128 |
+ __func__, sshkey_type(key), fp); |
|
| 129 |
+ packet_check_eom(); |
|
| 130 |
+ |
|
| 131 |
++ if (!authctxt->valid || authctxt->user == NULL) {
|
|
| 132 |
++ debug2("%s: disabled because of invalid user",
|
|
| 133 |
++ __func__); |
|
| 134 |
++ goto done; |
|
| 135 |
++ } |
|
| 136 |
++ |
|
| 137 |
+ /* XXX fake reply and always send PK_OK ? */ |
|
| 138 |
+ /* |
|
| 139 |
+ * XXX this allows testing whether a user is allowed |
| 0 | 140 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,33 @@ |
| 0 |
+From 6010c0303a422a9c5fa8860c061bf7105eb7f8b2 Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: "djm@openbsd.org" <djm@openbsd.org> |
|
| 2 |
+Date: Fri, 16 Nov 2018 03:03:10 +0000 |
|
| 3 |
+Subject: [PATCH] upstream: disallow empty incoming filename or ones that refer |
|
| 4 |
+ to the |
|
| 5 |
+ |
|
| 6 |
+current directory; based on report/patch from Harry Sintonen |
|
| 7 |
+ |
|
| 8 |
+OpenBSD-Commit-ID: f27651b30eaee2df49540ab68d030865c04f6de9 |
|
| 9 |
+--- |
|
| 10 |
+ scp.c | 5 +++-- |
|
| 11 |
+ 1 file changed, 3 insertions(+), 2 deletions(-) |
|
| 12 |
+ |
|
| 13 |
+diff --git a/scp.c b/scp.c |
|
| 14 |
+index b4db851..3faf2a5 100644 |
|
| 15 |
+--- a/scp.c |
|
| 16 |
+@@ -1,4 +1,4 @@ |
|
| 17 |
+-/* $OpenBSD: scp.c,v 1.187 2016/09/12 01:22:38 deraadt Exp $ */ |
|
| 18 |
++/* $OpenBSD: scp.c,v 1.198 2018/11/16 03:03:10 djm Exp $ */ |
|
| 19 |
+ /* |
|
| 20 |
+ * scp - secure remote copy. This is basically patched BSD rcp which |
|
| 21 |
+ * uses ssh to do the data transfer (instead of using rcmd). |
|
| 22 |
+@@ -1047,7 +1047,8 @@ sink(int argc, char **argv) |
|
| 23 |
+ size = size * 10 + (*cp++ - '0'); |
|
| 24 |
+ if (*cp++ != ' ') |
|
| 25 |
+ SCREWUP("size not delimited");
|
|
| 26 |
+- if ((strchr(cp, '/') != NULL) || (strcmp(cp, "..") == 0)) {
|
|
| 27 |
++ if (*cp == '\0' || strchr(cp, '/') != NULL || |
|
| 28 |
++ strcmp(cp, ".") == 0 || strcmp(cp, "..") == 0) {
|
|
| 29 |
+ run_err("error: unexpected filename: %s", cp);
|
|
| 30 |
+ exit(1); |
|
| 31 |
+ } |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
Summary: Free version of the SSH connectivity tools |
| 2 | 2 |
Name: openssh |
| 3 | 3 |
Version: 7.4p1 |
| 4 |
-Release: 7%{?dist}
|
|
| 4 |
+Release: 8%{?dist}
|
|
| 5 | 5 |
License: BSD |
| 6 | 6 |
URL: https://www.openssh.com/ |
| 7 | 7 |
Group: System Environment/Security |
| ... | ... |
@@ -15,6 +15,8 @@ Patch0: blfs_systemd_fixes.patch |
| 15 | 15 |
Patch1: openssh-7.4p1-fips.patch |
| 16 | 16 |
Patch2: openssh-7.4p1-configure-fips.patch |
| 17 | 17 |
Patch3: openssh-CVE-2017-15906.patch |
| 18 |
+Patch4: openssh-CVE-2018-15473.patch |
|
| 19 |
+Patch5: openssh-CVE-2018-20685.patch |
|
| 18 | 20 |
BuildRequires: openssl-devel |
| 19 | 21 |
BuildRequires: Linux-PAM |
| 20 | 22 |
BuildRequires: krb5 |
| ... | ... |
@@ -36,6 +38,8 @@ tar xf %{SOURCE1}
|
| 36 | 36 |
%patch1 -p1 |
| 37 | 37 |
%patch2 -p1 |
| 38 | 38 |
%patch3 -p3 |
| 39 |
+%patch4 -p1 |
|
| 40 |
+%patch5 -p1 |
|
| 39 | 41 |
%build |
| 40 | 42 |
./configure \ |
| 41 | 43 |
CFLAGS="%{optflags}" \
|
| ... | ... |
@@ -144,6 +148,8 @@ rm -rf %{buildroot}/*
|
| 144 | 144 |
%{_mandir}/man8/*
|
| 145 | 145 |
%attr(700,root,sys)/var/lib/sshd |
| 146 | 146 |
%changelog |
| 147 |
+* Wed Feb 13 2019 Ankit Jain <ankitja@vmware.comm> 7.4p1-8 |
|
| 148 |
+- Fix CVE-2018-15473 and CVE-2018-20685 |
|
| 147 | 149 |
* Tue Nov 28 2017 Xiaolin Li <xiaolinl@vmware.comm> 7.4p1-7 |
| 148 | 150 |
- Fix CVE-2017-15906. |
| 149 | 151 |
* Tue Nov 14 2017 Anish Swaminathan <anishs@vmware.com> 7.4p1-6 |