Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssh/dist OpenSSH 8.3 was released on...



details:   https://anonhg.NetBSD.org/src/rev/2dbcf6cf2511
branches:  trunk
changeset: 933696:2dbcf6cf2511
user:      christos <christos%NetBSD.org@localhost>
date:      Thu May 28 17:02:58 2020 +0000

description:
OpenSSH 8.3 was released on 2020-05-27. It is available from the
mirrors listed at https://www.openssh.com/.

OpenSSH is a 100% complete SSH protocol 2.0 implementation and
includes sftp client and server support.

Once again, we would like to thank the OpenSSH community for their
continued support of the project, especially those who contributed
code or patches, reported bugs, tested snapshots or donated to the
project. More information on donations may be found at:
https://www.openssh.com/donations.html

Future deprecation notice
=========================

It is now possible[1] to perform chosen-prefix attacks against the
SHA-1 algorithm for less than USD$50K. For this reason, we will be
disabling the "ssh-rsa" public key signature algorithm by default in a
near-future release.

This algorithm is unfortunately still used widely despite the
existence of better alternatives, being the only remaining public key
signature algorithm specified by the original SSH RFCs.

The better alternatives include:

 * The RFC8332 RSA SHA-2 signature algorithms rsa-sha2-256/512. These
   algorithms have the advantage of using the same key type as
   "ssh-rsa" but use the safe SHA-2 hash algorithms. These have been
   supported since OpenSSH 7.2 and are already used by default if the
   client and server support them.

 * The ssh-ed25519 signature algorithm. It has been supported in
   OpenSSH since release 6.5.

 * The RFC5656 ECDSA algorithms: ecdsa-sha2-nistp256/384/521. These
   have been supported by OpenSSH since release 5.7.

To check whether a server is using the weak ssh-rsa public key
algorithm, for host authentication, try to connect to it after
removing the ssh-rsa algorithm from ssh(1)'s allowed list:

    ssh -oHostKeyAlgorithms=-ssh-rsa user@host

If the host key verification fails and no other supported host key
types are available, the server software on that host should be
upgraded.

A future release of OpenSSH will enable UpdateHostKeys by default
to allow the client to automatically migrate to better algorithms.
Users may consider enabling this option manually. Vendors of devices
that implement the SSH protocol should ensure that they support the
new signature algorithms for RSA keys.

[1] "SHA-1 is a Shambles: First Chosen-Prefix Collision on SHA-1 and
    Application to the PGP Web of Trust" Leurent, G and Peyrin, T
    (2020) https://eprint.iacr.org/2020/014.pdf

Security
========

 * scp(1): when receiving files, scp(1) could be become desynchronised
   if a utimes(2) system call failed. This could allow file contents
   to be interpreted as file metadata and thereby permit an adversary
   to craft a file system that, when copied with scp(1) in a
   configuration that caused utimes(2) to fail (e.g. under a SELinux
   policy or syscall sandbox), transferred different file names and
   contents to the actual file system layout.

   Exploitation of this is not likely as utimes(2) does not fail under
   normal circumstances. Successful exploitation is not silent - the
   output of scp(1) would show transfer errors followed by the actual
   file(s) that were received.

   Finally, filenames returned from the peer are (since openssh-8.0)
   matched against the user's requested destination, thereby
   disallowing a successful exploit from writing files outside the
   user's selected target glob (or directory, in the case of a
   recursive transfer). This ensures that this attack can achieve no
   more than a hostile peer is already able to achieve within the scp
   protocol.

Potentially-incompatible changes
================================

This release includes a number of changes that may affect existing
configurations:

 * sftp(1): reject an argument of "-1" in the same way as ssh(1) and
   scp(1) do instead of accepting and silently ignoring it.

Changes since OpenSSH 8.2
=========================

The focus of this release is bug fixing.

New Features
------------

 * sshd(8): make IgnoreRhosts a tri-state option: "yes" to ignore
   rhosts/shosts, "no" allow rhosts/shosts or (new) "shosts-only"
   to allow .shosts files but not .rhosts.

 * sshd(8): allow the IgnoreRhosts directive to appear anywhere in a
   sshd_config, not just before any Match blocks; bz3148

 * ssh(1): add %TOKEN percent expansion for the LocalFoward and
   RemoteForward keywords when used for Unix domain socket forwarding.
   bz#3014

 * all: allow loading public keys from the unencrypted envelope of a
   private key file if no corresponding public key file is present.

 * ssh(1), sshd(8): prefer to use chacha20 from libcrypto where
   possible instead of the (slower) portable C implementation included
   in OpenSSH.

 * ssh-keygen(1): add ability to dump the contents of a binary key
   revocation list via "ssh-keygen -lQf /path" bz#3132

