[TLS]Re: DTLS 1.3 epochs vs message_seq overflow

David Benjamin <davidben@chromium.org> Fri, 26 July 2024 05:17 UTC

Return-Path: <davidben@google.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 0B985C16942C for <tls@ietfa.amsl.com>; Thu, 25 Jul 2024 22:17:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -9.403
X-Spam-Level:
X-Spam-Status: No, score=-9.403 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.148, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001, USER_IN_DEF_SPF_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=chromium.org
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id An80PK9E5JQP for <tls@ietfa.amsl.com>; Thu, 25 Jul 2024 22:17:20 -0700 (PDT)
Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D2042C169421 for <tls@ietf.org>; Thu, 25 Jul 2024 22:17:20 -0700 (PDT)
Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-e04196b7603so1511872276.0 for <tls@ietf.org>; Thu, 25 Jul 2024 22:17:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1721971040; x=1722575840; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dGWD1su1rRvZrrrmd3tkKrnMNeoVPXyAFlNLx6x+4Sw=; b=LnWj3IbbpIM5rlaqaoayXRskRLmAsflP6P7UndsRD3jLfCwv44e8D6Mmpct4Wim4TL XSDNhJDzr/d606OqOuCuYA1hOI+I17JA5PiXMlby4DZnkQUa9TqdsuQvXBqlAzfgd6Yp 2+BeLRKilYSOgvC9W0rZ16T5dhGD/f7GvpVjk=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721971040; x=1722575840; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dGWD1su1rRvZrrrmd3tkKrnMNeoVPXyAFlNLx6x+4Sw=; b=fpbP987gbB+V7q4ZLMBCi3xFKraB/mWKwJBB1PlBzdpIyjFGt9/0ujrN4q1gTozwty JW2ZAqpaK9wxZ8CLDKYOyS3SzEY/zOapJ0yTTKu+qZpr6Y4TPFZgN+jVbSXOR/QpHALQ 0ZIdRLZBDTv6mQszIHY+iPRYIbDGq+aLfbHH4Ap3LQyXVImXyRtBrv30V15NDvAakguz AEBOZXtK55vhGCJGYgFFS1sOrNK/YgsQlvGumGbBOgO5MRr5E9QbCVPUFoIS+LVSIw+F podIaTDMip1Dv6CpxEr8U7KMPqetaufHE81OntPTEUtHLnmdu30SV/ilOHeA7GMRzP/p G5kA==
X-Gm-Message-State: AOJu0YzsAvuw78rm7wHFfJqFhmGrBq69FImPq2edVmxWegTC7c7fHhcz 880PV5if06xMTCsm+5YhzPm3b4v5JqtmhuG6e8vUl16RKW/W6Cj6SiXVvy1EH/Rer4CUHEdz6Lr tsE0JZRt1kfZoKx1yNnC8tr6FkYQb2YPNKz4=
X-Google-Smtp-Source: AGHT+IE9H2pkR/ru9pHDGDT+Dt9etGZvqSa1oQwclXz6C05k+qCp39gS5Yk+4ORL7i0yG+JZoFosr0n2B5Y1VwNtHeE=
X-Received: by 2002:a05:6902:2488:b0:e08:5703:219c with SMTP id 3f1490d57ef6-e0b2ca7f4c5mr4445697276.23.1721971039606; Thu, 25 Jul 2024 22:17:19 -0700 (PDT)
MIME-Version: 1.0
References: <CAF8qwaCr=FJU6TbqXscxQ5ezCVxREU_iiSQ5fO+UMsUEV_W1tA@mail.gmail.com> <CAF8qwaB1trnvAX7DXH94QHq9ZjyPz-YpqSgK5Rn9Jq2Qig_CVA@mail.gmail.com> <AS8PR10MB7427AE63B48D789CF218A22CEE082@AS8PR10MB7427.EURPRD10.PROD.OUTLOOK.COM>
In-Reply-To: <AS8PR10MB7427AE63B48D789CF218A22CEE082@AS8PR10MB7427.EURPRD10.PROD.OUTLOOK.COM>
From: David Benjamin <davidben@chromium.org>
Date: Thu, 25 Jul 2024 22:17:01 -0700
Message-ID: <CAF8qwaA=focCJVowVdh2xhEw5nZQiqqPAUk_5AgPSkmL8mDnyw@mail.gmail.com>
To: "Tschofenig, Hannes" <hannes.tschofenig@siemens.com>
Content-Type: multipart/alternative; boundary="00000000000021adc3061e1fa0ce"
Message-ID-Hash: OU45UCJC6RFIY3RRCM4DYGPSMEFGIRCM
X-Message-ID-Hash: OU45UCJC6RFIY3RRCM4DYGPSMEFGIRCM
X-MailFrom: davidben@google.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tls.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: "<tls@ietf.org>" <tls@ietf.org>, Nick Harper <nharper@chromium.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [TLS]Re: DTLS 1.3 epochs vs message_seq overflow
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/2JiGONFJiLX0XqO5u0iF964ER8o>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Owner: <mailto:tls-owner@ietf.org>
List-Post: <mailto:tls@ietf.org>
List-Subscribe: <mailto:tls-join@ietf.org>
List-Unsubscribe: <mailto:tls-leave@ietf.org>

