Re: [jose] [COSE] HPKE PartyU / PartyV

Ilari Liusvaara <ilariliusvaara@welho.com> Thu, 29 February 2024 14:48 UTC

Return-Path: <ilariliusvaara@welho.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6AB20C1C4D81; Thu, 29 Feb 2024 06:48:18 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.907
X-Spam-Level:
X-Spam-Status: No, score=-1.907 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
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 LNF97V7G9uy2; Thu, 29 Feb 2024 06:48:16 -0800 (PST)
Received: from welho-filter1.welho.com (welho-filter1b.welho.com [83.102.41.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C7126C180B59; Thu, 29 Feb 2024 06:48:10 -0800 (PST)
Received: from localhost (localhost [127.0.0.1]) by welho-filter1.welho.com (Postfix) with ESMTP id 3F5A21EC39; Thu, 29 Feb 2024 16:48:07 +0200 (EET)
X-Virus-Scanned: Debian amavisd-new at pp.htv.fi
Received: from welho-smtp1.welho.com ([IPv6:::ffff:83.102.41.84]) by localhost (welho-filter1.welho.com [::ffff:83.102.41.23]) (amavisd-new, port 10024) with ESMTP id 4XJsOM3SBqfx; Thu, 29 Feb 2024 16:48:06 +0200 (EET)
Received: from LK-Perkele-VII2 (78-27-96-203.bb.dnainternet.fi [78.27.96.203]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by welho-smtp1.welho.com (Postfix) with ESMTPSA id B71A17A; Thu, 29 Feb 2024 16:48:04 +0200 (EET)
Date: Thu, 29 Feb 2024 16:48:04 +0200
From: Ilari Liusvaara <ilariliusvaara@welho.com>
To: JOSE WG <jose@ietf.org>, cose <cose@ietf.org>
Message-ID: <ZeCZJK76cQNZp7q9@LK-Perkele-VII2.locald>
References: <CAN8C-_LUMe09=WbkwT-RckhR8+LYCQMw8XWnwmDLE5riYjd7pg@mail.gmail.com> <Zd749IrwWC2hI6yX@LK-Perkele-VII2.locald> <CAN8C-_J+mMABCa2HPWv5zJ=u1HSb+saq_mn5kB0Wq5upWUyM9Q@mail.gmail.com> <Zd-NRA2kH4fc_d-X@LK-Perkele-VII2.locald> <CAN8C-_+tG9845bn986Anr89ObNpUCzOAuiEJMPh4KGK3ixB+uQ@mail.gmail.com> <Zd-colj_jF47gLQP@LK-Perkele-VII2.locald> <CAN8C-_Jw2J6OY6N7gRVepVuHiC5NqgH36dXQ6krZ1U-Spqq7fQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
In-Reply-To: <CAN8C-_Jw2J6OY6N7gRVepVuHiC5NqgH36dXQ6krZ1U-Spqq7fQ@mail.gmail.com>
Sender: ilariliusvaara@welho.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/X31MgBydcPEkbi7MiZeasy6_fnk>
Subject: Re: [jose] [COSE] HPKE PartyU / PartyV
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jose>, <mailto:jose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jose/>
List-Post: <mailto:jose@ietf.org>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jose>, <mailto:jose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Feb 2024 14:48:18 -0000

On Wed, Feb 28, 2024 at 03:31:26PM -0600, Orie Steele wrote:
> >
> >
> > <snip>
> >
> 
> 
> > JWE requirements imply that if { alg: dir, enc: HPKE...A128GCM } is
> > legal, then { alg:ECDH-ES, enc: HPKE...A128GCM } is also legal. But
> > the latter tries to derive HPKE key from Direct Key Agreement, which is
> > absurd. Contradiction. Therefore { alg: dir, enc: HPKE...A128GCM } can
> > not be legal. Q.E.D.
> >
> 
> JOSE HPKE can say:
> 
> When using direct encryption, set the protected header "alg" to "dir", set
> the "enc" value to "HPKE...A128GCM".
> Values other than "dir" MUST NOT be used when "enc: HPKE...A128GCM" is
> present in protected headers.
> Direct encryption with HPKE MUST NOT be used with more than one recipient.

No, JWE does not allow doing that.

 
> That being said, we could add new values for integrated encryption, and the
> same argument would apply:
> 
>  { alg: hpke-ik, enc: HPKE...A128GCM } or { alg: HPKE...A128GCM, enc:
> hpke-ik }
>  { alg: hpke-ik, enc: A128GCM } or { alg: ECDH-ES, enc:  hpke-ik }

I don't think that would be a good idea.

And it would also violate section 5 of draft-ietf-jose-fully-specified-algorithms-01.

If adding a new sort of thing, it should be added into space that was
previously invalid. One such is missing "enc".


> Arguing a contradiction from a false (absurd) premis, is invalid.

If x => y and y is false, then x is false.


> > > * COSE: HPKE AAD is CDE of Enc_Structure, just like for symmetric AEAD.
> > >
> > > ^ I do not understand how this proposal secures both the recipient
> > > protected header, and the top level protected header, while addressing
> > the
> > > oracle attack.
> >
> > It does not. Because the only way to address oracle attack without
> > breaking changes are via totally different kind of mechanism.
> >
> 
> LAMPs draft addresses it by mixing the content encryption AlgorithmID used
> into the KDF.
> 
> https://datatracker.ietf.org/doc/html/draft-ietf-lamps-cms-cek-hkdf-sha256-00#section-5.1

Because that is the only way to fix it in CMS without breaking change.


> That's a layer violation in traditional COSE, but because there is no
> COSE-HPKE,
> that can be the default behavior if we write text that makes it so.

That is still a breaking change (breaks any library interface assuming
no layer-mixing)

 
> This is why I pointed at COSE_KDF_CONTEXT... we could try solving this
> problem using it.
> but since it's mostly redundant to HPKE, that seems like a bad idea.

Yeah, using COSE_KDF_Context with HPKE is a bad idea.


> That leaves only HPKE INFO and HPKE AAD as the possible places to address
> this.

That assumes it is addressed. However, there is no way to do so without
a breaking change (see above).


> I'd be happy to review your alternative proposals.

A hacky HPKE-specific fix would be to require that keys encrypted by
HPKE MUST NOT be used for unauthenticated encryption without KDF step
in between.


The proper way to fix it is to add a header parameter that adds a KDF
step between the CEK and the actual key used in symmetric encryption.

And then add a requirement that any key used for unauthenticated
encryption MUST come from KDF.


> > > Since HPKE is new, we don't have to forward the vulnerable 2 layer
> > behavior
> > > for the case where all algorithms in a 2 layer are HPKE algs.
> > >
> > > We cannot fix the oracle attack in a "mixed alg" 2 layer cose structure,
> > > because it would require breaking changes.
> >
> > Just fixing it for HPKE would already require breaking changes (by
> > introducing layer-mixing)
> >
> 
> This is false, because there is no JOSE or COSE HPKE.
> 
> By default, any new HPKE algorithm will be new functionality for libraries,
> and can therefore not be called a breaking change... since there is nothing
> to break.

It breaks any library interface that assumes no layer-mixing. Which is
a reasonable assumption, given that currently everything layers neatly.




-Ilari