Re: [Teep] [Suit] ECDH-ES + A128KW vs. ECDH-ES + HKDF-256

"lgl island-resort.com" <lgl@island-resort.com> Sun, 17 December 2023 17:36 UTC

Return-Path: <lgl@island-resort.com>
X-Original-To: teep@ietfa.amsl.com
Delivered-To: teep@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DE2C5C14F5F2; Sun, 17 Dec 2023 09:36:49 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.908
X-Spam-Level:
X-Spam-Status: No, score=-1.908 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, 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 7A0IYjnbHN5l; Sun, 17 Dec 2023 09:36:46 -0800 (PST)
Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2130.outbound.protection.outlook.com [40.107.92.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id EA19DC14F5ED; Sun, 17 Dec 2023 09:36:45 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mFBfMe340GtEtBp1J8HJsd/Q1gB0Iv0KhZr908OATi6Z7qIcQ7IvY9+0k3+aUYyNnlVtx2c1z1OhsweOW3BXaVv//5/iD5ib2PKcsdOvjetDTCpr7k/tqfQYF/VmpERznjaZ/OplkmfB1I3HMOgeZSPg0xtTDGH6sZJd2VkSsL6kGP36I96rA/s/TPWLd5jxzXeIb3EHUJ4Ns4rjrLGX3Zym0gcHiXbcd7cysNoeGg7Hym0ri/jIzLGZE5GBN+MUCLbOOIMGQZnTwYb0+45Dq/OhFT0ze45+nNFPcZ4SuyVkeZOdYFilg0RQaYCJYHsEN7/UxX3MTBPQGT+6l8+Ddg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YaC3m1FjtTsZh44n2embk/trYP/ou/6xJC6muqbz+zg=; b=h8EYMHFMB/pE8OEkgqV4hLwrLSyDZFBe9F1u8nRZCr/zKQtDdaDGsRZ7jviVRy4WB4PL5k4iBqjeeteJd1NUCeFwhrnZUqByUz9+2XCQJfAWJdV7NkQrgnrvEElxJAg7Tfd7cvGx8/G/dgsRnK9SSTbx8USM/drym9cDtE/tWoitK5zrCg12KdWo9GIlg/0eJOS9N9SKh14Fu0ubvQIxTd0vPioQU+zHpLOA9YevSxoDP3SwwVJ/xRkyPDuMXYNKdgCTaV6FKHDipXHBK+EpB+beW+z5koHn+gJ9aD76Qrfy4DfAL8zg0mwahmqKOmeQ6RgDzOhn9lqYvFlluPZLTw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=island-resort.com; dmarc=pass action=none header.from=island-resort.com; dkim=pass header.d=island-resort.com; arc=none
Received: from PH7PR22MB3092.namprd22.prod.outlook.com (2603:10b6:510:13b::8) by SN7PR22MB3787.namprd22.prod.outlook.com (2603:10b6:806:357::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Sun, 17 Dec 2023 17:36:41 +0000
Received: from PH7PR22MB3092.namprd22.prod.outlook.com ([fe80::353a:75f1:88a7:5f90]) by PH7PR22MB3092.namprd22.prod.outlook.com ([fe80::353a:75f1:88a7:5f90%6]) with mapi id 15.20.7091.034; Sun, 17 Dec 2023 17:36:41 +0000
From: "lgl island-resort.com" <lgl@island-resort.com>
To: Hannes Tschofenig <hannes.tschofenig@gmx.net>
CC: Russ Housley <housley@vigilsec.com>, Akira Tsukamoto <akira.tsukamoto@gmail.com>, Brendan Moran <brendan.moran.ietf@gmail.com>, suit <suit@ietf.org>, teep <teep@ietf.org>, Ken Takayama <ken.takayama.ietf@gmail.com>
Thread-Topic: [Suit] [Teep] ECDH-ES + A128KW vs. ECDH-ES + HKDF-256
Thread-Index: AQHaMPyLrfXX2YEdqUqw6OT+QV5e+LCtvTYA
Date: Sun, 17 Dec 2023 17:36:41 +0000
Message-ID: <76B7A923-CC43-45DC-B8BF-D03D95542874@island-resort.com>
References: <08f701da2d9f$c043a6c0$40caf440$@gmx.net> <655A0104-EF30-42E4-862D-6D4D6E4FDDD9@vigilsec.com> <843e1218-8847-48cc-ada5-9b9cc50e17cf@gmail.com> <00ba01da2e6e$81f1f910$85d5eb30$@gmx.net> <9F676C9F-1573-4DBE-A12A-A9A63BC77014@island-resort.com> <65A259BD-75EF-4EAE-B255-29EBD1ABC319@vigilsec.com> <5E005DCF-86C5-4359-929D-A60DD1C703E1@island-resort.com> <731ab283-e078-4186-ae60-0725d0bf1356@gmx.net>
In-Reply-To: <731ab283-e078-4186-ae60-0725d0bf1356@gmx.net>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=island-resort.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: PH7PR22MB3092:EE_|SN7PR22MB3787:EE_
x-ms-office365-filtering-correlation-id: 9ea001bb-68ac-44df-f99b-08dbff26bad1
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: Rephg6kz7m4VRqJC8mZctCQ57jJv/NT4vD67upl1disgt49vq24cyTpKJ67/QqCek041CAgPE6zXhOXtsxcEY6NIWFR4lKJA145+mtd0CymGPHLZSxtPvfJ3ah7N9VOXBllQ+IUuk+qwJhwsWadXEHiwoh5QrUvAU8pkHOIrYgSurmLRQVYWMf8+bz4ERRiLhHJBr9PcsuW3w3FMUi17HCbNx00bgTEYx419hmrM/9DeeXxv3ks5D6i3uKfZumYUo1ODnuQSIEx6MLDThGM+Iyu2KLnp+0zy6Cgn8OIw++b0IGjvuzsEmaTskLaczlHCLhwMKvTXEXP1Q12eFcFvT/NY04MmO0JHB3Tvq3J/h8y9KxjQqfM2GM1LszRcOlJI9nL+iVL++WMepX72105GO/qtq1y6YO0IXIy4jhpG1CFaeeE8GzsKHMwaQh85DPM4XbTC+sq2XiQgELEzUssH3HxLLH+yJxR6YB21SI/GCNUznU1alkgC9cqeC/GnrHyWJkzV9Ozc9VpMrKdHwkvZOg5kUgVfEJZiAUFivNiZsNfa0/Ik8s2/CwGWYMe8vAQtWiwxyrzWSYnCRPAurb9D4Ts5REBO7G/uLCo5yVn7GxldUg5gA4fPGNIIPyAzjyJtlrRC4kJvUL+lnDhcwLCAYCSNcFOXTcbEK/ksmjX0FGkp2zIqtAfYCkOrXGQOuPmz
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR22MB3092.namprd22.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(396003)(136003)(346002)(39830400003)(376002)(230922051799003)(230273577357003)(230173577357003)(64100799003)(186009)(451199024)(1800799012)(26005)(2616005)(53546011)(6512007)(6506007)(71200400001)(122000001)(38070700009)(38100700002)(36756003)(86362001)(33656002)(8936002)(8676002)(4326008)(41300700001)(478600001)(5660300002)(2906002)(83380400001)(76116006)(6486002)(966005)(66946007)(66556008)(66476007)(66446008)(54906003)(64756008)(316002)(6916009)(45980500001); DIR:OUT; SFP:1102;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: crQQAunHvirntIFQn/h0tReko56VnjeZydkd2auZVT1hxYVVDM1+Ddwt2V34t2aikfeIFKt14KAMY+iNne2kQIuCeDmlU/fB8bYCL8rFPsIOs7X2sohJdBqaotHBJ9hh1uFXprM80N32SWiisz1/VIlADJDfEtM0gd5lrZRaFmawcE9M1psJgyxfNfIlVskuFLxQfEowokGpISCxuSExSoNE2JifV3mn16MmJW3vnlcxRUgceoo1jglwAwQqJlE/CNurGFs7oizMgEv4B2uY1a8KokmwtHutHiZxSK6dW6rCYMT8uKVbJxd+iTHJQT4RgvFH1hgi7LAoT1T4xPHYHev+AASaYCLoF+lfWCO3z6yiN9LrHzmcysZyqDz7Jd+DME+SBGaUPQzormr9Mb+5IiZKaZZrHaPwHGeAF+GrN/+KDLAWcIJs39hjBZqkRh8rNZg7VRSQravmjxN+adPTGeRsZjRlsPuFmT+0m2iTyKlqK9C0bN4cSnmld+bCHPDQsR7sS8892nOiT8cV7EuXvXiUp9AXDqdkCWJIrokS/Tg4xvKmBP/fUHygXtleKEcnqfrUiv7xgnF9nfB6GY3dQAkv+nVmpUSQ2V4siW+1pENc2YRT13p9cUGhP4zYTu11rz1TxQ99RHT0dJEUxRIII7B3w0Fjfb2P1CJxGNSwMkaroYj5tPI0iuFtfLGPe9wJzk0whmEsf15jclybjA1PeDrf4YPwr65whT3DOMRN3ia7J0LYy6Wa9y1mDOYmnWg7rHJ7eccm4gjViym1yJIz6Xvm0ZI5RokB6dmpq8bhJjLLgbMYGTrOwkjMUwg0Y9RJP1nNkp/UZ3NFlsIkWAI9MKETO462cNfAhTnHeSjpQLxj/hlBMdXVp5d/nbltDUECQYBz5ajflOBGMkU2E2ZPGgZRcPIMcaYlWFmRGynnfX8vmXqH6KERAj6coQ7sCh6kxyrOAeAE63pOeZGP2xUwnJ0NoyI3AJUWNCGA4nA6wHRhWR5THxu2OtYP29zrpSBR3ahUUNk9mgq+d+AZfGVAWamwwJRoHceZRmjKvywsOGWUKm3zkMriwfIyvC3uiKpvqNd5BbsCAlBKrEmOzG2s3SWjbnKLwzs/sh0HHmQci6hoPtmfwwXjK0Sb1cwz/ZqHPFeIJPNnvBRLNKdaH8EesQbGPMHEFeIzmcJxTBc/j1QbCfxS/DA+hPqp1LuCNUqji3WjFCyk+501YtfMH9tlTfhXX3OjLUtPslzX+zcsAZV2n5ln73Iz80idGjBsM/2FgoDVXO5DW1Xl6VrB/0vgMZ08H92PMH2y2WWqCn9RkGWlqiTVFiigPIPKN0isltwDetwATG7AOR5oRtIbeN+Gf2Azk8CZotiRe9RfyNmP4sNviJUagE0kmTGY5XSPkMMzvx3nLQ4I6uRv/4NkBXD7OYpBWN9IqRFsLRwFKHfGfskp4qQXcOe19ZUuxVAssyiJlo5lJopIH7ZcCP4f5laImL2Iwt6WswtzMJSnjdUlR1h6JFW7SxkEqD8nIZLPf8f88aPSRQBcfiIbzaEIhanwebAqM6Z+M85uV1CspCNV2sz2xj+osGbATEcETT+FQACyrinP7qrMASbA4W3Rq7hmDw==
Content-Type: text/plain; charset="utf-8"
Content-ID: <54C0785B973F784C875214BFEE98E4AC@namprd22.prod.outlook.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: island-resort.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: PH7PR22MB3092.namprd22.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 9ea001bb-68ac-44df-f99b-08dbff26bad1
X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Dec 2023 17:36:41.1037 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: ad4b5b91-a549-4435-8c42-a30bf94d14a8
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: n6eYwBCL0mBrVnCgErKuOd+QCb/Mgpu6qM0xzNeGqqMwG+CbhwTMxZNLaCL6BRrnOrKlaXsiU97UZe9tof8Z4g==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR22MB3787
Archived-At: <https://mailarchive.ietf.org/arch/msg/teep/yoRculqhPOPzaRVcClQPUIcDi-o>
Subject: Re: [Teep] [Suit] ECDH-ES + A128KW vs. ECDH-ES + HKDF-256
X-BeenThere: teep@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: A Protocol for Dynamic Trusted Execution Environment Enablement <teep.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/teep>, <mailto:teep-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/teep/>
List-Post: <mailto:teep@ietf.org>
List-Help: <mailto:teep-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/teep>, <mailto:teep-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 17 Dec 2023 17:36:50 -0000

I think both algorithm IDs should be protected. Both the AES-KW and the AES-GCM identifier.

The main reason is to provide very thorough protection. Protecting both algorithm IDs may prevent attacks we don’t even know about today. This is the level of security and quality that IETF/COSE should work too.

Seems like HPKE used this kind of thinking (but didn’t support multiple recipients).

I haven’t thought it through completely, but I think HPKE is probably not vulnerable to the AEAD downgrade attack described in Prague, because it used that kind of approach.

I don’t think the COSE work did for ECDH plus KDF is as thorough as HPKE’s work, but CMS is worse than COSE.

It’s not a matter of trying to figure out what 9053 intended. It’s a matter that it didn’t go as far as it should.

Seems like there’s many different approaches to fixing this ranging from trying for as little work as possible like having all the alg IDs in the KDF input to something very major like adding multiple recipient support to HPKE.

This is an incomplete message as I am not proposing anything and that I’m not providing analysis to properly link up to the AEAD downgrade attack. This stuff is hard for me to think about...

LL


 
Also, the COSE documents are sort of incomplete, in that they leaves some very difficult security analysis for the implementor in the area of KDF input  in contrast that to the extensive warnings about AES-CTR mode in RFC 9459 that expect the reader knows very little. Personally, I learned about AES-CTR mode issues twenty-thirty years ago and think it is common knowledge.


> On Dec 17, 2023, at 8:20 AM, Hannes Tschofenig <hannes.tschofenig@gmx.net> wrote:
> 
> Hi Laurence,
> 
> 
> I believe these are two different aspects but it is, of course, worth
> checking it again.
> 
> 
> The algorithm input to the KDF context structure is something Ken and I
> coincidently discussed last week.
> 
> 
> Initially, we used the algorithm id used for encrypting the firmware
> image in the KDF context. Then, we changed it to the algorithm id used
> in the recipient structure to encrypt the CEK, which is A128KW in our
> example below. This reflected our reading of the COSE specification*.
> When Ken explored the use of ECDH-ES + HKDF-256, it was not clear
> anymore what algorithm id to include in the KDF context.
> 
> 
> *: The relevant paragraph from Section 5.2 of RFC 9053 is when Jim
> talked about the AlgorithmID and said:
> 
> "This field indicates the algorithm for which the key material will be
> used. This normally is either a key wrap algorithm identifier or a
> content encryption algorithm identifier."
> 
> 
> Of course, this leaves room for interpretation because the keying
> material derived by ESDH is used twice, first to encrypt the random CEK.
> Then, the CEK is used to encrypt the firmware image. So, which usage of
> the key is meant here?
> 
> 
> Ciao
> 
> Hannes
> 
> 
> Am 15.12.2023 um 04:14 schrieb lgl island-resort.com:
>> Maybe I’m wrong here (hope so), but AES-GCM is used with ECDH-ES + A128KW for the bulk payload encryption and the algorithm ID identifying it is not mixed in with the KDF context so the alg ID is not really protected.
>> 
>> Will look at the referenced paper some more.
>> 
>> LL
>> 
>> 
>>> On Dec 14, 2023, at 10:34 AM, Russ Housley <housley@vigilsec.com> wrote:
>>> 
>>> Laurence:
>>> 
>>> I am aware of a presentation about an attack against AES-GCM and AES-CCM:
>>> 
>>> 	Roth, J. and F. Strenzke,
>>> 	"AEAD-to-CBC Downgrade Attacks on CMS",
>>> 	8 November 2023,
>>> 	<https://datatracker.ietf.org/meeting/118/materials/slides-118-lamps-attack-against-aead-in-cms>.
>>> 
>>> I am not aware of any attacks that involve AES-KW.
>>> 
>>> Where can I find information about the attack you are talking about?
>>> 
>>> Russ
>>> 
>>>> On Dec 14, 2023, at 12:19 PM, lgl island-resort.com <lgl@island-resort.com> wrote:
>>>> 
>>>> Note that there is a vulnerability in ECDH-ES + A128KW — the one that was presented in Prague. I think there are fixes, and it’s on my list to dig into it (IETF/COSE needs a full, proper and secure multi-recipient modern encryption format), but don’t have bandwidth right now.
>>>> 
>>>> LL
>>>> 
>>>>> On Dec 14, 2023, at 2:18 AM, hannes.tschofenig=40gmx.net@dmarc.ietf.org wrote:
>>>>> 
>>>>> Thank you all for your quick response. From the feedback it seems clear to go for ECDH-ES + A128KW
>>>>> We will update the documents accordingly.
>>>>> 
>>>>> -----Original Message-----
>>>>> From: Suit <suit-bounces@ietf.org> On Behalf Of Akira Tsukamoto
>>>>> Sent: Donnerstag, 14. Dezember 2023 06:29
>>>>> To: Brendan Moran <brendan.moran.ietf@gmail.com>; Russ Housley <housley@vigilsec.com>; Hannes Tschofenig <Hannes.Tschofenig@gmx.net>
>>>>> Cc: suit@ietf.org; teep@ietf.org; Ken Takayama <ken.takayama.ietf@gmail.com>
>>>>> Subject: Re: [Suit] [Teep] ECDH-ES + A128KW vs. ECDH-ES + HKDF-256
>>>>> 
>>>>> Hi Brendan,
>>>>> 
>>>>> I am fine changing the MTI with ECDH-ES + A128KW.
>>>>> 
>>>>> Akira
>>>>> 
>>>>> On 12/14/2023 12:08 AM, Russ Housley wrote:
>>>>>> I think ECDH-ES + A128KW covers more use cases.  It can be used with on recipient or many recipients.  So, I'd like to see that be the MTI.
>>>>>> 
>>>>>> Russ
>>>>>> 
>>>>>> 
>>>>>>> On Dec 13, 2023, at 3:38 AM, hannes.tschofenig=40gmx.net@dmarc.ietf.org wrote:
>>>>>>> 
>>>>>>> Hi all,
>>>>>>> 
>>>>>>> In the SUIT firmware encryption draft we have so far used ECDH-ES + A128KW, which is also what we implemented in t_cose to generate the examples.
>>>>>>> 
>>>>>>> In a discussion with Ken today we realized that the SUIT-MTI draft has always used ECDH-ES + HKDF-256 instead.
>>>>>>> 
>>>>>>> Now, the question is: Should we support both, ECDH-ES + A128KW and ECDH-ES + HKDF-256?
>>>>>>> 
>>>>>>> IHMO we definitely need AES-KW for scenarios where we encrypt a firmware with a CEK once and then distribute that encrypted firmware image to many recipients. In this case, we
>>>>>>> 
>>>>>>> * randomly generate a CEK,
>>>>>>> * encrypt the firmware using this CEK,
>>>>>>> * encrypt this CEK with a KEY unique per recipient with a KEK. The KEK is the result of using ECDH-ES with an KDF, as described in Section 6.4 of RFC 9053.
>>>>>>> 
>>>>>>> 
>>>>>>> For scenarios where we send one firmware image to one recipient we could use ECDH-ES + HKDF-256 and currently we have a little bit of overhead here by using ECDH-ES + A128KW.
>>>>>>> 
>>>>>>> My preference is to leave the SUIT firmware encryption draft as is and to change the SUIT MTI draft to reference ECDH-ES + A128KW instead of ECDH-ES + HKDF-256.
>>>>>>> 
>>>>>>> Thoughts?
>>>>>>> 
>>>>>>> Ciao
>>>>>>> Hannes
>>>>>>> 
>>>>>> _______________________________________________
>>>>>> TEEP mailing list
>>>>>> TEEP@ietf.org
>>>>>> https://www.ietf.org/mailman/listinfo/teep
>>>>> _______________________________________________
>>>>> Suit mailing list
>>>>> Suit@ietf.org
>>>>> https://www.ietf.org/mailman/listinfo/suit
>>>>> 
>>>>> _______________________________________________
>>>>> Suit mailing list
>>>>> Suit@ietf.org
>>>>> https://www.ietf.org/mailman/listinfo/suit
>> _______________________________________________
>> Suit mailing list
>> Suit@ietf.org
>> https://www.ietf.org/mailman/listinfo/suit