Re: [TLS] KeyUpdate and unbounded write obligations

Keith Winstein <keithw@cs.stanford.edu> Fri, 19 August 2016 00:18 UTC

Return-Path: <winstein@gmail.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E12BE12D159 for <tls@ietfa.amsl.com>; Thu, 18 Aug 2016 17:18:56 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-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 EhKkOhXDClFE for <tls@ietfa.amsl.com>; Thu, 18 Aug 2016 17:18:54 -0700 (PDT)
Received: from mail-yb0-x234.google.com (mail-yb0-x234.google.com [IPv6:2607:f8b0:4002:c09::234]) (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 9EBEF12D08F for <tls@ietf.org>; Thu, 18 Aug 2016 17:18:54 -0700 (PDT)
Received: by mail-yb0-x234.google.com with SMTP id d10so10850543ybi.1 for <tls@ietf.org>; Thu, 18 Aug 2016 17:18:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=mZeqA9MsMO57u9EHR/UkdpRr3nrnyPWgKVMmC/GA+H8=; b=WJ0UOK0JvnUXbf/ol1HlzMEQ/E8XCSS2O1dw1GCu+YgPqE6dVhnDs8iUgmC+0NVB4o qZjJy7nO7lJKukAF2fLOK5heKozgr3I1iSxHyyttJkjvejq4WhdGVK6gMOm/lNs/rulh ljs/iyw9pvZ+FcwlJE52A7o4p3zbKnPDhb+Lyt0ovhnuwTJ5obfecKgou1+VgmXopuXp Up6GopsAueMMxyb9T4YbBKRQf+PyrEuJbOMiqSb67vkV72UXfLcZvj70xg/V+BatQYxD r4UWZaYfY1AdwH6lUQ06VIrza1XGg0xy39Zu+KgWwxsUJ1MH2KK+1hh66L4YzJV6sNlZ eT3g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=mZeqA9MsMO57u9EHR/UkdpRr3nrnyPWgKVMmC/GA+H8=; b=DBLKsuqKuplKeoJJIk2Plz+XLPJi+uum6sulonstQn80Nt43PE4LshoOH54ytf2/4n 2u/sNAVWLwZDjKVeQ++V7Il1tSM6K4SgOFjh8q1W89Xy3kaVCLzXgyjkLry8LL4pyKFE JaOVJKtHqiTJStEyPO12hu1RTD+ghajkNnRH2wefVDGzt72/6LLpnV8hxOXII48VjtUk v34OrFelFyXBcEcLZIFTFWonOPDqyZ315TEtKLuBGpbVaB9pLvTut+HDfnAO/M3GHaCR yt6iXMXicQW3nTdf7DrlXz0fFZ2vrBdHIJ6nQQOqfZsv/ie67z7vrRJZp3OhpyWvKsM0 LIow==
X-Gm-Message-State: AEkoout43cHv4PEx6zeqg2ERo2QRPF2yqPZy2VfKAyjoQsdFTr1hTxQIP7076sWqdYaGY3K1njayJ9z+IUAztw==
X-Received: by 10.37.64.131 with SMTP id n125mr3783832yba.32.1471565933579; Thu, 18 Aug 2016 17:18:53 -0700 (PDT)
MIME-Version: 1.0
Sender: winstein@gmail.com
Received: by 10.129.79.209 with HTTP; Thu, 18 Aug 2016 17:18:13 -0700 (PDT)
In-Reply-To: <CAMfhd9UQ3jHLcUObBORi0Z_QQi2n4-fL9_KCwLvcDKTkJN1z5A@mail.gmail.com>
References: <CAF8qwaDgGHGmuBwhZEz9-=Ss2bfzNAYWfmnbMqQDxTQnMUpH7g@mail.gmail.com> <93086b3c-ca1b-4c37-67e1-efbf417a8b58@akamai.com> <CAF8qwaDfWdCCQpD8z8iY0BMJjbrf8qi-qf5X7mSe8m+hNZu-FQ@mail.gmail.com> <CAMzhQmPB0GXZzh+g=-TMmAp9HQxpZUPcht4zi3_K7WW_ouGg6A@mail.gmail.com> <CAF8qwaC_NGmx4pW=HwsqWTnvZysFhXayHJ1wPVAakWHo7nunxA@mail.gmail.com> <CAMfhd9UOOXLRmNjJogikQHa8QJx+HSLO-WuwJhgKKgAA-5TeBQ@mail.gmail.com> <CAMzhQmOmOou6SvmZygJ6emfn2xAnU_jT7zb005fD4NRuOLmnPg@mail.gmail.com> <CAMfhd9UQaiWH_CAKNUMymARJAsWv4+3AatjgNEqrD78-rakubA@mail.gmail.com> <CAMzhQmMnG2cgbfOZE0VDgFRpF15B+yjx2E5G-V2fh2TwLiDcBQ@mail.gmail.com> <CAMfhd9UQ3jHLcUObBORi0Z_QQi2n4-fL9_KCwLvcDKTkJN1z5A@mail.gmail.com>
From: Keith Winstein <keithw@cs.stanford.edu>
Date: Thu, 18 Aug 2016 17:18:13 -0700
X-Google-Sender-Auth: gHOnaInh04DL6woA_4taqdoB76U
Message-ID: <CAMzhQmMaBp0sPca9xb9jVrC=mjtZ8Rq3FnH8R8x6jcOxBO=9nA@mail.gmail.com>
To: Adam Langley <agl@imperialviolet.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/5Fn2rMpK1m2UQBR6WiaSKo_4ue8>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] KeyUpdate and unbounded write obligations
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Aug 2016 00:18:57 -0000

