[COSE] My review of draft-ietf-jose-fully-specified-algorithms

hannes.tschofenig@gmx.net Sun, 15 September 2024 08:43 UTC

Return-Path: <hannes.tschofenig@gmx.net>
X-Original-To: cose@ietfa.amsl.com
Delivered-To: cose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B860BC14F747 for <cose@ietfa.amsl.com>; Sun, 15 Sep 2024 01:43:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.806
X-Spam-Level:
X-Spam-Status: No, score=-2.806 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, 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
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmx.net
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 WrWYfPfte-Yk for <cose@ietfa.amsl.com>; Sun, 15 Sep 2024 01:43:32 -0700 (PDT)
Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 825FEC14F71E for <cose@ietf.org>; Sun, 15 Sep 2024 01:43:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1726389810; x=1726994610; i=hannes.tschofenig@gmx.net; bh=WWzw1unRKwrWV+lXAgPgoVzP2YhxefxHwBxbygD6Df4=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:MIME-Version: Content-Type:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=jXzE2hDocjlZkz1Ubo1eQbVf+wH7gbl0fgmiqI/63ZEf43TzJ0k4JXNuKtr1CrGS eVad9n4d4gyU51dmXvSdMZ8iaZj8naWjfs8yGmYQoYQa/SmuaqmNzPf7+qqmSdOEd +dc+uiX6/OrX8X+yCEzcOXTYXqJXawv343zBh/iCOwcJbSTVxGXPW1/QKO3bsqmPo 1JsFmPHM3POMNYwfARPYwyki4MMGEIUWVyUV+rddByHORtuFi8PXbcY6J43jvKwY7 WKAF/I3M08dxWnjhVXF5IwYCPCcYxxKlM7xaOMkUndjpqy1PQQn5Yk24N6J7PzmU2 /Ytqzv9TykStCIqMPw==
X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a
Received: from Surface ([185.176.157.173]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MHXFx-1sleEt2gyH-00Dbjm for <cose@ietf.org>; Sun, 15 Sep 2024 10:43:30 +0200
From: hannes.tschofenig@gmx.net
To: cose@ietf.org
Date: Sun, 15 Sep 2024 10:43:30 +0200
Message-ID: <008001db074b$57585530$0608ff90$@gmx.net>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_NextPart_000_0081_01DB075C.1AE25DB0"
X-Mailer: Microsoft Outlook 16.0
Thread-Index: AdsHS1b/Ozza1SIYTu2IfncIkqWMYg==
Content-Language: de-at
X-Provags-ID: V03:K1:lhh0oyja7l626EcSFyF6PbvC5RKUwat3YZGAvlCcHlhhQ7vlozy 7ifajEuiMi3AIOH/WTjaVqzD3sAbWtGqZMBDPyts+AmWHe5Ez9MZy0/r0uKQV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7R6QFNFL6LGSWAXEJUEUGZXZNS
X-MailFrom: hannes.tschofenig@gmx.net
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cose.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [COSE] My review of draft-ietf-jose-fully-specified-algorithms
List-Id: CBOR Object Signing and Encryption <cose.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/Gv4Y08XRhurbwHXjaeITjLuvN6Y>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cose>
List-Help: <mailto:cose-request@ietf.org?subject=help>
List-Owner: <mailto:cose-owner@ietf.org>
List-Post: <mailto:cose@ietf.org>
List-Subscribe: <mailto:cose-join@ietf.org>
List-Unsubscribe: <mailto:cose-leave@ietf.org>

Hi all,

 

as requested, I have reviewed the document. Here’s some background information first:

 

Security protocols like TLS and IKEv2 perform an initial handshake to authenticate endpoints, negotiate algorithm combinations, and establish a symmetric key for securing data traffic. After the handshake, there's no need to carry algorithm information around, as the key identifier implicitly defines the algorithm in use. However, JOSE and COSE are not multi-round-trip protocols but rather building blocks for other protocols, often used in applications involving one-shot messages (such as JWTs or CWTs). It has become common practice to include algorithm information in the headers of JOSE/COSE payloads to specify the algorithm and key exchange mechanism. Despite the risk of attackers altering algorithm identifiers to deceive recipients into using incorrect algorithms with a given key, this practice persists.

 

There are two main philosophies regarding algorithm identifiers in JOSE/COSE headers:

 

- Ciphersuite Approach: The identifier refers to a meaningful combination of algorithms, key sizes, etc. This is an example from the draft: ECDH-ES using P-384 w/ HKDF and AES Key Wrap w/ 192-bit key --- this ciphersuite represents the combination of all these individual algorithms, key sizes, key distribution mechanisms, KDFs, etc.

 

- À La Carte Approach where individual properties are expressed independently.

Here is an example: Algorithm = AES, Key Size=128, Mode of Operation: GCM

 

The document aims to revise the IANA registry for JOSE and COSE algorithms to list ciphersuites, which is necessary as other specifications have assumed that ciphersuites are being used.

 

Initially, the focus of the draft was on digital signature algorithms, but later, encryption algorithms were also included. This added complexity, as encryption algorithms support various key exchange methods. The expanded scope was discussed at the last IETF meeting. This expansion of scope is, however, unavoidable since otherwise the content of the registry is misaligned.

 

Mike and Orie argue that content encryption and key exchange algorithms must be independent of each other:

 

"Each of these multiple algorithms must be independently fully specified. The operations performed by each of them MUST NOT vary when used alongside other algorithms. For instance, in JOSE, alg and enc values MUST each be fully specified, and their behaviors MUST NOT depend upon one another."

 

I disagree with this perspective since these algorithms depend on each other. The key exchange algorithm must produce a key of the appropriate length for the content encryption algorithm. Additionally, binding them together is necessary to prevent attacks, as discussed in the context of COSE HPKE.

 

Interestingly enough, later in the text they acknowledge this fact on page 14:

"

  In COSE, preventing cross-mode attacks, such as those described in

   [RFC9459], can be accomplished in two ways: (1) Allow only

   authenticated content encryption algorithms. (2) Bind the the

   potentially unauthenticated content encryption algorithm to be used

   into the key protection algorithm so that different content

   encryption algorithms result in different content encryption keys.

"

 

I disagree with the text as currently written, as described in https://datatracker.ietf.org/doc/draft-tschofenig-cose-cek-hkdf-sha256/. I believe I understand what the authors are trying to communicate but it does not quite get across. Their view is purely from a registry value perspective and not so much from a security point of view.

 

Section 3.2's API descriptions are incorrect. For example, most ciphers used for content encryption in COSE and JOSE are AEAD ciphers, and their API does not align with the description in Section 3.1.1.

 

I found nits in the draft. For instance, Section 3.1.1 (which discusses direct encryption) references AES-KW, stating: "Key Wrapping algorithms impose additional implicit constraints on AAD and IV." While true, AES-KW, as defined in RFC 3394, does not have public parameters that vary per invocation. Consequently, for COSE, the protected header in the recipient structure is a zero-length byte string, which does not apply to the content encryption layer. You could call this "constraints" - it would be more correct to just state what is meant by these constraints or point to the respective section in the relevant RFC(s).

 

In Section 3.2.2, it appears that the document creates new KEM-definitions and their APIs, despite several existing IETF specifications that could be referenced. For example, text could be copied from RFC 5990bis (see Section 1.2 of https://datatracker.ietf.org/doc/draft-ietf-lamps-rfc5990bis/)

 

Finally, I have concerns about the terminology used in the draft. For instance, I am not convinced that introducing the term "polymorphic" is a good idea, as it is not used in the security field. In the IPsec/IKE discussions I have seen the terms Ciphersuite vs. À La Carte being used. 

 

With all that said, I agree with the overall concept of the draft. My review focuses on providing feedback on the content, and I am happy to collaborate with the authors or the group to refine and improve the wording of the text.

 

Ciao

Hannes