Re: [TLS] Server-side missing_extension MUSTs

Eric Rescorla <ekr@rtfm.com> Wed, 13 July 2016 17:01 UTC

Return-Path: <ekr@rtfm.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id F002612D0C9 for <tls@ietfa.amsl.com>; Wed, 13 Jul 2016 10:01:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=rtfm-com.20150623.gappssmtp.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w90WRzZ8lKuO for <tls@ietfa.amsl.com>; Wed, 13 Jul 2016 10:01:53 -0700 (PDT)
Received: from mail-yw0-x235.google.com (mail-yw0-x235.google.com [IPv6:2607:f8b0:4002:c05::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 428FA12B012 for <tls@ietf.org>; Wed, 13 Jul 2016 10:01:53 -0700 (PDT)
Received: by mail-yw0-x235.google.com with SMTP id i12so48559144ywa.1 for <tls@ietf.org>; Wed, 13 Jul 2016 10:01:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtfm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Tgwgv5CynsB8UOjlYEz8C2Q3p/nsGshx735owqGwFaE=; b=ebypDX2HsDVFkGYA9RsPApOhkPM6C+Z72TvcTckdXLA66ZlCo9OOILWCdHSdoFqSjz HWcGKCkzgzQK/XbweCNdkBFYw8J/AijOwMPjuhczGzN5dhyaRR8ogWopfB174GsnY/mG S8xnjYIJBOKTIz7DLvvi0fUspit1hm9R8QH/xVe8lwDxf1GSh8Q+Rd9x0y9ev9EJRGmA I8JyZxwFyGagGGyyliosIbc5U1qmgnlclZAzl7Nktz4dCB9sZa+PqVy1n3cKD5NaowV5 nlMXI6NPmUcsDtyQeCfJshfioFE2DekHqfpHXGESiDCZsgraKCUx8w6fc73+XXNMbR0V TAXw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Tgwgv5CynsB8UOjlYEz8C2Q3p/nsGshx735owqGwFaE=; b=D6UNi9o0acsjGBIHSLJnFIIf8Fl3938fgnJZLe8fsqxIgNpQ3jUZG9aQ+l8jA0xsU8 d98kpBRjHXfNpcPa7YZhJ1mbcwbtCxt54U+AttrYhDBZKQJamFlBWdsuDZMi6rJxy/On JlmX27csoil4SgSaiCMDeSIolU0HSocSFXG9ivWqfpypbGR+Upyy6A1au6liIG/eruRd 3rDocmLW8kpQ3AOmbiG5Jlbri6uiBJibtzargF/OiTVzSkopzpAQJKPUsTbsDkQcUKRI 8tIEwGCxaHmMx0UD2TFSCAafFFXq0kZ6hHPq82BKLAhHRpid+0UrCz1VOyZoTB+Z39u2 wyVQ==
X-Gm-Message-State: ALyK8tK+uLE1uQ1cIbaBgi2N0T+QVZENdQUjn2IsSJ2PXO/bztFPLEFlyScsDe5GcARVt064OgP6/CkZiBHMOQ==
X-Received: by 10.129.161.129 with SMTP id y123mr7501631ywg.214.1468429312512; Wed, 13 Jul 2016 10:01:52 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.129.152.13 with HTTP; Wed, 13 Jul 2016 10:01:13 -0700 (PDT)
In-Reply-To: <CAF8qwaBiToiAdH+e-ei2LZiSa6UY4OZ+th_iMS3-SuKfKSB-5w@mail.gmail.com>
References: <CAF8qwaAAw6zA9jRPMQ5MXqHptBtsarhNPcH6KJzzSE-h1XiFDg@mail.gmail.com> <CAF8qwaBoi-P+NQghrWp+qdx9Q4wKcr+K21jz--xX9yvWmCtJew@mail.gmail.com> <CAF8qwaDP+_R0LF38UX8X=DSVxtDz4hCJPJxyGB2T=YGcMGHSkw@mail.gmail.com> <3111426.zLZNlvgK9Q@pintsize.usersys.redhat.com> <CAF8qwaBiToiAdH+e-ei2LZiSa6UY4OZ+th_iMS3-SuKfKSB-5w@mail.gmail.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Wed, 13 Jul 2016 10:01:13 -0700
Message-ID: <CABcZeBOCD6hx4913r8JwXnpqbbrzA2t5CxTSf6PWkD27a=GoOQ@mail.gmail.com>
To: David Benjamin <davidben@chromium.org>
Content-Type: multipart/alternative; boundary="001a114f8db28d08cb053787571a"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/GJ9G-jmRugnKsaD1nAbS61VGyqk>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] Server-side missing_extension MUSTs
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 13 Jul 2016 17:01:56 -0000

Reinforcing what David says here:
It's natural to pick the cipher suite first and then look for the key_share
extension, so if, for instance, you pick a PSK-only cipher suite, then you
wouldn't look for the key_share.

Obviously, you could add a check that said that if an EC cipher suite was
advertised, then you had to look for key shares even if you picked one, but
it's not a check you otherwise need.

-Ekr




On Wed, Jul 13, 2016 at 8:58 AM, David Benjamin <davidben@chromium.org>
wrote:

> On Wed, Jul 13, 2016 at 11:06 AM Hubert Kario <hkario@redhat.com> wrote:
>
>> On Wednesday 13 July 2016 14:43:58 David Benjamin wrote:
>> > To be clear, I am not at all opposed to useful errors or strict
>> policing of
>> > what the peer sends. That's all great. Indeed the linked test below
>> makes
>> > use of more specific error codes than TLS provides. But I would like
>> such
>> > things to:
>> >
>> > 1. Be useful, either for debugging or because it rejects an invalid
>> > handshake that would otherwise go unnoticed.
>> > 2. Come out naturally out of what the implementation would do anyway, to
>> > keep complexity down.
>> >
>> > I'm also quite okay with budging on #2 where #1 is strong. Complexity is
>> > the currency we pay for adding things. But I do not think this
>> particular
>> > error code passes #1 (the special-case is not useful and such a peer
>> would
>> > not be able to handshake against correct implementations anyway), so I'm
>> > not willing to sacrifice #2 for it.
>>
>> Then I fail to see how missing_extension does not flow out of correct
>> implementation (and from general RFC recommendations).
>>
>> You need to parse the Client Hello, and then sanity check it (length of
>> session ID, validity of ciphers, lack of duplicate extensions, etc.).
>> Making sure that mandatory extensions are in place in the same code
>> seems to me like a obvious place to do it.
>>
>
> The extension is not mandatory. Whether it is mandatory or not depends on
> the cipher suite selected. The cipher suite selected depends on the
> contents (or lack of) the extension. This makes checking things somewhat
> circular.
>
> If it were simply mandatory, by all means, mandate a missing_extension
> alert. I still do not think it'd be very useful (I'm more interested in
> non-syntax-error cases), but I have no objections.
>
>
>> In other words, you shouldn't delay checking if a particular extension
>> is present until the time you want to use it. If there is any chance
>> (or possible configuration) in which you would end up using it, you
>> should complain that the extension is missing or it is malformed.
>>
>> This way when you start to depend on it, things won't start breaking
>> suddenly and you end up writing Yet Another Workaround for Broken
>> Implementations™
>>
>
> I still do not see how returning handshake_failure (or whatever the "no
> common cipher" error is) for this case instead of missing_extension will
> cause broken implementations to come up.
>
> David
>
>
>> > On Wed, Jul 13, 2016 at 10:02 AM David Benjamin <davidben@chromium.org>
>> > wrote:
>> >
>> > > On Wed, Jul 13, 2016 at 3:31 AM Dave Garrett <davemgarrett@gmail.com>
>> > > wrote:
>> > >
>> > >> To be clear though, completely mandatory extensions, at least as
>> we're
>> > >> doing them here, are a new thing. TLS 1.2 relied on separate
>> messages for
>> > >> stuff, but we're front-loading everything into the ClientHello to get
>> > >> reliable 1RTT (with the exception of HRR).
>> > >
>> > >
>> > > On Wed, Jul 13, 2016 at 8:12 AM Hubert Kario <hkario@redhat.com>
>> wrote:
>> > >
>> > >> On Wednesday 13 July 2016 05:23:53 David Benjamin wrote:
>> > >> > I don't believe an implementation which fails to send
>> supported_groups,
>> > >> > etc., in 1.3 would ever leave a developer's workstation. It would
>> not
>> > >> > interoperate with anything.
>> > >>
>> > >> it would interoperate with itself, and for some deployments that's
>> enough
>> > >> of a passing grade... (Even if you do interoperatbility testing you
>> > >> do not check all possible permutations of features and settings)
>> > >>
>> > >> I wholeheartedly agree with Dave here, error definitions should be
>> strict
>> > >> (both on the when and what to do). One, because it allows to better
>> > >> diagnose (in general, maybe not in this specific situation) problems.
>> > >> Two, because you can write a strict negative test case that actually
>> > >> checks for it.
>> > >
>> > >
>> > >
>> > >
>> https://boringssl.googlesource.com/boringssl/+/1c256544dda26e4042c1af082580a1b87c9a690f/ssl/test/runner/runner.go#5646
>> > > Also something I have plenty of experience with. We're obsessive about
>> > > adding this kind of test in BoringSSL[0]. :-)
>> > >
>> > > One doesn't need this alert to write a test for curve negotiation.
>> Just
>> > > test that the handshake hits the usual codepath for there not being a
>> > > common cipher.
>> > >
>> > > This semi-mandatory extension isn't new in TLS 1.3, depending on your
>> 1.2
>> > > behavior. BoringSSL will already refuse to select an ECDHE cipher if
>> > > supported_curves is missing. 1.2 does not require this, but we opted
>> to do
>> > > it for simplicity[1].
>> > >
>> > > David
>> > >
>> > > [0] If anyone wants to try, I'm sure there is an
>> implementation-agnostic
>> > > TLS protocol test suite one could extract out of that. It would take
>> some
>> > > wrangling as we cheat and condition on BoringSSL error codes, but the
>> nice
>> > > thing is I've already built up a large battery of tests here.
>> > >
>> > > [1] Previously we always picking our most preferred curve if the
>> extension
>> > > was missing, like OpenSSL. But now our most preferred curve is
>> X25519, not
>> > > P-256. It did not seem worth kludging that when we could just decline
>> the
>> > > cipher. No one's noticed, so I would say that worked.
>> > >
>>
>> --
>> Regards,
>> Hubert Kario
>> Senior Quality Engineer, QE BaseOS Security team
>> Web: www.cz.redhat.com
>> Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno, Czech Republic
>
>
> _______________________________________________
> TLS mailing list
> TLS@ietf.org
> https://www.ietf.org/mailman/listinfo/tls
>
>