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

Orie Steele <orie@transmute.industries> Wed, 28 February 2024 20:09 UTC

Return-Path: <orie@transmute.industries>
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 03945C14F61B for <jose@ietfa.amsl.com>; Wed, 28 Feb 2024 12:09:06 -0800 (PST)
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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=transmute.industries
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 5dnbAqlOJv7T for <jose@ietfa.amsl.com>; Wed, 28 Feb 2024 12:09:01 -0800 (PST)
Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (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 ED36FC14F697 for <jose@ietf.org>; Wed, 28 Feb 2024 12:09:01 -0800 (PST)
Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-5e42b4bbfa4so89157a12.1 for <jose@ietf.org>; Wed, 28 Feb 2024 12:09:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=transmute.industries; s=google; t=1709150941; x=1709755741; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CuAW9VZONZyvS7ZTg1WH9KUAto1gtdK9es4LVrviRvQ=; b=d/wrRNeQRlGKgl4y936PvgcFrGRYBA3CBS+QWt9wVjM6ZrnLHlLWmnn5fJfuTAZ+Jf Tj8pBYCjwmeAf0Dvaa0CEr0BLBKDXhXtDlk7bstAcJX7EoLO5R1LUoopFkbjFaaxhD9b GMXWDuHCjzgymSy78FnsSmvxhWfR1U+Iq7jWZHfwGQpl0UxUOH4ztbmYUFnR7x1MvHAk UwXr/DLIOXj0KMv153ZYIzaAVTJq3PvQ6Yse1I7WkF9o72jNhkpI0kw3nqteRqROmPwu lzAOuomp8auEfZDX+TlapxTLcJg1CjH0KaBdXxRrIZ/xgFZ+9caLw8ofNl9X0SbNe16p LEgg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709150941; x=1709755741; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CuAW9VZONZyvS7ZTg1WH9KUAto1gtdK9es4LVrviRvQ=; b=aBlpP0GOtmLEFe/PeGDodlxOvZTUfJO4NqWfHf1xdgDgl/jkk8OzQrk7tPwkKw9Kev j5W/V3D8nxmReb5SxS5j1GNHxfAnRpMXpltiyG7JzL7DeXcFyQ3YjLr1W2vUod+8LA0M NGjTgG1ZV5YDpSXrGvrn0qUmxJ9uVXPtbooVVoc8nHdiwoJg/CXw3jPxB0XhJw3Gi1at /uEAeoialbsskr65siOsdIY/t2nQF+s+4gGOP3n6mTH+YTU19tLeDbddyxxXNzPO6GdG tgK+2c0M/TK74vTe+4OVh0VyJ78uutc8PC5IuM7lcK+OJ4NouBpcZtwxrFS3MLiP7scC xIhQ==
X-Gm-Message-State: AOJu0YzBCDW/GTxd4YwETPgAj7Wsvz+3q1r01HZwusaTVmOvW3cf2+zM EncFzSTez7Hl7Xs6tw/e2neu3RJUO2ntQsLUmuSKZNpKiDe4uEADjuhjr8u+1kPcAOE8zZAqQO7 LsbSm8KxdlnVFR5heoMSn6K0hP7Ri01srcYeo5H11PjOnFkjTB2rvAg==
X-Google-Smtp-Source: AGHT+IG8LzLifVOWf8cE7m3sQk7m6zgmKpaWb6u+41g3J4WFwY0QhmRZmSbqcPWWlpx126pFfVZpaTh9kQ5hWscK5QQ=
X-Received: by 2002:a17:90a:fd02:b0:29a:7fde:7087 with SMTP id cv2-20020a17090afd0200b0029a7fde7087mr220913pjb.8.1709150940879; Wed, 28 Feb 2024 12:09:00 -0800 (PST)
MIME-Version: 1.0
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>
In-Reply-To: <Zd-NRA2kH4fc_d-X@LK-Perkele-VII2.locald>
From: Orie Steele <orie@transmute.industries>
Date: Wed, 28 Feb 2024 14:08:50 -0600
Message-ID: <CAN8C-_+tG9845bn986Anr89ObNpUCzOAuiEJMPh4KGK3ixB+uQ@mail.gmail.com>
To: Ilari Liusvaara <ilariliusvaara@welho.com>
Cc: JOSE WG <jose@ietf.org>, cose <cose@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000b2fb1c061276b66d"
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/i1vHriJf1LNNWojtlAz7PIQ75UQ>
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: Wed, 28 Feb 2024 20:09:06 -0000

* JOSE/KE: HPKE AAD is fixed string "Key Encryption".

^ This seems less good than using the protected header,
which already includes the "alg" for which you are encrypting the key,
which implies and specifies more precisely that you are indeed doing key
encryption.
It also keeps JOSE IE and JOSE KE relying on similar AAD structures.

I also think it's a mistake to invent a new and confusing mode "called JOSE
IE", when it's really just "direct encryption" for HPKE.

```
{ alg: dir, enc: HPKE...A128GCM }
```

* 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.

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.

I do agree that solving the oracle attack for the general case ( -29 / -30
based tag 96 messages), should be done as a separate COSE WG document.

I do not agree that COSE HPKE should be published with the possibility of
targeting the (brand new) HPKE algorithms registered and succeeding in the
oracle attack.

OS



On Wed, Feb 28, 2024 at 1:45 PM Ilari Liusvaara <ilariliusvaara@welho.com>
wrote:

> On Wed, Feb 28, 2024 at 07:55:24AM -0600, Orie Steele wrote:
>
> > For HPKE, we can simplify things and protected against the attack by:
>
> <snip stuff that does not work>
>
> > What do you think?
>
> What you are proposing does not work.
>
>
> 1) HPKE already mixes in enc, there is no reason to do it again, that
>    just breaks some HPKE libraries for no good reason.
>
>    IE and KE are so massively different that aligning the two is not
>    a good reason.
>
>
> 2) Mixing anything between levels will lead to severe implementation
>    problems.
>
>    The best way to break existing implmentations is to throw an
>    unexpected curveball. And this is one.
>
>
> 3) ?OSE-HPKE can do nothing with the oracle attack.
>    a) In JOSE, no action is needed, JWE already blocks the attack.
>    b) In COSE, it needs separate document to fix.
>
>    The "fix" you gave just does not work.
>
>
> 4) Crossmode attack is easy to solve.
>    a) In JOSE-HPKE, HPKE AAD needs to be fixed by KE to some value that
>       can not happen in IE.
>    b) In COSE, it is already solved by Enc_structure context field.
>
>    Doing that with JOSE-HPKE will also solve the more severe cross-layer
>    mixing issue.
>
>
> The simplest HPKE AAD stuff that actually works is:
>
> * JOSE/IE: HPKE AAD constructed as in JWE section 5.1. step 14.
> * JOSE/KE: HPKE AAD is fixed string "Key Encryption".
> * COSE: HPKE AAD is CDE of Enc_Structure, just like for symmeric AEAD.
>   External_aad only applies to layer 0.
>
> Just ignore the oracle (AES-CTR/AES-CBC) attack for this. Fixing that
> (in COSE) is separate issue.
>
>
>
>
> -Ilari
>
> _______________________________________________
> COSE mailing list
> COSE@ietf.org
> https://www.ietf.org/mailman/listinfo/cose
>


-- 


ORIE STEELE
Chief Technology Officer
www.transmute.industries

<https://transmute.industries>