Applied AEAD limits in (D)TLS, QUIC, OSCORE, ...

John Mattsson <john.mattsson@ericsson.com> Sun, 21 February 2021 18:15 UTC

Return-Path: <john.mattsson@ericsson.com>
X-Original-To: quic@ietfa.amsl.com
Delivered-To: quic@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3DD403A0E13; Sun, 21 Feb 2021 10:15:07 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.671
X-Spam-Level:
X-Spam-Status: No, score=-2.671 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.57, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=ericsson.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 w5bpuXKzUen1; Sun, 21 Feb 2021 10:15:05 -0800 (PST)
Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2088.outbound.protection.outlook.com [40.107.20.88]) (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 56BC33A0E15; Sun, 21 Feb 2021 10:15:04 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=asSKiXjkt63Ua+ednZ6u4tUB0hY+eSUTxCu3kQ4gCd1MjgbxUd0gTSKnvRi+Ouf1Ari3hsfQzLMe+3vASihm587lNMEDTOCtCrAgFrzBoW50OKVdkby77z+nVKJ3LlGvZ6gFEf5nU8UpH1kEtJAnapS6swHbrfservKKlaksUdFql87FNcQ/iJd+o0Eg7re/kaxe7RA1tF3yaOVjYaTC9Uw/yCqQ6Vt/VTMvUKYYxqE0at6Sa/tCv3R0qE5Lug8G9Gu7bxjuQ0o9pnRbZOtF/rbFb2f3UdsY95Gdp2djBSCGUv1wBFyVfAtL5tpFImGJFAmSrScq7CmnvtlDv7pCCw==
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-SenderADCheck; bh=+ErzdvBdRX0iKO2/kfR6puMJaKktra/aWj8zL9Gismg=; b=KZA4UFmWxwjHjvNv2qQpWEqpfAUkP29lYrEbyw2B92U6bAonYUwn9VLC8HPb1qKoqAfrb7zGo1wH29JKPHtz7iauFmg0hHf6Btlmnv2Z9V1nFj0RFJ+mFhZN9HNNWXKd2k6JTrp1XLdOcVwFZiM5e80OvcBZlmSguxHHuP3xoWmSp2qOEDh9IYB5ne2OqInOIaAqEaySxcBMyFa/3EcHlseDslnfmCP+E1w0Ah/G0riwvZPXBz2C/3BlmNsyB2PyK6/yWLZy/AA7Zka1OQOv5MnBG8SCSotLsFiOrbjz7XlaC8N0qAHWSDI5WGYFeOSy/2i5Ju1Sle2wXgey2oXx4w==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ericsson.com; dmarc=pass action=none header.from=ericsson.com; dkim=pass header.d=ericsson.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+ErzdvBdRX0iKO2/kfR6puMJaKktra/aWj8zL9Gismg=; b=nqd17r9fOL0M/EjU+wXgKkMkmYDDB/wdPR1KcjsUjHzwZByflwX9CpoK0r4xugsyBaPEC4Zr/mMm4syOUnH87hzlTkUMlYM24aeveJg/e2uZU4LeYX7hWpCFx0egAVh5sKuZ3Rt+cgJDuayIrqwNGFjhFhoVqIAzRxe0gnGQ6XU=
Received: from (10.168.92.136) by HE1PR07MB4363.eurprd07.prod.outlook.com (20.176.164.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25; Sun, 21 Feb 2021 18:14:09 +0000
Received: from HE1PR0701MB3050.eurprd07.prod.outlook.com ([fe80::c555:6e47:970c:1268]) by HE1PR0701MB3050.eurprd07.prod.outlook.com ([fe80::c555:6e47:970c:1268%11]) with mapi id 15.20.3868.025; Sun, 21 Feb 2021 18:14:08 +0000
From: John Mattsson <john.mattsson@ericsson.com>
To: "cfrg@ietf.org" <cfrg@ietf.org>, "TLS@ietf.org" <TLS@ietf.org>, "quic@ietf.org" <quic@ietf.org>, "core@ietf.org" <core@ietf.org>
Subject: Applied AEAD limits in (D)TLS, QUIC, OSCORE, ...
Thread-Topic: Applied AEAD limits in (D)TLS, QUIC, OSCORE, ...
Thread-Index: AQHXCH1YiGAcTblN70aS3TibPweiaw==
Date: Sun, 21 Feb 2021 18:14:08 +0000
Message-ID: <36004EDE-523A-42AC-83BF-33F05AA08C27@ericsson.com>
Accept-Language: en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
user-agent: Microsoft-MacOutlook/16.46.21021202
authentication-results: ietf.org; dkim=none (message not signed) header.d=none;ietf.org; dmarc=none action=none header.from=ericsson.com;
x-originating-ip: [81.225.97.222]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 14bdcb02-0095-4b07-916f-08d8d6947b91
x-ms-traffictypediagnostic: HE1PR07MB4363:
x-microsoft-antispam-prvs: <HE1PR07MB4363B950B791ED8416ABBC4C89829@HE1PR07MB4363.eurprd07.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: 1xoG+WhiCWVR6VuuTGlfpJ/eA8nm7MNg8i9UvGnV9t3fjT3MKHi/f0mQhzWR78Y9dKRIY4PegYwU8GKwBwdhBbLBf5a2VD3m8wmTqWraoLPOhCfOX7pluiLmQGWuzCZEVwTecPJbHsZzDm8RSMO7mSL0cX4tvmgaxdXbte6r8P5aZQUIWiUE8LnxVGk/j5YNieIuhRSzSKVFiYBx0wzd4DnezaRYFkrzN7d7WssuQgWo2XlnqhyXvev7SLg2f49ICVHsR67LqgddBpVz8za/zy/ZR+gZyTk4N96a/naCpQ6JAXCrMROR+lwt8wQ7smZ4U335tFgRk3f6Oy9nYmi50wRbxQKEURXeB7+F6XJknp/I+485zvscb7b4e7elGQH7NQtPqN3zK7QPNfGWDsXiYT9VkDb3mfkoV5rfkZX4CbWHgyoFQMuBVloR1icsp3lMD06ZCrlzQIbexsA2J/gwqoKGNvoBu/AlMm+KZ2qWQYpr6ZvzjgU6xk+4JwysHVtxKwZqfXbHn/+KTPMeZt+7I/qNo9wzCZzMNlTKWV98bi7eJ8M5vPy5OSGoVzx/cRpyUhY1SHT03UPYI7MXAjxj3g==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:HE1PR0701MB3050.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(376002)(346002)(136003)(39860400002)(366004)(396003)(64756008)(26005)(66446008)(8676002)(5660300002)(66556008)(6506007)(66946007)(450100002)(478600001)(186003)(2906002)(76116006)(66476007)(33656002)(44832011)(71200400001)(83380400001)(316002)(6512007)(8936002)(110136005)(36756003)(86362001)(6486002)(2616005)(45980500001); DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata: rAWO2vs4poDpjLD4qTBA2OueqYQ87ZaxtD4op0JhB8XDDKZRYzGwBvCoy56xqL4P9/5gcxodahRiwgVbY6YXGHHAdcfk8K42HJ1omp5d3uhBoLkFjDs9JazOs7IO2E0L3DbHZF8UpOr3qE2jK1E9akLOusOOJw3sSfmQ7A9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KqQhb73OFGvUrOV3jM35aEUHIqhcgPAZDylTAJ2g6nWR37pQIjLVhVuCOpNSTbW+UDGRSRXBTD+ESex67vOVsPyGLOzj
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="utf-8"
Content-ID: <8406E33DD5342042BC2264E7383FB64E@eurprd07.prod.outlook.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: ericsson.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: HE1PR0701MB3050.eurprd07.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 14bdcb02-0095-4b07-916f-08d8d6947b91
X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Feb 2021 18:14:08.8356 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 9Kkl+GYiI6dvVQ24tBdr4mR8zpYMQvBurScQMn5ca+vv8Eh6mGx3NVuW1qr1Rhoy/AAW6tIrH2H5wJsRfKXU7+7Qj8pcWwmi4Qdpmxe/RQ8=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR07MB4363
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/JD8P9G3z6C5-hTacyz-2QHR07tQ>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Main mailing list of the IETF QUIC working group <quic.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic>, <mailto:quic-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic/>
List-Post: <mailto:quic@ietf.org>
List-Help: <mailto:quic-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic>, <mailto:quic-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 21 Feb 2021 18:15:07 -0000

Hi,

I took a more detailed look at how (D)TLS and QUIC apply the advantage bounds in practice. If I have understood correctly, (D)TLS and QUIC set bounds on CA and IA for a single key (called CA_key and IA_key below) and then force a rekey when (or before) this limit is reached. 

I think it is great that the AEAD limit work has made it clear that counters for v and q as well as frequent rekeying are needed. However the process of limiting CA/IA per key does not seem like the right thing to do for a security protocol where each connection has many keys, communication between two parties can use many connections, and adversaries can often trick the parties to tear down the old connection and set up a new connection. I think a general process need to be designed a bit differently.

The concrete limits on v and q set by (D)TLS 1.3 and QUIC seem essential to keep the GCM CA, CCM CA, and the CCM success probability per forgery attempt low. The process used can however give a bit strange and misleading results as seen below:



Example 1: The ideal t-bit MAC

IA_key = v / 2^t

Using the process of setting an upper bound p = 2^-57 for a single key gives v <= 2^t * 2^-57 and following QUIC and DTLS you must re-key when that limit is reached, but this does not improve the security at all for the ideal MAC. The forgery probability of each packet is always 2^-t anyway.


Example 2: Sending 2^64 packets with ChaCha20-Poly1305 (l=2^10)

CA_key <= v * l / 2^103

a) Rekying every TLS packet gives CA_key <= 2^-93
b) Rekying every 2^36 TLS packet gives CA_key <= 2^-57
c) Rekying every 2^64 TLS packet gives CA_key <= 2^-27

