Re: [TLS] Servers respond with BadRecordMac after ClientFinished, sent when PSK+EarlyData

tomoya kuwayama <thekuwayama@gmail.com> Thu, 18 August 2022 20:53 UTC

Return-Path: <thekuwayama@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 62E48C1522D1 for <tls@ietfa.amsl.com>; Thu, 18 Aug 2022 13:53:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.104
X-Spam-Level:
X-Spam-Status: No, score=-2.104 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_BLOCKED=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] 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 ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EMLIx6xyiuEP for <tls@ietfa.amsl.com>; Thu, 18 Aug 2022 13:53:20 -0700 (PDT)
Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) (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 33DEFC1522BE for <tls@ietf.org>; Thu, 18 Aug 2022 13:53:20 -0700 (PDT)
Received: by mail-lj1-x236.google.com with SMTP id q18so1794542ljg.12 for <tls@ietf.org>; Thu, 18 Aug 2022 13:53:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc; bh=QN2pGKVzq1TdyTCIIvniJM9cAMUlcgYeTDXFVrRlyUc=; b=JckUMswsNvV/4N2qeANSvudLv1R7GuXDpkt9GQrYiSWOge6GtuONf9D4soFpUSEnXo BhlTtKx8D7odSFXmRl1C5sygkarpLKRmbZyBknwOTlesALgzCWxh8VMhVDG+bMWBFYbY KGcLDplb5YX1jZFyt6GLvqsz/Ekfxtxr9eYJczNZeSPoQHKWuIzGat4tl09gI+UdF1HD Sir7twcVwMskFF1BWh4O0M71Zz8tHxNl61w6pYF998GkoUoA0QwNbha4EFDJjdbCYsjW R3coFPjMOrJQ7FwjXgcqcQo94/B7MEVWAHnfLGQf8S1+bIHKgV6GikY54Qx3fXrMDmh+ Es9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc; bh=QN2pGKVzq1TdyTCIIvniJM9cAMUlcgYeTDXFVrRlyUc=; b=ObfZATYXnnXAI6e2bNrtBof/Pm7gJ0hb/rvm0nT7YZRz3arMf1+OAAjIFzwgAMrnC2 AFRRymLAck8Npc88OX/J8gLZkRXf9x/JCo4g6uozzGL9n4+xJumceLTcZoGx1i9V4+19 Y4q3v83myy6WFwhaxB0cLXarNCVZEDxZuZIMAj+dTH4NDopSjaaRhLjFB0XahRPFf2Ac Lq5u+LRLFO2Tq8PsxQTduiNxKIdlTpmtObg/J6FpvAsj0750/wxXfRzmClxChnprHR7P xLFwvlQWMOkItuvITuB6OMXjUwNeLfrKVRq562qJbtoZU5SiT/efHNujxVUim0Mx58sU b9Ng==
X-Gm-Message-State: ACgBeo3bB/+HKf8tYAMgvQ5gPz886Tnc6Yj1bkwY3WvtjzELUTbug1Ki Z12MBspu+9IK7rvBwAUuf+u955OWnihCDbxmh1U=
X-Google-Smtp-Source: AA6agR5c4DEaRPR1Ih3rN0GmAuVYcreLUrvV72/PutOBkRE5X25Sqn2oKdVJzRPWYSc86/hsQ8R0qdSwlGhKf9MZLVE=
X-Received: by 2002:a2e:a409:0:b0:25e:724a:f788 with SMTP id p9-20020a2ea409000000b0025e724af788mr1256574ljn.300.1660855997946; Thu, 18 Aug 2022 13:53:17 -0700 (PDT)
MIME-Version: 1.0
References: <987212E5-9A26-4408-9BD5-2D26FA106D3F@gmail.com> <YvID85L+ICWVh9gi@LK-Perkele-VII2.locald> <311E53EC-C6D0-44F2-BA8E-ED15939ACEF1@gmail.com>
In-Reply-To: <311E53EC-C6D0-44F2-BA8E-ED15939ACEF1@gmail.com>
From: tomoya kuwayama <thekuwayama@gmail.com>
Date: Fri, 19 Aug 2022 05:53:06 +0900
Message-ID: <CAHCcMsyeCKKGNYezRGSVq0hZiChfEs_N80bKV3RYB+oM9_RNBA@mail.gmail.com>
To: Kristijan Sedlak <xpepermint@gmail.com>
Cc: tls@ietf.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/1E3iWi0ZVUdRhDmIyKYNo_BCtv0>
Subject: Re: [TLS] Servers respond with BadRecordMac after ClientFinished, sent when PSK+EarlyData
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.39
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, 18 Aug 2022 20:53:24 -0000

 I investigated this issue and found that TTLS13::Client does not send
EndOfEarlyData when 0-RTT.
The transcript was invalid because it did not contain EndOfEarlyData.

 By the way, I still have another question on this.
I understand that if the server has not yet received EndOfEarlyData
and it receives Finished, it should raise "bad_record_mac" alert and
not ignore the lack of EndOfEarlyData. Because it assumes messages
protected using keys derived from a "client_early_traffic_secret". Is
my understanding of this correct?

- https://www.rfc-editor.org/rfc/rfc8446.html#section-4.2.10
  - > if the server fails to decrypt a 0-RTT record following an
accepted "early_data" extension, it MUST terminate the connection with
a "bad_record_mac" alert as per Section 5.2.
- https://www.rfc-editor.org/rfc/rfc8446.html#section-4.5
  - > This message indicates that all 0-RTT application_data messages,

> After adding it, the error was gone and the connection closed with Alert(0).

In that case, when adding "Connection: close" header, it should raise
"bad_record_mac" alert, I wonder. For your reference, I created the
client that does not send EndOfEarlyData when TLS 1.3 0-RTT Handshake.

- https://github.com/thekuwayama/no_eoed_0rtt_client

2022年8月16日(火) 23:07 Kristijan Sedlak <xpepermint@gmail.com>:
>
> Hey Ilari,
>
> thank’s for replying. I did verify the transcript as well. Everything seems to be correct. I bet if it wasn't the 1-RTT and 0-RTT(no-early-data) would fail too. Something weird is going on only in 0-RTT(early-data) case.
>
> Can you maybe point me to an URL with the correct TLS1.3 implementation where I could safely test the client?
>
> Best,
> Kristijan
>
> On 9 Aug 2022, at 08:51, Ilari Liusvaara <ilariliusvaara@welho.com> wrote:
>
> Ilari
>
>
> _______________________________________________
> TLS mailing list
> TLS@ietf.org
> https://www.ietf.org/mailman/listinfo/tls