Subject: Re: [TLS] WGLC for draft-ietf-tls-cached-info-19

From: Hannes Tschofenig <[email-masked]>
Date: Thu, 10 Sep 2015 13:14:52 +0200

Hi Martin,

thanks for your feedback. I have discussed the topic with my co-worker
Manuel.

Another way of seeing the use of the hash by the client is to help the
server to select the pick certificate (or other cached data). It does
not have a security purpose as such, it is only a way to prevent the
server accidentally including the wrong information. For example, this
can happen when the server has multiple certificates to choose from then
it should pick the right one (and I am not talking about the SNI case
here).

Without the possibility for picking the wrong value we could have as
well omitted the hash altogether. The actual function used to compete
the fingerprint isn't that important as long as it helps to make sure
that the correct value can be chosen with a reasonable probably. In the
worst case, the wrong value is chosen and the exchange failed. The
client will then have to re-start the exchange without the cached info
feature.

As such, you are certainly right that the hash does not need to be long
since the changes of selecting the wrong information is very low. In
case of the certificate the security actually comes from the private
key: the server needs to demonstrate that it knows the privacy key in
the exchange.

Regarding the use of the TLS PRF I am not sure that this will work since
the actual function is the result of the negotiated cipher and not known
at the time when the client and the server exchange their hello messages.

Ciao
Hannes

PS: Additing extra text with information about what is included in the
hash will be added to make sure that implementers compute the hash over
the correct fields of the message.

On 08/24/2015 08:35 PM, Martin Thomson wrote:
> Hi Hannes,
> 
> On 24 August 2015 at 09:38, Hannes Tschofenig <[email-masked]> wrote:
>>> I'd like to see the document explicitly note that msg_type and length
>>> from the handshake message are not covered by the hash.  The
>>> description of what is covered is a little too terse (and badly
>>> formatted).
>>
>> There are multiple message type / message length fields included in the
>> message and I am not sure which of those you rare referring to.
>>
>> The msg_type and msg_length from the record layer is not part of the
>> fingerprint calculation. The spec only focuses on the certificate
>> message in Section 4.1 and the CertificateRequest message in Section
>> 4.2. These message do, however, also contain length information.
> 
> I refer to the msg_type and length from the handshake message, which
> are the only things with that name in the TLS spec.
> 
> You use the name `CertificateRequest`, which leads me to conclude that
> you mean the struct identified as such, which is *inside* the
> handshake message.  (I'm fine with hashing that part, I just want to
> have it be very clear.)
> 
>> I included an example into the document. See Appendix A:
>> https://github.com/hannestschofenig/tschofenig-ids/blob/master/tls-cached-info/draft-ietf-tls-cached-info-20.txt
> 
> This includes the msg_type and length.  Which means that you should
> talk about hashing `Handshake` instead.
> 
>>> I'm not sure that I like the lack of both negotiation and signaling
>>> for the hashes that are used here.
>>
>> We had a negotiation capability in earlier versions of the document but
>> it appeared to be an overkill.
> 
> Yeah, that's why I'm thinking that this can use the PRF hash.
> 
>> What is there now is essentially an indication of the hash algorithm
>> based on what the client presents with the CachedInformationType
>> structure.
> 
> I don't see that anywhere.  The algorithm seems to be fixed to SHA-256
> in the current draft (and your copy).
> 
>>>  Though I think the chances of a
>>> collision being found, or that a collision would lead to an attack,
>>> are slim, I would rather see this use the PRF hash so we have at least
>>> that much flexibility.
>>
>> While there is indeed a possibility for hash collisions those will still
>> lead to a failed exchange since the TLS server will not possess the
>> correct private key that corresponds to the cached certificate.
> 
> Right, this might be all that the analysis requires.
> 
>>>  If the current design is retained, I would
>>> like to see a little discussion of this in the document.  A little
>>> analysis of the properties we expect the hash to provide would also be
>>> good.
>>>
>>> I think that truncated hashes might be advantageous from the server
>>> side.  Given that the server only uses hashes to identify which of the
>>> offered (available, known?) cached information is in use, is there any
>>> reason you can't save additional space by arbitrarily truncating the
>>> hash?  In many cases I would imagine that the client would be offering
>>> only one option and even if there were a small number of options
>>> presented, a single byte would suffice to disambiguate.
>>>
>>> I'm trying to think why you might want the full-length hash on the
>>> client side, but I believe that the only problem there is that there
>>> might be a collision between the certificates that a server might
>>> offer if you truncate too aggressively.  The connection still relies
>>> on the server presenting proof of knowledge of a key that the client
>>> extracts from a certificate bound to the server identity, so I believe
>>> that it would be equally secure if you removed all mention of
>>> certificates from the protocol.  And that makes me nervous, because
>>> I'm fairly sure that Karthik will tell me that I'm wrong very shortly;
>>> since we've put in a lot of work to cover key fields in the handshake
>>> hash, and I'm concerned that this could be exploited somehow.
>>>
>>> The more I think about this, the more I think that we need a little
>>> more analysis on this point (i.e., what properties the hash function
>>> needs to provide and why).  If it has already happened, mention of
>>> that in the security considerations is needed.
>>>
>>> (I think that truncation on the server side is safe if the client uses
>>> a strong hash function to identify the certificate, but I'm frequently
>>> wrong about these things.)
>>>
>> There are three designs possible for referencing the cached state, namely
>>
>> 1) The client creates the reference.
>> 2) The server creates the reference.
>> 3) There is no reference at all.
> 
> I'm not suggesting that you change the design, just provide a
> description of the properties that it provides - and those that it
> relies on.
> 
> On the surface at least, it seems OK to rely on a weak guarantee of
> collision resistance from the hash.  Failure only results in handshake
> failure, after which the client can fall back.  That suggests that a
> truncated hash output could be used, potentially saving quite a few
> bytes in the client's first flight.  I'd like to do that if it is
> possible.
> 
> However, I'm concerned that eliding identity will lead to a weakness
> somewhere.  For instance, if the client uses a shorter hash, then the
> server might pick up different certificates.  Or, it means that
> identity is not bound to the session hash as directly.  If, as you
> say, we can rely on this being a direct selector for a private key
> where the security is bound to that private key, then maybe it's OK.
>