On Thu, Aug 18, 2016 at 2:26 PM, Adam Langley <agl@imperialviolet.org> wrote:

> I think I was because I hadn't seen your Berlin presentation. But I'm still
> going to hijack this thread and ask you to expand on some of these points so
> that I understand your motivation :)

Fair enough. :-)

>> - An embedded device may wish to fully rotate the session keys before
>> going to sleep.
>
> I imagine the argument here goes:
>
> 1) Sleep is good because it saves power.
> 2) To sleep we need to power down (and erase) most memory.
> 3) So to keep a TLS connection across sleep/wake secrets have to be saved to
> flash, but that's hard to erase so we don't want to expose keys that were
> used to encrypt traffic.

Yeah, our reasoning follows yours and goes a little further:

4) I don't know when I'm going to wake up again.
5) I don't want a subsequent compromise of me *or* the other side to
reveal prior plaintext from the session.
6) Because I'm going to sleep, it's now or never to make sure the
session keys aren't retained.
7) Therefore, I'd like to make sure both sides have ratcheted forwards
before I go to sleep.

> For that I see why one needs KeyUpdate to be echoed: as the embedded device,
> you want the peer to rotate keys so that you can write only fresh keys to
> flash. On wake you want the other side to rotate again so that the keys in
> flash were only used to authenticate a new KeyUpdate.
>
> But why do you need the other side to have confirmed that it has erased your
> keys? I think you only care that it echos your KeyUpdate messages promptly.

Agreed, P1+P2 is sufficient if the device only cares about making sure
*it* is not going to leak keying material (that can reveal prior
plaintext) if there is a compromise during sleep. You need P3 if you
are also concerned the peer might be holding on to an old key.

>> - A paranoid device might fully rotate the session keys before closing
>> the session. (If confirmation is absent, the device might use a
>> higher-level mechanism to forcibly log out all open sessions from that
>> user.)
>
> The worry here is that a peer might be seized and subject to a cold-boot
> attack to lift the TLS connection keys? So if you don't hear from it every
> $x seconds you'll log it out?

Probably nothing that elaborate.

The device is concerned that after the session is over (from its
perspective), the server might get compromised, and the attacker reads
the key for a long-dormant session out of the server's /dev/mem, and
uses it to decrypt prior ciphertext.

One approach is that the device should make sure to close every
session with a secure bidirectional close, where the server actually
confirms that the session is dead in both directions. But TLS does not
have a secure bidirectional close. (Even when used, close_notify only
promises there will be no more data in *that* direction.)

However, the device can try to guarantee that both sides have
ratcheted past all the keys that could reveal prior plaintext.

> Again does the confirmation here help?

The confirmation is the way for the device to know that the server has
read its request to ratchet the client-to-server traffic key forwards.
(And the idea would be, if the device doesn't get that confirmation
and really wants it, it may have to raise a warning and handle this at
the application layer -- e.g. by opening a new session to the server
and issuing a "kill all sessions" command.)

> What if you send a KeyUpdate and receive a change password request? The peer
> might well have sent it before receiving your KeyUpdate, or maybe it was seized and
> will just choose not to echo your KeyUpdate.

Sure, there's nothing you can do if the peer gets compromised while
important keys still live on it. But the idea here is for the device
to be able to make sure the keys get ratcheted after all the data is
sent but before there can be a later compromise. Basically
approximating (some of) the semantics of an actual secure
bidirectional close.

> If they have a channel to the user where they are sending a stream of old
> keys, couldn't they just mirror the plaintext of the connection to keep
> things simple? I guess you worry about a device that's cooperative enough to
> put in the effort to have their audit channel but lies about the plaintext?

Right, exactly. (Ideally, the device doesn't even know it's being
audited until the user logs in to the Web UI and says, "okay, now,
ratchet the session and then share the old keys with this auditor that
I am going to introduce you to, so it can decrypt some earlier
ciphertext I've been capturing." So we don't want a parallel channel
and we don't even want the device to have to know about the audit
beforehand.)

-Keith