Re: [CFRG] Does OPRF/OPAQUE require full implementation of RFC 9380

Mike Hamburg <mike@shiftleft.org> Sat, 30 March 2024 15:18 UTC

Return-Path: <mike@shiftleft.org>
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 3BE8DC14F693 for <cfrg@ietfa.amsl.com>; Sat, 30 Mar 2024 08:18:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.096
X-Spam-Level:
X-Spam-Status: No, score=-2.096 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, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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 (1024-bit key) header.d=shiftleft.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 G1_8O22GxMqK for <cfrg@ietfa.amsl.com>; Sat, 30 Mar 2024 08:18:43 -0700 (PDT)
Received: from wanderer.shiftleft.org (wanderer.shiftleft.org [45.79.68.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 A2CC2C14F617 for <cfrg@irtf.org>; Sat, 30 Mar 2024 08:18:43 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: mike) by wanderer.shiftleft.org (Postfix) with ESMTPSA id 14E954224E; Sat, 30 Mar 2024 15:18:41 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shiftleft.org; s=sldo; t=1711811922; bh=Byi9AAZLMuRmE7WButL7M5jQ96MAEDvaSlpCWsKpcTA=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=PfT7+ljAr6pJ+n7WIXptJcwAe+efGS10T7d9naBumhX/VaKxRJq+2lL0epb10DcoS ro0XEM+JhcxB1uXtF694Ql1yIgKpaax5YdADZ9mXn3+bm4s2UIRdZsXyFZ0JsJrI/X rUY+JOXe2i1fNBGxt+ZFQl/p1Ep2HubcbbjFVD/8=
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.500.171.1.1\))
From: Mike Hamburg <mike@shiftleft.org>
In-Reply-To: <69c770f4-ba21-4497-bccf-56f5357988ec@aaa-sec.com>
Date: Sat, 30 Mar 2024 11:18:30 -0400
Cc: stef <s@ctrlc.hu>, IRTF CFRG <cfrg@irtf.org>
Content-Transfer-Encoding: quoted-printable
Message-Id: <D62E408E-EFF1-4A40-BF7F-D8E12B41A716@shiftleft.org>
References: <410a0800-78ff-422f-8ca3-5a0211478cbd@aaa-sec.com> <ZggEdsYNOnNmxcsb@localhost> <69c770f4-ba21-4497-bccf-56f5357988ec@aaa-sec.com>
To: Stefan Santesson <stefan@aaa-sec.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/BLQYsZma0QOoRC0u3P4UxiSRunw>
Subject: Re: [CFRG] Does OPRF/OPAQUE require full implementation of RFC 9380
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://mailman.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://mailman.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Sat, 30 Mar 2024 15:18:48 -0000

Hi Stefan,

I haven’t studied OPRF/OPAQUE in detail.  But I believe that yes, it is critically important to implement it using hashToGroup(x) rather than as g^hashToScalar(x).  If it were g^hashToScalar(x), and the server’s secret were k, then the OPRF protocol would output

h := g^(k * hashToScalar(x))

which would then be hashed again client-side.  But having received this value, a malicious client could calculate the value h’ corresponding to another password x’, as:

h’ = h^(hashToScalar(x’) / hashToScalar(x)).

If I am reading the protocol correctly, this would allow the malicious client to brute-force the password, since the client’s first message is not otherwise bound to a specific password, but the server’s response includes enough information to check a guess.  Constructing the OPRF using hashToGroup instead prevents this attack, because finding

hashToGroup(x')^k

from

hashToGroup(x), hashToGroup(x)^k

ought to be hard, because hashToGroup’s output should look unstructured.  If its output were truly random (i.e. in the random oracle model), this would be a computational Diffie-Hellman (CDH) problem, or rather a one-more-CDH because a client could try to connect several times.

Regards,
— Mike

> On Mar 30, 2024, at 10:53 AM, Stefan Santesson <stefan@aaa-sec.com> wrote:
> 
> Hey,
> 
> Thanks a lot for the answers.
> 
> Right now I'm more interested in the security analysis than interop. So right now I'm mostly interested if there is a distinct and important security requirement to implement hashToGroup a´la RFC 9380, of if a simpler approach as the one I showed would do the job. And if not, why?
> 
> Regarding library support I haven't found any libraries implementing P-256 OPRF in the platforms I'm looking for which is mobile development, Java and Python.
> Where can I find all current implementations of OPRF/OPAQUE, and in particular hathToGroup and hashToScalar ?
> 
> /Stefan
> 
> 
> On 2024-03-30 13:24, stef wrote:
>> hey, Stefan.
>> 
>> On Sat, Mar 30, 2024 at 12:56:10PM +0100, Stefan Santesson wrote:
>>> Note that there are not even a "MUST" expressed here. Just a "must" and
>>> therefore not a requirement according to section 1.1.
>> nothing really is a must, but if you don't implement the hashtogroup as per
>> the rfc you will not be able to satisfy the test vectors, and if you don't
>> satisfy the test vectors it is difficult to claim compliance with the rfc. and
>> also compatibility with all the other implementations. if that is ok with you,
>> you should be doing whatever you want.
>> 
>> tbh i also think this is overkill since for some groups, like ristretto255 for
>> example there is a widely used hashtogroup available in most big
>> implementations (like crypto_scalarmult_ed25519 and
>> crypto_core_ristretto255_from_hash in libsodium). but i do understand that for
>> other curves this might be more involved, and seems to be also problematic as
>> - afaik - there has been for 20 years attempts made at defining a hashtogroup
>> that applies to all widely used - standardized - groups be it curves or dlog...
>> 
>>> Finally, is there any support for G.hashToGroup being planned in any major
>>> libraries supporting OPRF/OPAQUE?
>> i don't quite understand what you mean with "being planned", as as far as i
>> know all of the implementations that satisfy the test vectors have this
>> implemented, and liboprf
>> https://rad.ctrlc.hu/nodes/rad.ctrlc.hu/rad:z3P9keM4KFAMp8wZuULi71VS7cWwp/tree/src/oprf.h#L105
>> exports this also via the .h file. i suppose all others conforming to
>> testvectors do so too.
>> 
>> greets,
>> stefan
> 
> _______________________________________________
> CFRG mailing list
> CFRG@irtf.org
> https://mailman.irtf.org/mailman/listinfo/cfrg