Re: [Cfrg] Using ephemeral DH in lieu of fresh nonces

Loup Vaillant-David <loup@loup-vaillant.fr> Mon, 22 June 2020 15:21 UTC

Return-Path: <loup@loup-vaillant.fr>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 8F6063A0D93 for <cfrg@ietfa.amsl.com>; Mon, 22 Jun 2020 08:21:57 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 N8TRp-nBNUxV for <cfrg@ietfa.amsl.com>; Mon, 22 Jun 2020 08:21:55 -0700 (PDT)
Received: from smtp.loup-vaillant.fr (smtp.loup-vaillant.fr [92.243.1.174]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 767143A0BF1 for <cfrg@ietf.org>; Mon, 22 Jun 2020 08:21:55 -0700 (PDT)
Received: from grey-fade (lns-bzn-60-82-254-246-40.adsl.proxad.net [82.254.246.40]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: loup) by smtp.loup-vaillant.fr (Postfix) with ESMTPSA id 297D83DA1; Mon, 22 Jun 2020 17:11:43 +0200 (CEST)
Message-ID: <000456a5f2e87af621c727b21da2ffeca3343495.camel@loup-vaillant.fr>
From: Loup Vaillant-David <loup@loup-vaillant.fr>
To: Hugo Krawczyk <hugo@ee.technion.ac.il>, "<cfrg@ietf.org>" <cfrg@ietf.org>
Date: Mon, 22 Jun 2020 17:21:52 +0200
In-Reply-To: <CADi0yUM6MQd0TPczK+YKSdbu1nzFaV+peC_0yf9Soat8d3+eLg@mail.gmail.com>
References: <326ebefc65c17f7fc11879b9b966a1e4585b1f16.camel@loup-vaillant.fr> <CADi0yUM6MQd0TPczK+YKSdbu1nzFaV+peC_0yf9Soat8d3+eLg@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"
X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2
Mime-Version: 1.0
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/XEDus3RExYyeQBD9cp2LHvF8pqw>
Subject: Re: [Cfrg] Using ephemeral DH in lieu of fresh nonces
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jun 2020 15:21:58 -0000

Hi Hugo,

Thank you so much for your response, it forced me to change my mind on
a couple points.

How using a primitive for several purposes was new to me. Now I need to
re-consider the design of Monokex, my Noise-like protocol framework
(Noise is amazing, but I felt it could be further simplified): both
framework use ephemeral keys as nonces. The Noise specifications
insists that no party shall send encrypted stuff before they mix their
own ephemeral key in the key mix.

Composition attacks also make my head hurt, so squashing them simply
with a session id sounds like a good safety belt, in case I design a
brittle protocol that would otherwise be vulnerable.

Loup.


On Mon, 2020-06-22 at 11:01 -0400, Hugo Krawczyk wrote:
> In the email below, Loup raises a natural question: Why not reuse
> ephemeral DH values in a protocol instead of fresh nonces?
> 
> Formalisms apart, fresh non-repeating session identifiers are
> essential for many reasons: against replay attacks, for binding
> session flows together, avoiding  "composition attacks" (e.g., where
> flows from different sessions are mixed-and-matched), ensuring domain
> separation, etc. A natural implementation of session id's uses
> session-specific fresh random nonces. An equally natural question
> (and I think your email was referring to this issue) is why not use
> the ephemeral DH in lieu of random nonces, after all these values are
> selected as fresh random values for each session. 
> 
> A generic reason (which I strongly advocate) for not doing so is that
> one should avoid having the same element in the protocol to serve 
> two separate functionalities/roles (in this case it would be using a
> DH value as key share and also as nonce/sessionid). This results in
> fragile protocols that can easily go wrong with variants of the
> protocol or when the protocol evolves over time, and is prone to bad
> implementations. For example, if one of the roles of this element is
> not  required anymore (due to changes in the protocol or changes in
> the setting where the protocol operates), the element may be changed
> "without remembering" that it had this other role. 
> 
> Concretely, in the case of using ephemeral DH values for freshness,
> there are good practical examples where security breaks with the dual
> use of these values. For example, an application may decide (e.g.,
> for performance reasons) that they do not need "perfect" forward
> secrecy, but that a one-minute forward-secrecy window of repeated
> ephemeral DH values is enough for the application. With repeated DH
> values used as session ids, the uniqueness of the session id is
> gone.  This is also the case of applications that need to avoid
> forward secrecy at all (see requests for a static version of TLS 1.3
> in the TLS mailing list). Yet another example is the SIGMA-I protocol
> (used in TLS 1.3 and IKEv1). If the initiator sends g^x in the first
> message, this value can be used against replay attacks in the
> responder's signature. Then, someone decides (and there may be good
> reasons for that) to send g^x only in the third message and you lose
> your anti-replay mechanism.
> 
> Mea culpa: I have used ephemeral DH values in the dual functionality
> of key shares and session identifiers in several of my papers for the
> sake of analysis/notation simplicity. But you should not do it when
> building real-world implementations. In the SIGMA instantiation in
> draft-krawczyk-cfrg-opaque, for example, nonces are used in addition
> to DH values. (See also appendix B of 
> https://webee.technion.ac.il/~hugo/sigma-pdf.pdfdf )
> 
> Hugo