---

From: Martin Thomson <[email-masked]>
Date: Thu, 10 Sep 2015 07:59:30 -0700

Hi Hannes,

I've followed a similar chain of thought myself.  I think that the
right answer here is similar to what you describe: the security of TLS
does not depend on the presence of the certificate at all, rather it
depends on the use of a private key that the client trusts.  That most
clients rely on the certificate for getting the information they need
to make that trust decision and that the certificate happens to be
carried in TLS in most cases is largely consequential.

On that basis, I would be happy then to accept any hash, even a
truncated hash in both directions.  In most cases, I suspect that 8
bits would be plenty, though I imagine that clients will want to send
a few more than that just to reduce the odds of having to receive a
certificate.

--Martin

---

From: Sean Turner <[email-masked]>
Date: Tue, 15 Sep 2015 13:24:13 -0700

Hannes,

Go ahead and post the -20 version so we can get this ball rolling.

spt

On Aug 24, 2015, at 09:38, Hannes Tschofenig <[email-masked]> wrote:

> Hi Martin,
> 
> thanks for your review.
> 
> On 08/06/2015 10:33 PM, Martin Thomson wrote:
>> I've read this draft before, but this is considerably different to
>> what I read, and I haven't been following the discussion, so consider
>> this as a review with fresh eyes.
>> 
>> First the high points.  I think that this is useful, the right scope,
>> and reasonably well formulated.  I have a couple of minor points
>> 
>> Figure 2 is in error: it shows CertificateRequest instead of Certificate.
> 
> Good catch. A copy-and-paste error.
> 
>> 
> structure. If you need support for a new algorithm then add a new type
> (and the implementation). We could make it easier to add new algorithms
> (via the expert review process). We could also register another
> algorithm already now, if found necessary.
> 
> This is the current approach. The client creates a reference (via the
> use of the hash function) and tells the server that it has seen certain
> parameters before and that there is no need to re-transmit them.
> 
> In this design the server allocates the reference and sends it to the
> client. The client
> 
> The client just tells the server not to send certain payloads because it
> has cached something already previously. While the server does not get
> told what has been cached the worst thing that can happen is that the
> exchange fails (in which case the client has to fall back to a full
> exchange).
> 
> Which approach do you prefer? We had various iterations of this
> throughout the lifetime of the document.
> 
> Independently of these three approaches it is certainly true that fewer
> bytes transmitted over the wire are preferable.
> 
> Ciao
> Hannes
> 
>> 
>> On 6 August 2015 at 10:24, Joseph Salowey <[email-masked]> wrote:
>>> Hi Folks,
>>> 
>>> This is the Working Group last call for draft-ietf-tls-cached-info-19.  This
>>> document has undergone modification since last WGLC so another WGLC is
>>> appropriate.  This document is a dependency for the DICE working group
>>> TLS/DTLS profile. Please send your comments to the TLS list by September 2,
>>> 2015.
>>> 
>>> Thanks,
>>> 
>>> J&S
>>> 
>>> _______________________________________________
>>> TLS mailing list
>>> [email-masked]
>>> https://www.ietf.org/mailman/listinfo/tls
>>> 
>> 
>> _______________________________________________
>> TLS mailing list
>> [email-masked]
>> https://www.ietf.org/mailman/listinfo/tls
>> 
> 
> _______________________________________________
> TLS mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/tls

