From owner-freebsd-security@freebsd.org Wed Mar 9 23:04:45 2016 Return-Path: Delivered-To: freebsd-security@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACA29AC9EC5 for ; Wed, 9 Mar 2016 23:04:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7279A7C2 for ; Wed, 9 Mar 2016 23:04:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:7b8:3a7::dd44:f53f:bd83:81a6] (unknown [IPv6:2001:7b8:3a7:0:dd44:f53f:bd83:81a6]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 4C6E93EA64; Thu, 10 Mar 2016 00:04:35 +0100 (CET) Subject: Re: openssl bug causes sshd crashed on FreeBSD 9.3-RELEASE Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Content-Type: multipart/signed; boundary="Apple-Mail=_80AFAB92-6829-47BA-A3F4-B50FBBF0E8B6"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.6b2 (ebbf3ef) From: Dimitry Andric In-Reply-To: <86oaanfebv.fsf@desk.des.no> Date: Thu, 10 Mar 2016 00:04:14 +0100 Cc: Akihiro HIRANO , "freebsd-security@freebsd.org" Message-Id: References: <56E017E2.9060305@t.kanazawa-u.ac.jp> <86oaanfebv.fsf@desk.des.no> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= X-Mailer: Apple Mail (2.3112) X-Mailman-Approved-At: Thu, 10 Mar 2016 00:10:54 +0000 X-BeenThere: freebsd-security@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Security issues \[members-only posting\]" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2016 23:04:45 -0000 --Apple-Mail=_80AFAB92-6829-47BA-A3F4-B50FBBF0E8B6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On 09 Mar 2016, at 23:59, Dag-Erling Sm=C3=B8rgrav wrote: >=20 > Akihiro HIRANO writes: >> Frank M=C3=B6ller writes: >>> After updating to FreeBSD 9.3-RELEASE-p37 sshd from the base system >>> crashes by signal 11 when I connect to the server with an old ssh >>> client (e.g. OpenSSH_4.5p1). Using a newer ssh client versions >>> (e.g. OpenSSH_6.6.1p1 from FreeBSD 9.3-RELEASE-p10) the sshd works >>> fine. >> Hum... I tried OpenSSH_6.6.1p1 client on 9.3-RELEASE-p37 >> and OpenSSH_6.4p1 client on 10.0-RELEASE-p18. >> Both clients cause sshd on 9.3-RELEASE-p37 crashed by signal 11. >=20 > It depends on which ciphers you use. If my hunch is correct, the bug = is > somewhere in the codepath for RSA, so newer versions (which default to > ECDSA) will be less likely to trigger it, but it will also depend on = the > server version and whether the server has an ECDSA host key. Please see my comment on PR 207783 [1]. Proposed fix: Index: crypto/openssl/crypto/bn/bn_exp.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- crypto/openssl/crypto/bn/bn_exp.c (revision 296469) +++ crypto/openssl/crypto/bn/bn_exp.c (working copy) @@ -758,7 +758,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BI * Fetch the appropriate pre-computed value from the pre-buf */ if (!MOD_EXP_CTIME_COPY_FROM_PREBUF - (computeTemp, top, powerbuf, wvalue, numPowers)) + (computeTemp, top, powerbuf, wvalue, window)) goto err; /* Multiply the result into the intermediate result */ -Dimitry [1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207783#c11 --Apple-Mail=_80AFAB92-6829-47BA-A3F4-B50FBBF0E8B6 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.29 iEYEARECAAYFAlbgrAIACgkQsF6jCi4glqP50gCfawtmgIA3bKdY3Gs/6KGriDc2 CfYAoLgvJXR8R7OjWm1YtcjyiLEcLDyw =xo0V -----END PGP SIGNATURE----- --Apple-Mail=_80AFAB92-6829-47BA-A3F4-B50FBBF0E8B6--