Re: [TLS] Server validation of a second ClientHello

Hubert Kario <hkario@redhat.com> Wed, 13 February 2019 15:40 UTC

Return-Path: <hkario@redhat.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 2FF1812D826 for <tls@ietfa.amsl.com>; Wed, 13 Feb 2019 07:40:00 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.901
X-Spam-Level:
X-Spam-Status: No, score=-6.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 mZxJRnyFR9Wp for <tls@ietfa.amsl.com>; Wed, 13 Feb 2019 07:39:58 -0800 (PST)
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2D327129441 for <tls@ietf.org>; Wed, 13 Feb 2019 07:39:58 -0800 (PST)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CB83A66967; Wed, 13 Feb 2019 15:39:57 +0000 (UTC)
Received: from pintsize.usersys.redhat.com (unknown [10.43.21.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFA2A60466; Wed, 13 Feb 2019 15:39:56 +0000 (UTC)
From: Hubert Kario <hkario@redhat.com>
To: Eric Rescorla <ekr@rtfm.com>
Cc: Martin Thomson <mt@lowentropy.net>, "<tls@ietf.org>" <tls@ietf.org>
Date: Wed, 13 Feb 2019 16:39:49 +0100
Message-ID: <25414967.ZWlNe5bkUN@pintsize.usersys.redhat.com>
In-Reply-To: <CABcZeBP=MGrj4x5brO5t5uf4tYumkL3Vthu=4zwhBHOYpsSJyQ@mail.gmail.com>
References: <1549596678.898774.1653407000.2B2ACE8E@webmail.messagingengine.com> <103341275.xSgb4icBHy@pintsize.usersys.redhat.com> <CABcZeBP=MGrj4x5brO5t5uf4tYumkL3Vthu=4zwhBHOYpsSJyQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="nextPart1674281.7d03IiLBUj"; micalg="pgp-sha512"; protocol="application/pgp-signature"
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 13 Feb 2019 15:39:57 +0000 (UTC)
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/pR2S-F6GJT-z1NwMVkMtH-5GNc0>
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 15:40:00 -0000

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...

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

> 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?


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