These looks drastically different, but assuming the single-key bounds are tight, an adversary trying to attack the whole connection can do so with an advantage of 2^-27 (CA_key * number of keys) for all three options.


Example 3: IA bounderies per key.

DTLS 1.3 limits IA per key but does not limit the number of keys per connection. That means an attacker can make IA for the connection arbitrary high. Limiting the IA per connection does not help either if the assumption is that the parties just set up a new connection. The only possible thing to do is likely to limit the forgery success probability per forgery attempt.



It seems quite easy to see from the inequalities when rekeying lower the advantage for the connection as a whole. Looking at the the single-key inequalities. If the dominating term in the advantage it proportional to q^2 or v^2 it is beneficial to re-key also for small v and q.

AES-GCM CA <= ((s + q + 1)^2) / 2^129
AES-CCM CA <= (2l * q)^2 / 2^128
AES-CCM IA <= v / 2^128 + (2l * (v + q))^2 / 2^128

If the advantage is proportional to q or v, re-keying does not lower the advantage for the connection as a whole even for large v and q:

AES-GCM IA <= 2 * (v * (l + 1)) / 2^128
ChaCha  CA <= v * ((8 * l) / 2^106)
ChaCha  IA <= v * ((8 * l) / 2^106)

For AES-CCM with 64-bit tags, the advantage is dominated by the term 
v / 2^64 when v,q is small and the term (2l * (v + q))^2 / 2^128 when v,q are larger.

