Re: [TLS] Interaction between cookies and middlebox compat mode

Eric Rescorla <ekr@rtfm.com> Thu, 28 December 2017 18:07 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 28BCC12D96C for <tls@ietfa.amsl.com>; Thu, 28 Dec 2017 10:07:30 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 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_NONE=-0.0001, URIBL_BLOCKED=0.001] 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 Y22AMrBGHYrg for <tls@ietfa.amsl.com>; Thu, 28 Dec 2017 10:07:28 -0800 (PST)
Received: from mail-yb0-x235.google.com (mail-yb0-x235.google.com [IPv6:2607:f8b0:4002:c09::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 5DC1E12D969 for <tls@ietf.org>; Thu, 28 Dec 2017 10:07:28 -0800 (PST)
Received: by mail-yb0-x235.google.com with SMTP id u107so3763824ybi.2 for <tls@ietf.org>; Thu, 28 Dec 2017 10:07:28 -0800 (PST)
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=oOVjaON4XM+s8LBlLuKJcD+cbB/7tVBCegw4Bxx4+N8=; b=rM+xQgG410mD8qvrVoqFu3WVsKsQ/iHE4osYKRXW03dQJCilc92KSTc+QmYFlcfI3E T9ro8c9xTA0YO20h4r3TfMlTGV1ZF4vxvjC/TGlKwMvc2+fiL/Y4vNwbg6Fe7NcfEz3i mU0WeEoTPO3ImRzbkSjQmCICf85POpk5sZ6IQagYRfzHmzMUalbVgICcpZ7ZWB03TPOc vnqIv0d7qsnQpQWEE4iB4bOJecnIJMFiH3cG2Xhzv+R5h5Mq+28rHvaKVJe21v/sFVCS zgKuMq+Ia5jRVYqoOn1AYe3Z2fXk/aLLJulqZ4RUpf2UMAfXr2qS5Es34nbtdl5hb8vq wCYQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oOVjaON4XM+s8LBlLuKJcD+cbB/7tVBCegw4Bxx4+N8=; b=gi3HaZoWI7SWAOrmOGLbPpxCSUGjLSYm1C3jvcQSOpXU+eNom7AIVpKQKY7d03wtne wUghv34ZjfDQ5NXHxz1jTOsh9R+b4mblmWkFGlGq9f3m8Ds3I6HLqHZ6lgylSnHgJReW 5BTUoOKUPEdvKXy56uuzOEzqUSAo+1YivojwQfTBLAcmvhW5v7WOFvi76hYkwGAJPedc vPACFwASNAiuWc8Dkx9R/kZ385gSGsrTlflSgbdkIQ4UMFrsp00thflDac/WjQ3xay+V 4uhl+2LOsLyT6sOu0D/ZqlTuZNN3LE6NHDY9P47S+G8YQsW9y+kyNI8mo5IzX1ruc9VI 3Apw==
X-Gm-Message-State: AKGB3mIUBgV4Ofj3oeG13lerl9pYWpNcwt+jdDs1VjZc0isaCFcHi5Ro Hk2l9MHZCU4PMHJkoiCTifnvpu6Z5L6VoeLdc2gPKA==
X-Google-Smtp-Source: ACJfBosqWgKY0JYpPuyXHPXZgpOxoKdpg+ehz8EHyKDyexhTIuCiOvkhowJGI09H2ZKEZ4QiYkKSNlqvwyrgnXMNIvw=
X-Received: by 10.37.239.17 with SMTP id g17mr23581005ybd.474.1514484447546; Thu, 28 Dec 2017 10:07:27 -0800 (PST)
MIME-Version: 1.0
Received: by 10.129.123.132 with HTTP; Thu, 28 Dec 2017 10:06:46 -0800 (PST)
In-Reply-To: <62bfa0e8-ae90-5291-e179-39743994c51a@openssl.org>
References: <9a7b1178-f856-ec63-c4b7-e2b29993e133@openssl.org> <CABcZeBMS9TeR-kFem4xHiWGVyKn5LbvDomdzL6vV_3XrKkravQ@mail.gmail.com> <37a087f4-efbe-7eae-5539-d220ff67e243@openssl.org> <CABcZeBOfcKTDnc+FcTPutMazSEhg3V8_tWqzeqpv=N6ki9jN9g@mail.gmail.com> <4c37d15e-7375-d4d0-62d1-c6d295fb7080@openssl.org> <CABcZeBNii93boJJBKehxiHa8DZng4FyRZXhu0qD-jx_snzFdvA@mail.gmail.com> <a4822dc1-85c8-c4e1-f757-04786ad9fbbb@openssl.org> <CABcZeBOtCJb538RXrZkHMgV5Q63mYAhrULNPepbGADgDjer50g@mail.gmail.com> <62bfa0e8-ae90-5291-e179-39743994c51a@openssl.org>
From: Eric Rescorla <ekr@rtfm.com>
Date: Thu, 28 Dec 2017 10:06:46 -0800
Message-ID: <CABcZeBP+TooCZE7S_ZWsqi-DMSrtfV6xzqsyc7-L4zaBmfnOhA@mail.gmail.com>
To: Matt Caswell <matt@openssl.org>
Cc: "tls@ietf.org" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="089e08289ed883a7f205616a6366"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/fVkrLyOPmsBgWeET1mXb6U1KwHs>
Subject: Re: [TLS] Interaction between cookies and middlebox compat mode
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.22
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: Thu, 28 Dec 2017 18:07:30 -0000

On Thu, Dec 28, 2017 at 10:02 AM, Matt Caswell <matt@openssl.org> wrote:

>
>
> On 28/12/17 17:55, Eric Rescorla wrote:
> >
> > On Thu, Dec 28, 2017 at 9:51 AM, Matt Caswell <matt@openssl.org
> > <mailto:matt@openssl.org>> wrote:
> >
> >
> >
> >     On 28/12/17 17:42, Eric Rescorla wrote:
> >     >
> >     >
> >     > On Thu, Dec 28, 2017 at 8:12 AM, Matt Caswell <matt@openssl.org
> <mailto:matt@openssl.org>
> >     > <mailto:matt@openssl.org <mailto:matt@openssl.org>>> wrote:
> >     >
> >     >
> >     >
> >     >     On 28/12/17 12:28, Eric Rescorla wrote:
> >     >     >     I think it would be helpful
> >     >     >     to be more explicit in the text if that is the case,
> >     i.e. identify the
> >     >     >     first point in the handshake and the last point in the
> >     handshake where
> >     >     >     CCS is valid. There probably should also be some words
> >     about how servers
> >     >     >     implementing older TLS versions should handle a CCS that
> >     comes first.
> >     >     >
> >     >     >
> >     >     > I could add those.
> >     >     >
> >     >     >
> >     >     >     However, I'm concerned about the added complexity of
> >     interpreting things
> >     >     >     that way. Suddenly a CCS arriving is no longer handled
> >     by just dropping
> >     >     >     it and forgetting it - you now have to store state about
> >     that and
> >     >     >     remember it later on in the process in other TLS
> >     versions. The CCS
> >     >     >     workaround was supposed to be a simple no-op to
> >     implement and it no
> >     >     >     longer appears that way in this interpretation.
> >     >     >
> >     >     >
> >     >     > Well, it seems like the issue here is you want the client to
> >     send CH1,
> >     >     > CCS, CH2
> >     >     > so we need the server to accept that. Am I missing something?
> >     >
> >     >     The point is a stateless server will not know about CH1 at the
> >     point
> >     >     that it receives CCS.
> >     >
> >     >
> >     > Well, sort of.
> >     >
> >     > Specifically, there are three valid things that a server (whether
> >     stateless
> >     > or stateful) can receive:
> >     >
> >     > - CH1 [I.e. a CH without a cookie]
> >     > - CH2 [i.e., a CH with a cookie]
> >     > - CCS
> >     >
> >     > It should respond to any other message with an alert and abort the
> >     > handshake.
> >     > A stateful server should also tear down the transport connection,
> so
> >     > that subsequent
> >     > messages are considered an error. This obviously isn't an option
> for a
> >     > stateless server,
> >     > so, yes, a stateless server might in principle receive arbitrary
> >     amounts
> >     > of junk
> >     > before CH1 or between CH1 and CH2, and it would still survive,
> >     albeit by
> >     > sending alerts.
> >     >
> >     >
> >     >
> >     >     Actually, as Ilari points out, there could be any
> >     >     junk (including partial records) arriving between CH1 and CH2.
> >     So this
> >     >     feels more like a special case for stateless servers.
> >     >
> >     >     In other words I would prefer to say that a CCS that arrives
> >     first is
> >     >     not allowed. That simplifies the general case and requires no
> >     special
> >     >     coding for servers implementing older versions of TLS.
> >     >
> >     >
> >     > This issue only seems to arise for people who are both doing TLS
> >     1.3 and
> >     > TLS 1.2 *and* doing stateless implementations, which is kind of an
> odd
> >     > configuration because a number of the conditions in TLS 1.3 that
> >     involve
> >     > HRR (and thus can be stateless). It doesn't arise for QUIC
> (because no
> >     > TLS 1.2) and mostly doesn't arise for DTLS (if you reject all
> kinds of
> >     > junk).  Or am I wrong?
> >
> >     Correct, although technically the wording of draft-22 (in your
> >     interpretation) *requires* that a server receiving a CCS first MUST
> >     ignore it - even though that should never happen except in the weird
> >     scenario above. That is why I prefer to say that a CCS arriving
> first is
> >     always an error for the general case.
> >
> >
> > Well, you can receive a CCS first any time you're stateless. What's
> unusual
> > is having to subsequently reject it if you are stateless and *then*
> > negotiate
> > 1.2. My point is that this doesn't seem like a very big hardship for the
> > reasons
> > above.
>
> I must be missing your point. According to the spec as it stands even
> with a stateful server I MUST ignore a CCS that comes first. Since this
> is a stateful server it may end up negotiating TLSv1.2 - which requires
> us to abort the handshake if the CCS comes first. No sensible
> implementation will ever send a CCS first in this scenario, so why am I
> required by the spec to ignore it and implement the extra complexity in
> TLSv1.2 handling?
>
> In reality I wouldn't bother to implement this which would make me
> technically non-compliant. I would prefer it if the wording were fixed
> to not require this.
>

OK, I understand your point now, I think it's fine to reject this case as
long as
you properly handle things in the stateless case. If you want to submit a
PR,
I will take a look.

-Ekr


> Matt
>
>
>