Re: [TLS] Server validation of a second ClientHello

Eric Rescorla <ekr@rtfm.com> Wed, 13 February 2019 16:32 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 76D381271FF for <tls@ietfa.amsl.com>; Wed, 13 Feb 2019 08:32:34 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001] 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 zRSi7qPOkpqH for <tls@ietfa.amsl.com>; Wed, 13 Feb 2019 08:32:32 -0800 (PST)
Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (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 C5D7A1275F3 for <tls@ietf.org>; Wed, 13 Feb 2019 08:32:31 -0800 (PST)
Received: by mail-lj1-x232.google.com with SMTP id s5-v6so2527635ljd.12 for <tls@ietf.org>; Wed, 13 Feb 2019 08:32:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtfm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9KsL+GJNYn1ZvOwah66mYua+37By2Dj0MAN59i1J3Fo=; b=eF2gxA44rQfNYjYDVOJ7Kozg8qRDz9gQ9GFz+Hjjvo7XTXpq0uFZ0T4l1tYWhGg2lH +dSTBI+8pU6hGbyySXMPkpCRxsUHev/x+xBZGeDOuINaEngDYBAQH+D4aAsPY51VY2Dm rsaHPOClJT0pHJRBVf1JF71F5tEBCZIUkZEq9sbDManmdUfA9cCBFEs9uimJP2UKnM04 LGFanWrLyV/nkEMgGM+pd+cQKtktGq1OYlKrYJFviQY1xzTMd7LGaMRJvBpSI+NcHPRZ 8rTqaSNegm++izM+w1RcaSOqEwAuLwPTj1IDHLE6SQ3lNTfAqoahbZdTFcO+aHq4iLHV 3ktg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9KsL+GJNYn1ZvOwah66mYua+37By2Dj0MAN59i1J3Fo=; b=nlRIJeEanxxNB5gImRJ1olWRL7mdMcYpmFiyohcYUMiwsbvBLvL+M1L9+WQcBl860j 59cDww/dDkq3K5qeQ3Z85q2MJmlLV+5An9Ga9Pi3qY8BYUjzK7g7S+Ed7d5GenJM2v9u xl6K5pEF/M0Qbiw8eBoAq8BD53T+rdOEJchJ2ZnnnmuqrpdtExumKk4jgu215QVcY6Ru PF/YSPYnLv+mWAZB4IQVpumKKBMg7m8ojB1Ovi79OICWRy/Bgz9Y5eKP8j2onCS930tR eorF9haO+zMdmN9jbrs6qLGNwDiOza43aQlajXSI2uc5CCJhUsatTPhIexDLWZPzvlwR leUA==
X-Gm-Message-State: AHQUAubkQ1Ekl9vTg70hukSNxYyQJspKPBAj887iELCNgWgvKudNHJ52 +OzuNHTCdxSRGD6B0KX0wGPufyAuksZ5tcoKueaHW2MZ
X-Google-Smtp-Source: AHgI3IYoEPbGMDtLXh/li+fSCUVvUHkkICJByBUvrOxUIcCRYdp2KUFwNKcHlWJMdAsKKBaU7hNA+Og2RMar5w8cA9I=
X-Received: by 2002:a2e:3c19:: with SMTP id j25mr840756lja.72.1550075549658; Wed, 13 Feb 2019 08:32:29 -0800 (PST)
MIME-Version: 1.0
References: <1549596678.898774.1653407000.2B2ACE8E@webmail.messagingengine.com> <103341275.xSgb4icBHy@pintsize.usersys.redhat.com> <CABcZeBP=MGrj4x5brO5t5uf4tYumkL3Vthu=4zwhBHOYpsSJyQ@mail.gmail.com> <25414967.ZWlNe5bkUN@pintsize.usersys.redhat.com>
In-Reply-To: <25414967.ZWlNe5bkUN@pintsize.usersys.redhat.com>
From: Eric Rescorla <ekr@rtfm.com>
Date: Wed, 13 Feb 2019 08:31:52 -0800
Message-ID: <CABcZeBPVUyFeQU+Lirv2VcPcQaOXJLc2Vc+PnBKOq=SrB1YPjA@mail.gmail.com>
To: Hubert Kario <hkario@redhat.com>
Cc: Martin Thomson <mt@lowentropy.net>, "<tls@ietf.org>" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000834d8b0581c916ec"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/EdnMY3JfoNS7mF76PFboF-xp5R8>
Subject: Re: [TLS] Server validation of a second ClientHello
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.29
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 Feb 2019 16:32:34 -0000

On Wed, Feb 13, 2019 at 7:39 AM Hubert Kario <hkario@redhat.com> wrote:

> On Wednesday, 13 February 2019 15:39:03 CET Eric Rescorla wrote:
> > On Wed, Feb 13, 2019 at 4:12 AM Hubert Kario <hkario@redhat.com> wrote:
> > > On Wednesday, 13 February 2019 01:31:41 CET Eric Rescorla wrote:
> > > > I concur with what I take to be MT's position here:
> > > >
> > > > 1. The client is clearly prohibited from changing most elements of
> the
> > > > CH
> > > > (except for listed exceptions).
> > > > 2. It's reasonable to check for and fail the handshake on any spec
> > > > violation except those where checking is explicitly forbidden (e.g.,
> > > > Must
> > > > Be Zero but Must be Ignored)
> > > > 3. Nothing in the spec requires the server to check for this
> condition.
> > >
> > > and what about values that technically can't change (as you noted
> > > yourself)
> > > but they do change and the server does use them?
> > >
> > > you are not suggesting that which value will be used (from first or
> second
> > > CH), or if the connection will be aborted, to be implementation
> dependant
> > > *by design* , do you?
> >
> > I'n not sure I understand your question, but I'll try to answer what I
> > think it says.
> >
> > 1. I do think that whether you continue the connection or abort it is an
> > implementation decision and I think that the way the spec is written says
> > that.
> > 2. I think the spec leaves open whether you should use the first or
> second
> > values, but I think implementations should use the second value. It's not
> > clear why one would want to use the first.
>
> because you have already parsed, verified and sanity-checked the first
> hello,
> you already decided what kind of parameters will the connection use and
> you're
> expecting just the values that can change to change and ignoring
> everything
> else, thus not wasting cycles on verifying the extensions twice...
>