AES-CCM_8 IA <= v / 2^64 + (2l * (v + q))^2 / 2^128

Assuming l=2^8 and limits v = q = 2^40, the integrity advantage after 2^40 packages is IA <= 2^-24 + 2^-28 which is very close to the advantage IA = 2^-24 for an ideal 64-bit MAC after 2^40 forgery attempts. CCM_8 has much worse IA than the other algorithms because of it tag length, but rekeying frequently does not improve application security.



To summarize:

- For GCM CA, CCM CA, and CCM IA, counters for v and q and rekeying definitely needs to be mandated to keep the quadricly growing advantage bounded. I think the AEAD limit work is great in showing the need for this. Thank you!

- The limits in the DLTS 1.3 draft also puts clear bounds on CA for the whole connection, CA per protected message, and IA per forgery attempt, which is great. The CA advantage for an attacker for the whole connection varies quite a lot between the algorithms, but that is ok. The limits in DTLS 1.3 does not limit the IA for the whole connection.

- I think the process to put a limit on CA and IA for a single key does not give the wanted results for a security protocol with many keys per connection, many connection per peers, and attackers can force new connections. It might be better to look at "multi-key" security involving all the keys in the connection and calculating CA/IA for a connection with a fixed number of messages. The best approach is might however be to just look at "single-key" security and set maximum limits for CA / q and IA / v or something similar. 

- When using CCM_8, frequent rekeying does not significantly improve IA for a long connection. When v << 2^40 and q << 2^40 CCM_8 is very close to an ideal 64-bit MAC. Any 64-bit MAC does of course provide much worse IA than a good 128-bit MAC.

- Very frequent rekeying should be recommended, but maybe even more as a way to limit the effect of key leagage then to lower CA and IA. This put higher requirements (forward secrecy, post-compromise security) on which re-keying mechanism that is used.

- I don't see any need for DTLS 1.3 and QUIC to change except maybe being more allowing to CCM_8 for IoT applications. I think CORE should introduce counters for v and q and rekeying, but probably use a slightly different process. I see no need to frequently rekey CCM_8. CCM_8 is close to the ideal 64-bit MAC unless for high values of v and q. CCM_8 is ok as long as 64-bit MACs are acceptable, which I think they are, especially for constrained IoT radio, where sending 2^64 packets (4.3 billion messages per second for 68 years) is infeasible.

Cheers,
John