Bugfixes
--------

 * ssh(1): fix IdentitiesOnly=yes to also apply to keys loaded from
   a PKCS11Provider; bz#3141

 * ssh-keygen(1): avoid NULL dereference when trying to convert an
   invalid RFC4716 private key.

 * scp(1): when performing remote-to-remote copies using "scp -3",
   start the second ssh(1) channel with BatchMode=yes enabled to
   avoid confusing and non-deterministic ordering of prompts.

 * ssh(1), ssh-keygen(1): when signing a challenge using a FIDO token,
   perform hashing of the message to be signed in the middleware layer
   rather than in OpenSSH code. This permits the use of security key
   middlewares that perform the hashing implicitly, such as Windows
   Hello.

 * ssh(1): fix incorrect error message for "too many known hosts
   files." bz#3149

 * ssh(1): make failures when establishing "Tunnel" forwarding
   terminate the connection when ExitOnForwardFailure is enabled;
   bz#3116

 * ssh-keygen(1): fix printing of fingerprints on private keys and add
   a regression test for same.

 * sshd(8): document order of checking AuthorizedKeysFile (first) and
   AuthorizedKeysCommand (subsequently, if the file doesn't match);
   bz#3134

 * sshd(8): document that /etc/hosts.equiv and /etc/shosts.equiv are
   not considered for HostbasedAuthentication when the target user is
   root; bz#3148

 * ssh(1), ssh-keygen(1): fix NULL dereference in private certificate
   key parsing (oss-fuzz #20074).

 * ssh(1), sshd(8): more consistency between sets of %TOKENS are
   accepted in various configuration options.

 * ssh(1), ssh-keygen(1): improve error messages for some common
   PKCS#11 C_Login failure cases; bz#3130

 * ssh(1), sshd(8): make error messages for problems during SSH banner
   exchange consistent with other SSH transport-layer error messages
   and ensure they include the relevant IP addresses bz#3129

 * various: fix a number of spelling errors in comments and debug/error
   messages

 * ssh-keygen(1), ssh-add(1): when downloading FIDO2 resident keys
   from a token, don't prompt for a PIN until the token has told us
   that it needs one. Avoids double-prompting on devices that
   implement on-device authentication.

 * sshd(8), ssh-keygen(1): no-touch-required FIDO certificate option
   should be an extension, not a critical option.

 * ssh(1), ssh-keygen(1), ssh-add(1): offer a better error message
   when trying to use a FIDO key function and SecurityKeyProvider is
   empty.

 * ssh-add(1), ssh-agent(8): ensure that a key lifetime fits within
   the values allowed by the wire format (u32). Prevents integer
   wraparound of the timeout values. bz#3119

 * ssh(1): detect and prevent trivial configuration loops when using
    ProxyJump. bz#3057.

Portability
-----------

 * Detect systems where signals flagged with SA_RESTART will interrupt
   select(2). POSIX permits implementations to choose whether
   select(2) will return when interrupted with a SA_RESTART-flagged
   signal, but OpenSSH requires interrupting behaviour.

 * Several compilation fixes for HP/UX and AIX.

 * On platforms that do not support setting process-wide routing
   domains (all excepting OpenBSD at present), fail to accept a
   configuration attempts to set one at process start time rather than
   fatally erroring at run time. bz#3126

 * Improve detection of egrep (used in regression tests) on platforms
   that offer a poor default one (e.g. Solaris).

 * A number of shell portability fixes for the regression tests.

 * Fix theoretical infinite loop in the glob(3) replacement
   implementation.

 * Fix seccomp sandbox compilation problems for some Linux
   configurations bz#3085

 * Improved detection of libfido2 and some compilation fixes for some
   configurations when --with-security-key-builtin is selected.

diffstat:

 crypto/external/bsd/openssh/dist/PROTOCOL.chacha20poly1305     |    4 +-
 crypto/external/bsd/openssh/dist/PROTOCOL.u2f                  |    6 +-
 crypto/external/bsd/openssh/dist/cipher-chachapoly-libcrypto.c |  158 ++++++++++
 crypto/external/bsd/openssh/dist/moduli-gen/moduli-gen.sh      |   13 +-
 crypto/external/bsd/openssh/dist/sk-api.h                      |    4 +-
 5 files changed, 173 insertions(+), 12 deletions(-)

diffs (262 lines):

diff -r 4b912f2fba05 -r 2dbcf6cf2511 crypto/external/bsd/openssh/dist/PROTOCOL.chacha20poly1305
--- a/crypto/external/bsd/openssh/dist/PROTOCOL.chacha20poly1305        Thu May 28 15:27:59 2020 +0000
+++ b/crypto/external/bsd/openssh/dist/PROTOCOL.chacha20poly1305        Thu May 28 17:02:58 2020 +0000
@@ -34,7 +34,7 @@
 The chacha20-poly1305%openssh.com@localhost cipher requires 512 bits of key
 material as output from the SSH key exchange. This forms two 256 bit
 keys (K_1 and K_2), used by two separate instances of chacha20.
-The first 256 bits consitute K_2 and the second 256 bits become
+The first 256 bits constitute K_2 and the second 256 bits become
 K_1.
 
 The instance keyed by K_1 is a stream cipher that is used only
@@ -103,5 +103,5 @@
 [3] "ChaCha20 and Poly1305 based Cipher Suites for TLS", Adam Langley
     http://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-03
 
-$OpenBSD: PROTOCOL.chacha20poly1305,v 1.4 2018/04/10 00:10:49 djm Exp $
+$OpenBSD: PROTOCOL.chacha20poly1305,v 1.5 2020/02/21 00:04:43 dtucker Exp $
 
diff -r 4b912f2fba05 -r 2dbcf6cf2511 crypto/external/bsd/openssh/dist/PROTOCOL.u2f
--- a/crypto/external/bsd/openssh/dist/PROTOCOL.u2f     Thu May 28 15:27:59 2020 +0000
+++ b/crypto/external/bsd/openssh/dist/PROTOCOL.u2f     Thu May 28 17:02:58 2020 +0000
@@ -142,7 +142,7 @@
 default.
 
 Attestation information is useful for out-of-band key and certificate
-registration worksflows, e.g. proving to a CA that a key is backed
+registration workflows, e.g. proving to a CA that a key is backed
 by trusted hardware before it will issue a certificate. To support this
 case, OpenSSH optionally allows retaining the attestation information
 at the time of key generation. It will take the following format:
@@ -169,7 +169,7 @@
        byte[]          extensions
        byte[32]        SHA256(message)
 
-No extensons are yet defined for SSH use. If any are defined in the future,
+No extensions are yet defined for SSH use. If any are defined in the future,
 it will be possible to infer their presence from the contents of the "flags"
 value.
 
@@ -236,7 +236,7 @@
 
 The middleware library need only expose a handful of functions:
 
-       #define SSH_SK_VERSION_MAJOR            0x00040000 /* API version */
+       #define SSH_SK_VERSION_MAJOR            0x00050000 /* API version */
        #define SSH_SK_VERSION_MAJOR_MASK       0xffff0000
 
        /* Flags */
diff -r 4b912f2fba05 -r 2dbcf6cf2511 crypto/external/bsd/openssh/dist/cipher-chachapoly-libcrypto.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/crypto/external/bsd/openssh/dist/cipher-chachapoly-libcrypto.c    Thu May 28 17:02:58 2020 +0000
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2013 Damien Miller <djm%mindrot.org@localhost>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $OpenBSD: cipher-chachapoly-libcrypto.c,v 1.1 2020/04/03 04:32:21 djm Exp $ */
+
+#include <sys/types.h>
+#include <stdarg.h> /* needed for log.h */
+#include <string.h>
+#include <stdio.h>  /* needed for misc.h */
+
+#include <openssl/evp.h>
+
+#include "log.h"
+#include "sshbuf.h"
+#include "ssherr.h"
+#include "cipher-chachapoly.h"
+
+struct chachapoly_ctx {
+       EVP_CIPHER_CTX *main_evp, *header_evp;
+};
+
+struct chachapoly_ctx *
+chachapoly_new(const u_char *key, u_int keylen)
+{
+       struct chachapoly_ctx *ctx;
+
+       if (keylen != (32 + 32)) /* 2 x 256 bit keys */
+               return NULL;
+       if ((ctx = calloc(1, sizeof(*ctx))) == NULL)
+               return NULL;
+       if ((ctx->main_evp = EVP_CIPHER_CTX_new()) == NULL ||
+           (ctx->header_evp = EVP_CIPHER_CTX_new()) == NULL)
+               goto fail;
+       if (!EVP_CipherInit(ctx->main_evp, EVP_chacha20(), key, NULL, 1))
+               goto fail;
+       if (!EVP_CipherInit(ctx->header_evp, EVP_chacha20(), key + 32, NULL, 1))
+               goto fail;
+       if (EVP_CIPHER_CTX_iv_length(ctx->header_evp) != 16)
+               goto fail;
+       return ctx;
+ fail:
+       chachapoly_free(ctx);
+       return NULL;
+}
+
+void
+chachapoly_free(struct chachapoly_ctx *cpctx)
+{
+       if (cpctx == NULL)
+               return;
+       EVP_CIPHER_CTX_free(cpctx->main_evp);
+       EVP_CIPHER_CTX_free(cpctx->header_evp);
+       freezero(cpctx, sizeof(*cpctx));
+}
+
+/*
+ * chachapoly_crypt() operates as following:
+ * En/decrypt with header key 'aadlen' bytes from 'src', storing result
+ * to 'dest'. The ciphertext here is treated as additional authenticated
+ * data for MAC calculation.
+ * En/decrypt 'len' bytes at offset 'aadlen' from 'src' to 'dest'. Use
+ * POLY1305_TAGLEN bytes at offset 'len'+'aadlen' as the authentication
+ * tag. This tag is written on encryption and verified on decryption.
+ */
+int
+chachapoly_crypt(struct chachapoly_ctx *ctx, u_int seqnr, u_char *dest,
+    const u_char *src, u_int len, u_int aadlen, u_int authlen, int do_encrypt)
+{
+       u_char seqbuf[16]; /* layout: u64 counter || u64 seqno */
+       int r = SSH_ERR_INTERNAL_ERROR;
+       u_char expected_tag[POLY1305_TAGLEN], poly_key[POLY1305_KEYLEN];
+
+       /*
+        * Run ChaCha20 once to generate the Poly1305 key. The IV is the
+        * packet sequence number.
+        */
+       memset(seqbuf, 0, sizeof(seqbuf));
+       POKE_U64(seqbuf + 8, seqnr);
+       memset(poly_key, 0, sizeof(poly_key));
+       if (!EVP_CipherInit(ctx->main_evp, NULL, NULL, seqbuf, 1) ||
+           EVP_Cipher(ctx->main_evp, poly_key,
+           poly_key, sizeof(poly_key)) < 0) {
+               r = SSH_ERR_LIBCRYPTO_ERROR;
+               goto out;
+       }
+
+       /* If decrypting, check tag before anything else */
+       if (!do_encrypt) {
+               const u_char *tag = src + aadlen + len;
+
+               poly1305_auth(expected_tag, src, aadlen + len, poly_key);
+               if (timingsafe_bcmp(expected_tag, tag, POLY1305_TAGLEN) != 0) {
+                       r = SSH_ERR_MAC_INVALID;
+                       goto out;
+               }
+       }
+
+       /* Crypt additional data */
+       if (aadlen) {
+               if (!EVP_CipherInit(ctx->header_evp, NULL, NULL, seqbuf, 1) ||
+                   EVP_Cipher(ctx->header_evp, dest, src, aadlen) < 0) {
+                       r = SSH_ERR_LIBCRYPTO_ERROR;
+                       goto out;
+               }
+       }
+
+       /* Set Chacha's block counter to 1 */
+       seqbuf[0] = 1;
+       if (!EVP_CipherInit(ctx->main_evp, NULL, NULL, seqbuf, 1) ||
+           EVP_Cipher(ctx->main_evp, dest + aadlen, src + aadlen, len) < 0) {
+               r = SSH_ERR_LIBCRYPTO_ERROR;
+               goto out;
+       }
+
+       /* If encrypting, calculate and append tag */
+       if (do_encrypt) {
+               poly1305_auth(dest + aadlen + len, dest, aadlen + len,
+                   poly_key);
+       }
+       r = 0;
+ out:
+       explicit_bzero(expected_tag, sizeof(expected_tag));
+       explicit_bzero(seqbuf, sizeof(seqbuf));
+       explicit_bzero(poly_key, sizeof(poly_key));
+       return r;
+}
+
+/* Decrypt and extract the encrypted packet length */
+int
+chachapoly_get_length(struct chachapoly_ctx *ctx,
+    u_int *plenp, u_int seqnr, const u_char *cp, u_int len)
+{
+       u_char buf[4], seqbuf[16];
+
+       if (len < 4)
+               return SSH_ERR_MESSAGE_INCOMPLETE;
+       memset(seqbuf, 0, sizeof(seqbuf));
+       POKE_U64(seqbuf + 8, seqnr);
+       if (!EVP_CipherInit(ctx->header_evp, NULL, NULL, seqbuf, 0))
+               return SSH_ERR_LIBCRYPTO_ERROR;
+       if (EVP_Cipher(ctx->header_evp, buf, (u_char *)cp, sizeof(buf)) < 0)
+               return SSH_ERR_LIBCRYPTO_ERROR;
+       *plenp = PEEK_U32(buf);
+       return 0;
+}
diff -r 4b912f2fba05 -r 2dbcf6cf2511 crypto/external/bsd/openssh/dist/moduli-gen/moduli-gen.sh
--- a/crypto/external/bsd/openssh/dist/moduli-gen/moduli-gen.sh Thu May 28 15:27:59 2020 +0000
+++ b/crypto/external/bsd/openssh/dist/moduli-gen/moduli-gen.sh Thu May 28 17:02:58 2020 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh
-#      $OpenBSD: moduli-gen.sh,v 1.3 2017/06/23 03:25:53 dtucker Exp $
+#      $OpenBSD: moduli-gen.sh,v 1.5 2020/02/27 02:32:37 dtucker Exp $
 #
 
 srcdir="$1"
@@ -19,15 +19,18 @@
 fi
 
 if [ ! -f ${moduli_sieved} ]; then
-       for i in 0 1; do ssh-keygen -b ${bits} -G /dev/stdout; done | \
-           gzip -9c >${moduli_sieved}.tmp && \
+       for i in 0 1;
+               do ssh-keygen -M generate -O bits=${bits} /dev/stdout;
+       done | gzip -9c >${moduli_sieved}.tmp && \
        mv ${moduli_sieved}.tmp ${moduli_sieved}
 fi
 
 lines=`gzip -dc ${moduli_sieved} | wc -l`
+lines=`echo $lines`  # remove leading space
 
 gzip -dc ${moduli_sieved} | \
-    ssh-keygen -K ${moduli_tested}.ckpt -T ${moduli_tested} -J $lines && \
-mv ${objdir}/moduli.${bits}.tested ${srcdir}/moduli.${bits}
+    ssh-keygen -M screen -O checkpoint=${moduli_tested}.ckpt \
+        -O lines=${lines} ${moduli_tested} && \
+    mv ${objdir}/moduli.${bits}.tested ${srcdir}/moduli.${bits}
 
 exit 0
diff -r 4b912f2fba05 -r 2dbcf6cf2511 crypto/external/bsd/openssh/dist/sk-api.h
--- a/crypto/external/bsd/openssh/dist/sk-api.h Thu May 28 15:27:59 2020 +0000
+++ b/crypto/external/bsd/openssh/dist/sk-api.h Thu May 28 17:02:58 2020 +0000
@@ -1,4 +1,4 @@
-/* $OpenBSD: sk-api.h,v 1.8 2020/01/25 23:13:09 djm Exp $ */
+/* $OpenBSD: sk-api.h,v 1.9 2020/04/28 04:02:29 djm Exp $ */
 /*
  * Copyright (c) 2019 Google LLC
  *
@@ -69,7 +69,7 @@
        uint8_t required;
 };
 
-#define SSH_SK_VERSION_MAJOR           0x00040000 /* current API version */
+#define SSH_SK_VERSION_MAJOR           0x00050000 /* current API version */
 #define SSH_SK_VERSION_MAJOR_MASK      0xffff0000
 
 /* Return the version of the middleware API */



Home | Main Index | Thread Index | Old Index