Re: Read-out on offline connection ID discussion

Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com> Thu, 25 January 2018 09:07 UTC

Return-Path: <mikkelfj@gmail.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 76FEF12E870 for <quic@ietfa.amsl.com>; Thu, 25 Jan 2018 01:07:39 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.997
X-Spam-Level:
X-Spam-Status: No, score=-1.997 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 G0hy_zEXPPLT for <quic@ietfa.amsl.com>; Thu, 25 Jan 2018 01:07:37 -0800 (PST)
Received: from mail-io0-x229.google.com (mail-io0-x229.google.com [IPv6:2607:f8b0:4001:c06::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3CA6512D868 for <quic@ietf.org>; Thu, 25 Jan 2018 01:07:37 -0800 (PST)
Received: by mail-io0-x229.google.com with SMTP id c17so7919387iod.1 for <quic@ietf.org>; Thu, 25 Jan 2018 01:07:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :cc; bh=QsUu5SSeGnlzBcA1QTMYDR+qo7AWxAnI6szsCbwBuaI=; b=NKGaJaqtSnX3m+vybKbcYXK50t8y28aH4jj42kP2ADFdTVI/gKTJn5c/U9d9VMrR8E K7r7n81Q+lbPyLLAEfp5FjivDN6Irg0RLZtbXB71zJT8TRKJP/0Q0EnxF6zmukns0ezb S3VbYCFJjvg1y8v9dj54mxbfxKOYVt7RKTMERVwF86HRtDp1mQQVKNDVJ3FcCu229oPy SjyNvahBoFyaetBC1FomYjBOOKPZCGjbAXBAVtGWulEinlwxhGY2QSUAn8paXp8AiAIz UYPRgcCWg5rKXsaX50qmo8h9BeuUYMqOLYYRhhKCOvxmTAjWer4xKnJlJqHEhtHeGgCh /iyw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=QsUu5SSeGnlzBcA1QTMYDR+qo7AWxAnI6szsCbwBuaI=; b=gJSDmpEcUHdI9Vm+oc96FCCzB/S/Ko4DKY3X1dmEJ5TC0/aOgrlJ68UOBwR5Eu4112 BNdI0urWOB9jBPaW4zo44JvljfJnseUggQ+3ZsBgvtpQ8VqtbYmFGo4uY447XWcHKTiR Ebi+NSPvknt427nB3FbCKJO6Z231t8dh4U+OtaLu3L3qdan9tGVCCGdZGlwu5RKtZnyh 9GLWWdWhIi0LS3Yq2Zp/KW23RhOdMxRPr7GrGsw6tHv/siyTItWBX7jVYvRhcofBFzpk z3LWQGCA4uJLq/W9RX1HN5FCYtJJBQH1m9VRwQTtacnmCyZWFpoM9QHfSDaDy3wr16TW pXfg==
X-Gm-Message-State: AKwxytc+Hs/sa/leMdNj53ukxHuhB8jBThEwN4WHtq0hNIGESQCIZ+3G g/0tlzfSNNYrc6fypkSRrva/vJVKJrV8DfPZags=
X-Google-Smtp-Source: AH8x225E8owWRoxU/NIpX6khzWfApYsc1HShkVChwNnYW7hqZ0ORFDGhEbKIM9gnK16qkM7QvwTzfyWwI5PCD0WucrQ=
X-Received: by 10.107.3.209 with SMTP id e78mr11102858ioi.96.1516871256558; Thu, 25 Jan 2018 01:07:36 -0800 (PST)
Received: from 1058052472880 named unknown by gmailapi.google.com with HTTPREST; Thu, 25 Jan 2018 01:07:35 -0800
From: Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com>
In-Reply-To: <CAN1APdcuyGk=2TAv+7WoRAsh3vVPxu56xXtdj0SgNaTL=ihvPA@mail.gmail.com>
References: <CABcZeBO8UcdsPPp7D-3gZW8tuDqNhP-z+O1+WH=68KjbfYMr5A@mail.gmail.com> <CAN1APdewkGQULckLb6F4rEzcPtiFJPBVBQbkcNeupK3d+r6Sow@mail.gmail.com> <CABcZeBO2iRrFXNgLD1AsxmwRJ+Pz6USadWGeU5vb12Pu9eOyog@mail.gmail.com> <CAN1APdcuyGk=2TAv+7WoRAsh3vVPxu56xXtdj0SgNaTL=ihvPA@mail.gmail.com>
X-Mailer: Airmail (420)
MIME-Version: 1.0
Date: Thu, 25 Jan 2018 01:07:35 -0800
Message-ID: <CAN1APdfwMV9YBHYaN4iDOg4-JoeSWhiX5NRD+UxtqgigXtnVSQ@mail.gmail.com>
Subject: Re: Read-out on offline connection ID discussion
To: Eric Rescorla <ekr@rtfm.com>
Cc: IETF QUIC WG <quic@ietf.org>
Content-Type: multipart/alternative; boundary="001a113dea646ad1940563961c97"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/MRPRdipHvoUYtQ8_ji6MfF6_Tnc>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.22
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: Thu, 25 Jan 2018 09:07:39 -0000

Another thing is that such a scheme is somewhat broken because an off-path
attacker can connect to a host as any other client and retrieve a
connection ID. Then it has sufficient information about the routing table
for the next our to flood a specific route.

It’s not really possible to avoid unless each router has more information
than a key rotating every hour.

The targeted server can protect itself by not accepting any encrypted ECID
in a new handshake and drop packets via ordinary auth failure on other
packets.

To handle stateless retry, the encryption ECID for retry must be different,
so we name it RECID. The targeted server will generate ECID for client
initiated communication with a random client CID, or accept RECID based
handshakes, but will not accept ECID for handshake because that is a DoS
waiting to happen.

Kind Regards,
Mikkel Fahnøe Jørgensen


On 25 January 2018 at 09.45.07, Mikkel Fahnøe Jørgensen (mikkelfj@gmail.com)
wrote:

On 25 January 2018 at 00.16.55, Eric Rescorla (ekr@rtfm.com) wrote:

I don’t understand this requirement for the CID to be 16 bytes in order to
be encrypted.
If you have a unique key you can encrypt 0, truncate and xor with the CID.
If you don’t have a unique key, you can encrypt a unique counter value and
do the same, or derive a unique key.


I don't believe what you are describing works correctly, but I'm not sure I
understand your proposal. Can you please flesh out precisely what you have
in mind? In particular, who is "you", who has the key, etc.?

I’m merely stating that if you want to encrypt with AES and you do not care
about authentication, then AES works fine with shorter inputs than 16
bytes. You may still have to provide an initialisation vector so the +n
still holds. The last block of AES-GCM is not a full block and works as i
described - see sect. 2.3 and figure 1 in link to GCM paper. If the last
block is the only block, you encrypt less than 16 bytes without any magic.

There are many reasons you might want to use 16 bytes, or you might want to
add authentication, but it is not AES itself that imposes those constraints
as already argued. My point is that if you need 16 bytes, please state why,
instead of blaming it on AES.

As to a possible scheme:

Assume a server cluster wants to encode routing data by selecting one out
of 256 possible routes and a 8 bit unique id for each route. This can be
done with 16 bits. (Not saying this is a good idea). Or, let’s make it
simple for a start: just have 1 routing bit R to choose between two servers
and 1 IV bit to identify the connection, and one phase bit P. The objective
is to make it unpredictable which server is hit. The encryption of the two
bits happen by encrypting the IV bit with a cluster key that all routers
are aware of. The phase bit is not needed but avoids guessing which router
key is active since it rotates every hour derived from a master key. The
encrypted CID is just 1 bit flipped randomly based on XOR’ing with
encrypting 1 or 0, depending the IV is 1 or 0. key = derive(master, R), P =
not P if key changed since last derivation. The encrypted CID ECID =
<AES(key, IV) XOR R, IV, P>.

We can readily extend the above to as many R bits as needed. The IV must be
unique but if we only care about making it hard to force a route rather
than protecting information, it is less critical, assuming we hide the
master key behind strong derivation.

The problem is that an attacker can easily flip the first bit in the ECID.
We can make this harder by having more than R bits than valid routes and
having more IV bits chosen at random. The R bits now either map to a valid
route or not. It becomes harder to guess a valid route.

We can make this harder by adding an auth tag - say of length 16 bits.
AES-GCM is not suited for short tags, but there CMACs that can do this I
believe (two times AES + padding and truncation to desired length, from
memory). However, if it is sufficiently hard to guess a route, and it is
easy to decide if a route is valid or not, it may not be necessary with an
auth tag.

In addition we want to identify the connection uniquely with respect to the
chosen server route so we add U bits to make the connection id unique.
These do not have to be encrypted, but they might as well be thrown in.

http://www.mindspring.com/~dmcgrew/gcm-nist-6.pdf

AES-GCM goes horribly wrong if the same encrypted counter value is used
twice - but we may not have a problem with horribly wrong in our use case,
which also only uses the CTR mode part.