---

From: Eric Rescorla <[email-masked]>
Date: Tue, 15 Sep 2015 13:29:11 -0700

Sorry it's taken me so long to respond, but I'm not convinced that it's not
necessary
to have a secure digest here. Do you have a security analysis that
demonstrates
that that's the case?

-Ekr

---

From: Sean Turner <[email-masked]>
Date: Tue, 15 Sep 2015 14:37:22 -0700

If I recall correctly we’ve waffled on this a couple of times now; the draft has gone from requiring SHA-1 to FNV [0] back to SHA-1 and now I think it’s on SHA-256.  The switch away from FNV was primarily because it seemed odd to include a new algorithm for non-cryptographic purposes [1], i.e. just use SHA-1 and be done with it.  The security considerations have evolved over time from requiring reasonable random properties to none back to reasonable and then to strong randomness requirements to being silent.

spt

[0] http://datatracker.ietf.org/doc/draft-eastlake-fnv/
[1] https://mailarchive.ietf.org/arch/msg/tls/M3U1OJamaknKaN6rTdEEo4F8dm4

On Sep 15, 2015, at 13:29, Eric Rescorla <[email-masked]> wrote:

> Sorry it's taken me so long to respond, but I'm not convinced that it's not necessary
> to have a secure digest here. Do you have a security analysis that demonstrates
> that that's the case?
> 
> -Ekr
> 
> On Thu, Sep 10, 2015 at 7:59 AM, Martin Thomson <[email-masked]> wrote:
> Hi Hannes,
>

---

From: Martin Thomson <[email-masked]>
Date: Tue, 15 Sep 2015 14:49:52 -0700

> to have a secure digest here. Do you have a security analysis that

Do you want one?  I guess that I could adapt one of the existing 1.3
models to remove the certificate (and assume some out-of-band
mechanism for moving the certificate around).

That said, Hannes' argument is pretty straightforward:
  I separately learn that a public key is bound to a particular
identity (X.509 provides this binding, not TLS)
  The TLS connection is authenticated based on proof of possession of
the corresponding private key.

In short:
  Identity <--[X.509]--> 1 public key
  1 public key <--[TLS]--> 1 TLS session

---

From: Martin Thomson <[email-masked]>
Date: Tue, 15 Sep 2015 16:10:52 -0700

On 15 September 2015 at 14:49, Martin Thomson <[email-masked]> wrote:
> Do you have a security analysis that
>> demonstrates
>> that that's the case?
>

Sam just ran the analysis.  The TLS 1.3 proofs they have work without
Certificate in the transcript, which is equivalent to a zero-bit
truncated hash.

---

From: Karthikeyan Bhargavan <[email-masked]>
Date: Wed, 16 Sep 2015 05:12:03 +0200

> Certificate in the transcript, which is equivalent to a zero-bit

I assume the client hello extension still has the certificate digest, yes?
This means that the analysis probably relied on agreement of the certificate hash from the client hello.

I’d imagine that a full security analysis of this mode depends on which model of certificate issuance  we use.
For example, is it possible for a website to use the same public key on two certificates for two different purposes? Is it possible for an attacker to obtain a certificate from a CA for a public key even though it does not know the corresponding private key? 

Also, is this mode intended to be used for RSA handshakes in TLS 1.2? In that case the proof of private-key possession comes quite late in the handshake. Even for signature-based ciphersuites, I would need to look
closer to be convinced that the ServerKeyExchange (in TLS 1.2) and ServerCertificateVerify (in TLS 1.3) do 
provide sufficient guarantees on which certificate/private key was used to create the signature.

Best,
Karthik

---

From: Martin Thomson <[email-masked]>
Date: Wed, 16 Sep 2015 10:39:17 -0700

> This means that the analysis probably relied on agreement of the certificate hash from the client hello.

This was only in the 1.3 context, and the certificate digest was
completely removed from the handshake...

It was pointed out to me separately that this doesn't work for static
RSA because you need to include the public key in the transcript there
to avoid having an attacker impose a PMS (one of the components of
triple-handshake).  That means that we need a strong hash for that
case.  However, if this is only used for PFS modes, then the analysis
suggests that we are OK to remove or truncate, assuming session-hash.

> For example, is it possible for a website to use the same public key on two certificates for two different purposes? Is it possible for an attacker to obtain a certificate from a CA for a public ke…

Does any of the existing analyses of TLS permit these changes?

If the same key is used for two different purposes, then the risk of
reaching a state where the purposes are confused seems to be too easy.

Similarly, if I can obtain a certificate for a key without
demonstrating proof of possession, then we're in a bad state.  I would
hope that the ACME protocol does not permit that, certainly this is a
fundamental part of the certificate signing request.