As MT says, we use a stateless design, and we don't necessarily verify the
entire
CH prior to sending HRR. For instance, it's not necessary to do certificate
selection
and hence not to look at signature_algorithms.



> so it's not clear to me why you'd ever want to use the second one
>

Well, clearly views differ on this, then.



> > To my knowledge, there was never a WG discussion about this exact
> question,
> > so we only have the spec to guide us. Were we pre-publication I would
> have
> > advocated for (a) leaving open whether to abort and (b) requiring you to
> > use the second value.
>
> so you don't think this qualifies for Errata?
>

What Ben said.

-Ekr


>
> side note: it is actually possible to check if the 2nd CH has minimal
> changes
> in stateless HRR by replacing the extensions that can change with the
> hashes
> of their values and then storing the overall hash of CH message together
> with
> hashes of the extensions that can change. When receiving the 2nd CH, we
> can
> replace the extensions that can change with respective hash values and
> then
> check if the overall hash still matches. That translates to something like
> 4
> hashes, two positions and two flags (for padding and early_data). Only
> this
> much is necessary to check perfectly if the CH is unchanged. The only
> exception is pre_shared_key, but server behaviour with it is clearly
> defined -
> the server must use the values from 2nd CH as the selected_identity
> wouldn't
> match otherwise and binders couldn't be verified. With addition of one
> more
> hash in the cookie the server may easily ensure that the identity it
> planned
> to select remained in the CH. That's like 165 bytes when using
> non-truncated
> sha-256 hashes.
>
> --
> Regards,
> Hubert Kario
> Senior Quality Engineer, QE BaseOS Security team
> Web: www.cz.redhat.com
> Red Hat Czech s.r.o., Purkyňova 115, 612 00  Brno, Czech Republic