Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Mar 2016 00:04:14 +0100
From:      Dimitry Andric <dim@FreeBSD.org>
To:        =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@des.no>
Cc:        Akihiro HIRANO <hirano@t.kanazawa-u.ac.jp>, "freebsd-security@freebsd.org" <freebsd-security@freebsd.org>
Subject:   Re: openssl bug causes sshd crashed on FreeBSD 9.3-RELEASE
Message-ID:  <EB5B4B89-0CE7-4441-96A8-CB53AAF6D6F4@FreeBSD.org>
In-Reply-To: <86oaanfebv.fsf@desk.des.no>
References:  <zarafa.56e001f7.549c.013913261512a216@zarafa.ms.gonicus.de> <56E017E2.9060305@t.kanazawa-u.ac.jp> <86oaanfebv.fsf@desk.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 09 Mar 2016, at 23:59, Dag-Erling Smørgrav <des@des.no> wrote:
> 
> Akihiro HIRANO <hirano@t.kanazawa-u.ac.jp> writes:
>> Frank Möller <moeller@gonicus.de> 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.
> 
> 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
===================================================================
--- 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=207783#c11


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.29

iEYEARECAAYFAlbgrAIACgkQsF6jCi4glqP50gCfawtmgIA3bKdY3Gs/6KGriDc2
CfYAoLgvJXR8R7OjWm1YtcjyiLEcLDyw
=xo0V
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EB5B4B89-0CE7-4441-96A8-CB53AAF6D6F4>