Re: [Cfrg] Multi-recipient public key authenticated encryption

Neil Madden <neil.e.madden@gmail.com> Thu, 07 May 2020 11:17 UTC

Return-Path: <neil.e.madden@gmail.com>
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 90C8B3A0061 for <cfrg@ietfa.amsl.com>; Thu, 7 May 2020 04:17:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.997
X-Spam-Level:
X-Spam-Status: No, score=-1.997 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, HTML_MESSAGE=0.001, HTTPS_HTTP_MISMATCH=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 XpfEpLCsXihb for <cfrg@ietfa.amsl.com>; Thu, 7 May 2020 04:17:35 -0700 (PDT)
Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (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 707113A005C for <cfrg@irtf.org>; Thu, 7 May 2020 04:17:34 -0700 (PDT)
Received: by mail-wr1-x42b.google.com with SMTP id h9so5911854wrt.0 for <cfrg@irtf.org>; Thu, 07 May 2020 04:17:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=nG7Pv7kI6vsZriVsOGkDV41Qs/6Ip9AhJjWx2XWZ3cU=; b=Rdek9M2Ddx5PUqAK1kFCB4UMoeyLyYrTTvouayX2rN9FIyVVq+SL3JUIWX2oktKJ8l oPzMZ2lLzHWihaO3vltJdlKaBJ3VQXHuzrsyq4jmJY4J9AhcGvVzyI1UFJQCZX7+uvVN 3iSm5GnzCDuMMjHERdsgcnvvEk/dmqPulUcDQRV8hjiMLHB9kc9Bcyu/zn7LwlPy7zUI ZWETNUrxG4FfWk6DPDEE73ZcOFeEVD6TQbt2lwt2WOQ5cX0SijtIAal1cCzup007qzDK 6cQitoGnkGssw9FspBD8VYERf/zqLqi24JJ61bDJrbm/ALQBzFfolh3iwrSL76fgHt8N fEpw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=nG7Pv7kI6vsZriVsOGkDV41Qs/6Ip9AhJjWx2XWZ3cU=; b=MOV8+AS4ao8DVTZyohaE7XljiRu8anM/H2duO/Y0y39nHOOas38tk02yHUoXyV1W5F sIfiSjQWIyaG8UVluDvAsg5iVWkho4vUkBLM1GlbHaM4QgMSXia1G7I6q2Vs3it9uQRQ WWEBz06n0JFc04iYhhzYx64KTLRLpphvleqRHB8wwyQVWYcGlumsD3+Y0GFHu6hFVMTr nSNc0cxGDXuL3hbjlfhu9WVtNGzeBQd9uZDwG4trUbPac//F1WIBNSfyTbYvWk67wD2Z 1rG+w0YpJCY+s6KHvNXnI4XQt2YPCwVjDGs6ljxrxkuLqSfXfYf8NSG3wTBsbeY7tPK+ CVfw==
X-Gm-Message-State: AGi0PuY3aBw02ak5hvkLYFYF9SKUClcori0qskYnwU5WbgLXzTbesTzB D0/5MzQ39fEb54jn9FbOpt+OIlqVeqw=
X-Google-Smtp-Source: APiQypJIVJLbMS7jiPzUOs3OahpzU6u5SbZQ8zrOXxACSQAM/pLeKtAj2w1r0i6qfQ924JfT6CXVrg==
X-Received: by 2002:a5d:50ce:: with SMTP id f14mr16077211wrt.251.1588850252610; Thu, 07 May 2020 04:17:32 -0700 (PDT)
Received: from [10.0.0.2] (181.58.93.209.dyn.plus.net. [209.93.58.181]) by smtp.gmail.com with ESMTPSA id a10sm7422074wmc.2.2020.05.07.04.17.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2020 04:17:31 -0700 (PDT)
From: Neil Madden <neil.e.madden@gmail.com>
Message-Id: <7127FD53-11F7-41A0-880D-2EFE856B8BF3@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_F07EEC2F-696E-4FCF-BFF0-8E49770D2E49"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\))
Date: Thu, 07 May 2020 12:17:30 +0100
In-Reply-To: <933ca5df-d5a7-166e-c2c3-0c2c2838d6db@huelsing.net>
Cc: cfrg@irtf.org
To: Andreas Hülsing <ietf@huelsing.net>
References: <AD42E3BB-8AF2-4FC9-9407-9A8D8D5130B4@gmail.com> <429061fff35b4c3a910c948360ddd552@blackberry.com> <D33D73A2-BD9C-48F4-BF87-604E7B9A28C0@gmail.com> <933ca5df-d5a7-166e-c2c3-0c2c2838d6db@huelsing.net>
X-Mailer: Apple Mail (2.3608.80.23.2.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/3RSmM2LzvVVDYxRm-nZb4yu-ybg>
Subject: Re: [Cfrg] Multi-recipient public key authenticated encryption
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: Thu, 07 May 2020 11:17:40 -0000

The proof of theorem 3 in [1] (section 5.3) models the KDF as a random oracle, which seems fairly standard, and is a stronger assumption than collision resistance, isn’t it? But I think you’re right that the collision resistance of the hash used in the KDF will be important in practice and should be mentioned.

I’m not a cryptographer so please correct me if I’m wrong.

[1]: https://eprint.iacr.org/2005/056.pdf <https://eprint.iacr.org/2005/056.pdf> 

> On 6 May 2020, at 10:51, Andreas Hülsing <ietf@huelsing.net> wrote:
> 
> I might miss something, but you also require collision resistance for the KDF in this case (which is non-standard afaik), right? 
> 
> Best,
> 
> Andreas
> 
> On 28-04-2020 14:30, Neil Madden wrote:
>> Thanks, section 5 of the eprint is very useful. In that you discuss the solution of including the MAC tag in the KDF and you say that this requires collision resistance of the MAC, where I had previously assumed only 2nd preimage resistance would be enough. As I understand it, the potential attack is that if Charlie has access to an Alice-oracle by which he can get Alice to authenticate arbitrary messages to himself and Bob then he can use this to perform a collision search to find two messages with the same MAC tag (if the MAC is not collision resistant).
>> 
>> I think this active attack would also apply to my proposed solution using a hash of the authenticated ciphertext as input to the KDF. So my assertion that 2nd preimage is enough is only valid for passive attacks, and full collision resistance would be needed in general. That also means that if I do pick SHA-256 to be consistent with existing use in JOSE then the security against such attacks would be limited to ~128 bit level. Perhaps that’s an incentive for me to also change the KDF in the scheme from JOSE’s existing Concat-KDF to HKDF with SHA-512.
>> 
>> I think the same attack would also apply to saltpack [1], if I understand correctly? In saltpack a per-recipient MAC is calculated over a SHA-512 of the ciphertext.
>> 
>> [1] https://saltpack.org/encryption-format-v2 <https://saltpack.org/encryption-format-v2> (scroll down to Payload Packets)
>> 
>> Best,
>> 
>> Neil
>> 
>>> On 27 Apr 2020, at 16:19, Dan Brown <danibrown@blackberry.com <mailto:danibrown@blackberry.com>> wrote:
>>> 
>>> Hi Neil,
>>> I too have encountered this interesting and well-known (perhaps not widely-known) problem.
>>> See https://eprint.iacr.org/2005/056.pdf <https://eprint.iacr.org/2005/056.pdf>. (Section 5).
>>> See https://tools.ietf.org/html/rfc3278#section-4.1.2 <https://tools.ietf.org/html/rfc3278#section-4.1.2> the very short “note”.
>>>  
>>> I forget the details of the various claimed past solutions, but will try to remember, maybe in a couple weeks.  Meanwhile, since the problem is fresh in your mind, and you might try to make sense the couple of old suggestions above, though I expect your knowledge has already advance past this old stuff.   
>>>  
>>> Best regards,
>>>  
>>> Dan
>>>  
>>> From: Cfrg <cfrg-bounces@irtf.org <mailto:cfrg-bounces@irtf.org>> On Behalf Of Neil Madden
>>> Sent: Monday, April 27, 2020 10:12 AM
>>> To: CFRG <cfrg@irtf.org <mailto:cfrg@irtf.org>>
>>> Subject: [Cfrg] Multi-recipient public key authenticated encryption
>>>  
>>> Hi all,
>>>  
>>> I am working on an enhancement to the JOSE standards and would like feedback from members of CFRG about solutions to a particular issue if any of you have time.
>>>  
>>> In JOSE currently if you wish to create a message that has both confidentiality and sender authentication using public key cryptography then the only option is to both sign and then encrypt the message. This is expensive because it involves multiple passes over the message and results in a very bulky nested message structure with two layers of base64-encoding.
>>>  
>>> Given that many uses of this sign-then-encrypt pattern do not require the strong security properties of signatures, I have proposed [1] a public key authenticated encryption mode based on NIST’s one-pass unified model from SP 800-56A. This avoids the nested structure and means that you don’t need multiple cryptographic primitives. The proposed algorithm uses two ECDH key agreements: one between the sender’s ephemeral private key and the recipient’s long-term public key; and a second between the two parties’ long term keys. The two shared secrets are concatenated and passed through a KDF along with some context arguments. For a single recipient this achieves sender authentication (subject to replay), and the single recipient case is what I am primarily concerned about.
>>>  
>>> (If you squint this is also roughly similar to the Noise framework “K” one-way pattern, but my hands are waving quite a lot here).
>>>  
>>> To support multiple recipients I copied the existing pattern used in JOSE’s ECDH-ES+A256KW algorithm family in which the message is encrypted using a random Content Encryption Key (CEK) and then the CEK is encrypted for each recipient using AES-KeyWrap with the ECDH-derived key. As I then mention in the security considerations this leads to any recipient being able to produce a forgery using that CEK and claim it came from the original sender:
>>>  
>>>    When Key Agreement with Key Wrapping is used, with the same Content
>>>    Encryption Key (CEK) reused for multiple recipients, any of those
>>>    recipients can produce a new message that appears to come from the
>>>    original sender.  The new message will be indistinguishable from a
>>>    genuine message from the original sender to any of the other
>>>    participants.  To avoid this attack, the content SHOULD be encrypted
>>>    separately to each recipient with a unique CEK or a nested signature
>>>    over the content SHOULD be used.
>>>  
>>> Because I am primarily interested in single-recipient use cases, this seemed like an acceptable trade-off. However, I have since been contacted by people who would like to use this draft for multi-recipient messages and would not like to fall back on a nested signature structure.
>>>  
>>> An initial proposal was to solve this by simply including the MAC tag from the content encryption in either the per-recipient payload (encrypted using AES-KeyWrap) or as an additional context field to the KDF. But the MAC is computed using the CEK that is known to all recipients, so for this to be secure would require second preimage resistance of the MAC with a known key, which cannot be guaranteed for JOSE because it supports content encryption using AES-GCM for which second preimages can be trivially computed if you know the key.
>>>  
>>> Assuming that a per-recipient MAC is too much overhead, an alternative would be to include a collision-resistant hash of entire ciphertext (and IV and associated data) in the KDF. This is unfortunate as it requires another pass over the entire message when we’ve already encrypted and MACed, but it appears to be a solution and at least is no more inefficient than the original signed-then-encrypted approach which also needs to hash the entire message.
>>>  
>>> So two questions:
>>>  
>>> 1. Is including a hash (e.g., SHA-512) of the ciphertext (assuming symmetric AE) in the per-recipient KDF calculation sufficient to prevent forgeries in the multi-recipient setting?
>>>  
>>> 2. Are there more efficient alternatives that don’t assume 2nd preimage resistance of the underlying symmetric MAC?
>>>  
>>> [1]: https://tools.ietf.org/html/draft-madden-jose-ecdh-1pu-03 <https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_draft-2Dmadden-2Djose-2Decdh-2D1pu-2D03&d=DwMFaQ&c=yzoHOc_ZK-sxl-kfGNSEvlJYanssXN3q-lhj0sp26wE&r=mf6j6fOClApRsArWE9wqI1rEGUVkfxZ0aXWmn35nK_c&m=pABr2aBl1c_ofW8vypgq6rz4tGVZWkxu0IU_RSNb_L4&s=E_agQvNgeBlLsyPF6xyJ1TFQLBAJsGTY1FJf7EK3iqs&e=>
>>>  
>>> Kind regards,
>>>  
>>> Neil Madden
>>> This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.
>> 
>> 
>> 
>> _______________________________________________
>> Cfrg mailing list
>> Cfrg@irtf.org <mailto:Cfrg@irtf.org>
>> https://www.irtf.org/mailman/listinfo/cfrg <https://www.irtf.org/mailman/listinfo/cfrg>
> _______________________________________________
> Cfrg mailing list
> Cfrg@irtf.org
> https://www.irtf.org/mailman/listinfo/cfrg