Re: [TLS] close_notify and TLS 1.3

Martin Thomson <martin.thomson@gmail.com> Sun, 12 November 2017 01:47 UTC

Return-Path: <martin.thomson@gmail.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 407BD124BFA for <tls@ietfa.amsl.com>; Sat, 11 Nov 2017 17:47:40 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 BFqIIX3TZg8z for <tls@ietfa.amsl.com>; Sat, 11 Nov 2017 17:47:38 -0800 (PST)
Received: from mail-ot0-x22d.google.com (mail-ot0-x22d.google.com [IPv6:2607:f8b0:4003:c0f::22d]) (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 53C28126E7A for <tls@ietf.org>; Sat, 11 Nov 2017 17:47:38 -0800 (PST)
Received: by mail-ot0-x22d.google.com with SMTP id 105so1998626oth.10 for <tls@ietf.org>; Sat, 11 Nov 2017 17:47:38 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=mkPCBdM8d3KmEG/DqjeP7xsUFIQxJfOv8yJAudZWmxk=; b=ELlJ3dlg8z+gQymZXqICiGXLI4ncG0mYanQVBDS7Ym5UpRNh6BmY5Lmhia7KUOluCO PxPYY/QAzCEBqICrtpNKfTzaGCeZ+5ZDgu151KuhiKQavW6ep/jZkkR7+nGcQW5TpTCH frdJ62/2V+lYAiAVEpISVzi3Gc0Ghn7pFEmMFMUkOK4VPUil6NtXOiFj67jVQA3x9B4j 93Fviz+BGq1gfJNmrK+p2/zUK3VwxztODAmJuxrSUMCmOPW6+5B2OQ2RtA2VB7cPyxwc 4onY9NruDfyuqSM+Rt5CODSxwUhb1Z1oosYkdcS+WL54RwNYCi/TizyeJH52IXBW+r3t yWiw==
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:content-transfer-encoding; bh=mkPCBdM8d3KmEG/DqjeP7xsUFIQxJfOv8yJAudZWmxk=; b=Ii70TW5PZVtGsxFlPUNb6GMFyQ7lyiUvsEnXo651mmQlCG0LHwvVQA56qoAwSgRUIq dGM0wypyM8Z+/+spKi2nNtrINU170iL68xmO1NisTVKdfLvXwIRnZbonKslJLZuTa705 zSJ1+BeJ7diqaSAxLngKH7gTA0j6e3103lJQNfY9CUH6qcDVVHBGkMDDyEHvjdFpkuba zV8hTrLzMxPB2AqANxxqd7J4NizrIHugJbgpMOIJx5ltkwyKrr/CnIrqcT84QhyfMNHA CTUiVlAScdXlUKS7m4qHZEWuITo5gNFycIbisqgClvz9i3+Z6gXklGNI86I9O+eiVMQw GnSg==
X-Gm-Message-State: AJaThX45pQzm3fdfkIB+/IuX+ZTP5Icz0SdG/qFvwpuFrfuNIuGIcLLz e62WPU1iR5FnC4qZWVOZonEep+LlHo2hgQ7uCWg=
X-Google-Smtp-Source: AGs4zMaJy9KNWrNsrMsS8WZtymmQwOcc0CZ0iaNgpKrMUwaAXKoJINQAIlNopssxiOsKQxH3mJtLOxOCY7nH7uG1la0=
X-Received: by 10.157.53.8 with SMTP id o8mr3411270otc.35.1510451257609; Sat, 11 Nov 2017 17:47:37 -0800 (PST)
MIME-Version: 1.0
Received: by 10.157.8.11 with HTTP; Sat, 11 Nov 2017 17:47:37 -0800 (PST)
In-Reply-To: <CABcZeBPHGNHBtx4c3=jPS8-PJDHF3E608KoDswJucbaiFFkYwg@mail.gmail.com>
References: <A6C599ED-3F3D-462F-9B39-1FEF6A0B549B@apple.com> <CABkgnnU3OuzEm2gF6BYif4c0evAfzUYH-PpxoERD9xFEosQ_oQ@mail.gmail.com> <CAF8qwaB2fXoiy8RLdg9Kc+5xAoCgU2JkoHXw8H-xSsEXMWWgXg@mail.gmail.com> <CABcZeBPHGNHBtx4c3=jPS8-PJDHF3E608KoDswJucbaiFFkYwg@mail.gmail.com>
From: Martin Thomson <martin.thomson@gmail.com>
Date: Sun, 12 Nov 2017 09:47:37 +0800
Message-ID: <CABkgnnWwPY_ksXxqDuJ5K1pY1HryszGHOp89J7cYH39iv-DcCQ@mail.gmail.com>
To: Eric Rescorla <ekr@rtfm.com>
Cc: David Benjamin <davidben@chromium.org>, "tls@ietf.org" <tls@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/4-RKBc_wrlBcj9hS0plKFu3ei1o>
Subject: Re: [TLS] close_notify and TLS 1.3
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: Sun, 12 Nov 2017 01:47:40 -0000

We suppress the sending of a close_notify if we have received one, but
that's a fairly simple thing to correct.

On Sun, Nov 12, 2017 at 9:13 AM, Eric Rescorla <ekr@rtfm.com> wrote:
> Initial inspection suggests that NSS behaves the same way, so I would be
> fine with this change.
>
> -Ekr
>
>
> On Sat, Nov 11, 2017 at 3:46 PM, David Benjamin <davidben@chromium.org>
> wrote:
>>
>> I think this change is a good idea.
>>
>> Our implementation actually does this already anyway. We are happy to
>> continue servicing writes even when the read half has consumed a
>> close_notify. I believe we inherited this behavior from OpenSSL, so it
>> should be there too. Go's crypto/tls implementation appears to also already
>> do this.
>>
>> We don't have a particular need for the half-close semantics that I know
>> of, but I don't care for the current spec text (it requires yet another
>> undesirable read/write sync point). Aligning with TCP's semantics is also
>> generally a good default.
>>
>> On Sat, Nov 11, 2017 at 11:18 PM Martin Thomson <martin.thomson@gmail.com>
>> wrote:
>>>
>>> This seems like it might be worth looking at.  This seems to be
>>> something that harks back to SSL3 or even earlier.  We aren't going to
>>> make it so that you can rely on this behaviour, but we might be able
>>> to make it possible to half-close, which for new protocols using TLS
>>> could be hugely useful.
>>>
>>> On Sat, Nov 11, 2017 at 5:21 PM, David Schinazi <dschinazi@apple.com>
>>> wrote:
>>> > Hello all,
>>> >
>>> > Currently TLS 1.3 specifies close_notify in the same way that TLS 1.2
>>> > did.
>>> > I believe that has issues and this might be the right time to fix them.
>>> > The purpose of close_notify is to protect against data truncation
>>> > attacks,
>>> > each side is required to send close_notify before closing the write
>>> > side of
>>> > the transport connection so the other side knows that the data was not
>>> > truncated.
>>> > As such, close_notify only needs half-close semantics to prevent
>>> > truncation.
>>> >
>>> > However, the specification contains the following text:
>>> > << Each party MUST send a “close_notify” alert before closing the write
>>> > side
>>> >     of the connection, unless some other fatal alert has been
>>> > transmitted.
>>> >     The other party MUST respond with a “close_notify” alert of its own
>>> > and
>>> > close
>>> >     down the connection immediately, discarding any pending writes. >>
>>> >
>>> > This means that an application-layer client can't send a query then
>>> > close
>>> > their
>>> > write transport when they know that they're done, because the server
>>> > would
>>> > terminate the TLS session before sending the reply. On top of this,
>>> > when
>>> > the server receives the close_notify, it may have already sent part of
>>> > the
>>> > reply
>>> > (or wrote it to the socket send buffer) so the responding close_notify
>>> > would
>>> > in effect be inflicting a truncation attack on the client.
>>> >
>>> > This doesn't make much difference for HTTP because clients already
>>> > don't close their write transport after sending a reply, however having
>>> > the
>>> > option do do this could allow innovation in new protocols that can
>>> > define
>>> > the semantics of when they use close_notify. An example is DNS PUSH:
>>> > https://tools.ietf.org/html/draft-ietf-dnssd-push
>>> >
>>> > A proposal to solve this problem would be to give close_notify
>>> > half-close
>>> > semantics: we keep the requirements that a close_notify be sent before
>>> > closing the transport, and that any data received after a close_notify
>>> > is
>>> > ignored, but we simply remove the requirement to immediately reply
>>> > with a close_notify. This has the advantage that current
>>> > implementations
>>> > are already compliant but future ones can leverage this improvement.
>>> >
>>> > What do you think? Is this worth discussing on Thursday?
>>> >
>>> > Thanks,
>>> > David Schinazi
>>> >
>>> > _______________________________________________
>>> > TLS mailing list
>>> > TLS@ietf.org
>>> > https://www.ietf.org/mailman/listinfo/tls
>>> >
>>>
>>> _______________________________________________
>>> TLS mailing list
>>> TLS@ietf.org
>>> https://www.ietf.org/mailman/listinfo/tls
>>
>>
>> _______________________________________________
>> TLS mailing list
>> TLS@ietf.org
>> https://www.ietf.org/mailman/listinfo/tls
>>
>