Circling back to this thread, I think the best thing to do is to just
concede we failed to actually increase the epoch space and permit
implementations to keep it 16-bit. We can try again in DTLS 1.4, or just
fully revert to a 16-bit epoch space.

I've filed the following errata to do this:
https://www.rfc-editor.org/errata/eid8048
https://www.rfc-editor.org/errata/eid8050

David

On Tue, Apr 16, 2024 at 2:16 AM Tschofenig, Hannes <
hannes.tschofenig@siemens.com> wrote:

> Hi David,
>
>
>
> thanks for your reviews and the details comments.
>
>
>
> Let me search for the exchanges that lead to the increase in the epoch
> space. I recall that this was very late in the process based on feedback
> from John, who noticed that the smaller epoch space helps IoT communication
> but not the DTLS use in SCTP.
>
>
>
> Regarding your statement: “65K epochs should be enough for anybody,
> perhaps DTLS 1.4 should update the RecordNumber structure accordingly and
> save a few bytes in the ACKs“. Possibly correct. I am going to ask the
> SCTP community for feedback to find out whether that is also true for them.
>
>
>
> Ciao
>
> Hannes
>
>
>
> *From:* TLS <tls-bounces@ietf.org> *On Behalf Of *David Benjamin
> *Sent:* Friday, April 12, 2024 1:16 AM
> *To:* <tls@ietf.org> <tls@ietf.org>
> *Cc:* Nick Harper <nharper@chromium.org>
> *Subject:* Re: [TLS] DTLS 1.3 epochs vs message_seq overflow
>
>
>
> On Thu, Apr 11, 2024 at 7:12 PM David Benjamin <davidben@chromium.org>
> wrote:
>
> Hi all,
>
>
>
> In reviewing RFC 9147, I noticed something a bit funny. DTLS 1.3 changed
> the epoch number from 16 bits to 64 bits, though with a requirement that
> you not exceed 2^48-1. I assume this was so that you're able to rekey more
> than 65K times if you really wanted to.
>
>
>
> I'm not sure we actually achieved this. In order to change epochs, you
> need to do a KeyUpdate, which involves sending a handshake message. That
> means burning a handshake message sequence number. However, section 5.2
> says:
>
>
>
> > Note: In DTLS 1.2, the message_seq was reset to zero in case of a
> rehandshake (i.e., renegotiation). On the surface, a rehandshake in DTLS
> 1.2 shares similarities with a post-handshake message exchange in DTLS 1.3.
> However, in DTLS 1.3 the message_seq is not reset, to allow distinguishing
> a retransmission from a previously sent post-handshake message from a newly
> sent post-handshake message.
>
>
>
> This means that the message_seq space is never reset for the lifetime of
> the connection. But message_seq is a 16-bit field! So I think you would
> overflow message_seq before you manage to overflow a 16-bit epoch.
>
>
>
> Now, I think the change here was correct because DTLS 1.2's resetting on
> rehandshake was a mistake. In DTLS 1.2, the end of the previous handshake
> and the start of the next handshake happen in the same epoch, which meant
> that things were ambiguous and you needed knowledge of the handshake state
> machine to resolve things. However, given the wider epoch, perhaps we
> should have said that message_seq resets on each epoch or something. (Too
> late now, of course... DTLS 1.4 I suppose?)
>
>
>
> Alternatively, if we think 65K epochs should be enough for anybody,
> perhaps DTLS 1.4 should update the RecordNumber structure accordingly and
> save a few bytes in the ACKs. :-)
>
>
>
> Does all that check out, or did I miss something?
>
>
>
> David
>
>