Re: [TLS] Resumption and Forward Secrecy, 0-RTT and Safety

Karthikeyan Bhargavan <karthik.bhargavan@gmail.com> Mon, 28 March 2016 20:31 UTC

Return-Path: <karthik.bhargavan@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 EF40212DBE9 for <tls@ietfa.amsl.com>; Mon, 28 Mar 2016 13:31:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.699
X-Spam-Level:
X-Spam-Status: No, score=-2.699 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_LOW=-0.7, 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 vs4jDEOvQBBz for <tls@ietfa.amsl.com>; Mon, 28 Mar 2016 13:31:42 -0700 (PDT)
Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) (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 A240A12D501 for <tls@ietf.org>; Mon, 28 Mar 2016 13:31:10 -0700 (PDT)
Received: by mail-wm0-x22a.google.com with SMTP id p65so111390798wmp.0 for <tls@ietf.org>; Mon, 28 Mar 2016 13:31:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:subject:from:in-reply-to:date:cc:message-id:references :to; bh=Ws+aQ5I2Dr0UWEmfmPC+mEOBiYZWPmRf9RJAPEpCBHc=; b=XgyMtfmWD8QEwYufNeGCK9yOwzxwvgveJGbBI7L5px6em5dtCBA+54B3WOYrXEYJMY WS/1YupxTpJujm4FdhDWbTHTRxbcC1oLaNhZhcP3vX9to/O9F6D5PxKGHVjs88VQ8A8R QlPm8nMdF8HwcULsBTkig8VVBVisqlOG56uh96YM18L7ag06RINz+U3wufs6mKsIoc4K PTuXqEjXsigkO9q6L9UGMjNc/yQUSCC3713ihaYXXgLoNOisjPRA8DFr36Jy38LHRiOJ 4ypuU+6Xw2UaQ2+559d6SFlKVcuwiDrD52EAl9nmUkIc1SiPk3TdkCN2pXUbMMvgDZgv e4oA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :message-id:references:to; bh=Ws+aQ5I2Dr0UWEmfmPC+mEOBiYZWPmRf9RJAPEpCBHc=; b=l/ZamqVIONa07Xr64cehVt36ARP7HDR5WdbwN1V0/8qWoK5NCXDHdIvSjgOnAtNcdo P7WEAQhZhyOdv2DiIh1P0+jFCGJS5Rb+9PB6NSPMinScVE06Mz7DHi5yW6Mr2Bo/STP9 BiXaulMhVXNfrZxSNp4fT4ndpURIN+YofS1ugcK6KE6VlkA7h3Orr4bzq4M7REirPWhB H+QFRdbNybxMsZiEHzcCRqgHTQsWkrB+XxFoyrNApnUuOTjEQAONunxDSzrnIfthohh2 AQe/9m9KF6j2FxP+2a2tgNPWWoPHlead5VtY3FFCXUUrCSLlhmOtcInrYzRkVQaYp6go JkgQ==
X-Gm-Message-State: AD7BkJIlyX2VGdEolDO93zNTo5dMhL1vftnAkWteAIi2Anx/VVAto0CS6PAeKX7TER7Ifg==
X-Received: by 10.194.9.201 with SMTP id c9mr14660496wjb.47.1459197069201; Mon, 28 Mar 2016 13:31:09 -0700 (PDT)
Received: from [192.168.0.51] (89-156-8-219.rev.numericable.fr. [89.156.8.219]) by smtp.gmail.com with ESMTPSA id s66sm11627846wmb.6.2016.03.28.13.31.08 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Mar 2016 13:31:08 -0700 (PDT)
Content-Type: multipart/alternative; boundary="Apple-Mail=_73BC8236-D4E5-4372-997D-C674598B9B72"
Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\))
From: Karthikeyan Bhargavan <karthik.bhargavan@gmail.com>
In-Reply-To: <CAAF6GDeLshxG0o2_a9vPBTMtNHLNf9tynJaPPnAm2ZrAca19iw@mail.gmail.com>
Date: Mon, 28 Mar 2016 22:31:07 +0200
Message-Id: <7B4301E9-0282-47A3-8824-5ACC2C61910F@gmail.com>
References: <CAAF6GDeLshxG0o2_a9vPBTMtNHLNf9tynJaPPnAm2ZrAca19iw@mail.gmail.com>
To: Colm MacCárthaigh <colm@allcosts.net>
X-Mailer: Apple Mail (2.3112)
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/rp-LuGtH5wQe4byhpKgMaWzAivU>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] Resumption and Forward Secrecy, 0-RTT and Safety
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: Mon, 28 Mar 2016 20:31:45 -0000

Let me try to understand the concerns here.

> Resumption and Forward Secrecy

PSK_ECDHE in TLS 1.3 does provide forward secrecy for 1-RTT data, yes?
This is already better than TLS 1.2 where we had no way to do forward-secret resumption.
In that case, the concern is mainly for 0-RTT, which I agree is harder to get right.

> 0RTT and Safety
> I see at least three different challenges with 0RTT as defined. The first is a general and high level one: we seem to willing to accept a "lower" level of security for 0RTT data (e.g. no FS, even if the rest of the session has it). Why? What is it we think is special about this data that it is "less" worth protecting? surely there are very sensitive things in urls, surely there are potential oracles and other things in there too? It just seems super strange to me. 

I wonder if the QUIC folks have an answer to this question? It would be good to gather “typical” intended use cases of 0-RTT data.
In any case, it is good to distinguish this forward secrecy concern from replay, because secrecy is in the control of the client, who can choose to send or not send sensitive data, but replay detection is in the hands of the server.

> The second challenge is that the replayability of the 0RTT poses a cryptographic safety challenge. Take Lucky13 - which is a brilliant attack and is stunningly effective against DTLS because it is so easy to replay over and over; barely needing to change any parameters - and let the server do the work. 0RTT looks very similar. It doesn't seem wise to let cipher text manipulators take as many cracks at the whip as they'd like. 
> The third challenge is that the 0RTT plaintext data itself may not be safe to replay; that is that it might trigger some kind of non-idempotent action. Idempotence is really really hard, it isn't safe to simply plug in a replayable section to existing protocols. There's also a huge difference between being tolerant to a small number of replays, and a large unbounded number. For example: a large unbounded number may be used to generate DOS attacks against  throttles and quotas. 

Yes, detecting and preventing replays by default would be good.
However, I wouldn’t tie this in with the session mechanism. 
Wouldn’t we want to prevent replay of DH 0-RTT requests?

Best,
Karthik


> 
> The third challenge is that the 0RTT plaintext data itself may not be safe to replay; that is that it might trigger some kind of non-idempotent action. Idempotence is really really hard, it isn't safe to simply plug in a replayable section to existing protocols. There's also a huge difference between being tolerant to a small number of replays, and a large unbounded number. For example: a large unbounded number may be used to generate DOS attacks against  throttles and quotas. 
> 
> Tying things together
> Short of some kind of transactional locking protocol during TLS handshakes, I don't think there is a scheme that can perfectly prevent replay. Bill Cox' analysis is a really good one here. But I'd like to observe that the sort of single-use-session-id cache outlined above has a nice property that it makes for a sort of strike register. Since the server-side implementor is incentivized to evict entries, or at least mark them as used, so that the slot is available for re-use; that can be doubled-up as a "we've seen this already" signal. This reduces the replay window to the time period for that signal to propagate (e.g. for an eviction to happen from the cache). 
> 
> So 0RTT data could be encrypted under the resumption session id. That creates the challenge that the session might not be there any more, so the server may not be able to decrypt the 0RTT data. I actually think this is a plus, and lines up with a separate important change I think is necessary - the 0RTT data shouldn't be application data. It should be a separate, optional, stream. I find it helpful to think of it as a hint, so it could be called "replayable_hint". Instead of breaking apart an existing protocol and putting some of it in the early data and some in the application data transparently (a disaster in waiting), the client and server would have to formally agree on the kind of data that could be in a "replayable_hint". This goes a long way to mitigating many protocol level idempotency concerns, and has no impact on the kind of pre-fetching people want to do for HTTP and other protocols. At a bare minimum, I think we should make this change. 
> 
> Lastly, and this is a little crazy but I haven't let that stop me before ... to guard against the smaller replay window and idempotency problems at the application levels,clients should occasionally send duplicate and unrelated hints, just opportunistically. This keeps the server side application "on notice" that that kind of craziness can occur, and better to have it happen a little all of the time in a controlled way, than rarely by attackers.  
> 
> Summary
> A common theme in the above is that it makes things more expensive for server-side implementors, and that sucks - but I don't see another way to avoid some of the pitfalls here; and I'm unhappy with the state of tickets today. If I'm on my own on that, I'd be interested in what kinds of data people might kind convincing. My own impressions come from being an Apache httpd developer and assisting people with configurations and running workshops at conferences. It's not scientific, but the prevalence of non-rotation is so severe in my sample set that I'm convinced it's the norm. 
> 
> -- 
> Colm
> _______________________________________________
> TLS mailing list
> TLS@ietf.org
> https://www.ietf.org/mailman/listinfo/tls