Re: [TLS] Fwd: Clarification on interleaving app data and handshake records
Matt Caswell wrote: > > Does anyone have any views on the below? Yup. Interleaving application & handshake records is a highly dangerous idea (and fortunately some TLS implementations will abort if you try). http://www.ietf.org/mail-archive/web/tls/current/msg07648.html http://www.ietf.org/mail-archive/web/tls/current/msg09743.html -Martin > On 30/09/15 11:06, Matt Caswell wrote: > > Hi all > > > > I have a question on how to interpret RFC 5246 with regards to the > > interleaving of app data and handshake records. > > > > RFC 5246 (and RFC 4346 before it) contains these words: > > > >Note: Data of different TLS Record layer content types MAY be > >interleaved. Application data is generally of lower precedence for > >transmission than other content types. However, records MUST be > >delivered to the network in the same order as they are protected by > >the record layer. Recipients MUST receive and process interleaved > >application layer traffic during handshakes subsequent to the first > >one on a connection. > > > > This wording seems to place no limits whatsoever on when it is valid to > > receive app data in the handshake. By the wording in the RFC it would be > > valid for app data to be received *after* the ChangeCipherSpec has been > > received but *before* the Finished has been processed. > > > > There is also this wording: > > > >Note: If a rehandshake occurs while data is flowing on a connection, > >the communicating parties may continue to send data using the old > >CipherSpec. However, once the ChangeCipherSpec has been sent, the > >new CipherSpec MUST be used. The first side to send the > >ChangeCipherSpec does not know that the other side has finished > >computing the new keying material (e.g., if it has to perform a > >time-consuming public key operation). Thus, a small window of time, > >during which the recipient must buffer the data, MAY exist. In > >practice, with modern machines this interval is likely to be fairly > >short. > > > > I think this means that as soon as the first party sends a CCS, they > > must not send any app data until they have received a CCS back - they > > must buffer it until the CCS is seen - but on reading it again I'm not > > sure! If that were the case then the second party should never expect to > > see app data between CCS and Finished. It doesn't tell you anything > > about what the first party can expect though, i.e. is the second party > > allowed to send app data between the CCS and Finished? > > > > Finally there is also this: > > > >A Finished message is always sent immediately after a change > >cipher spec message to verify that the key exchange and > >authentication processes were successful. > > > > I suppose this trumps everything else, although as this section is > > specifically talking about handshakes you could interpret "immediately" > > as applying to the handshake sequence only without saying anything about > > interleaved app data records. > > > > I believe the intention is that app data should not be sent between the > > CCS and Finished but the RFC wording is not exactly crystal clear. This > > is the interpretation I have taken whilst fixing this OpenSSL bug: > > > > https://rt.openssl.org/Ticket/Display.html?id=3712&user=guest&pass=guest > > > > Can some confirm my interpretation is correct? > > > > Thanks > > > > Matt > > > > > > ___ > TLS mailing list > TLS@ietf.org > https://www.ietf.org/mailman/listinfo/tls ___ TLS mailing list TLS@ietf.org https://www.ietf.org/mailman/listinfo/tls
Re: [TLS] Fwd: Clarification on interleaving app data and handshake records
On 14/10/15 16:44, Martin Rex wrote: > Matt Caswell wrote: >> >> Does anyone have any views on the below? > > Yup. Interleaving application & handshake records is a > highly dangerous idea (and fortunately some TLS implementations > will abort if you try). > > http://www.ietf.org/mail-archive/web/tls/current/msg07648.html > > http://www.ietf.org/mail-archive/web/tls/current/msg09743.html > > So is your recommendation that we should ignore the RFC and prevent interleaving at all? The current OpenSSL behaviour is to abort, but this is causing an interoperability problem. Since the RFC is clear that OpenSSL is in the wrong we were seeking to fix it. Matt > -Martin > >> On 30/09/15 11:06, Matt Caswell wrote: >>> Hi all >>> >>> I have a question on how to interpret RFC 5246 with regards to the >>> interleaving of app data and handshake records. >>> >>> RFC 5246 (and RFC 4346 before it) contains these words: >>> >>>Note: Data of different TLS Record layer content types MAY be >>>interleaved. Application data is generally of lower precedence for >>>transmission than other content types. However, records MUST be >>>delivered to the network in the same order as they are protected by >>>the record layer. Recipients MUST receive and process interleaved >>>application layer traffic during handshakes subsequent to the first >>>one on a connection. >>> >>> This wording seems to place no limits whatsoever on when it is valid to >>> receive app data in the handshake. By the wording in the RFC it would be >>> valid for app data to be received *after* the ChangeCipherSpec has been >>> received but *before* the Finished has been processed. >>> >>> There is also this wording: >>> >>>Note: If a rehandshake occurs while data is flowing on a connection, >>>the communicating parties may continue to send data using the old >>>CipherSpec. However, once the ChangeCipherSpec has been sent, the >>>new CipherSpec MUST be used. The first side to send the >>>ChangeCipherSpec does not know that the other side has finished >>>computing the new keying material (e.g., if it has to perform a >>>time-consuming public key operation). Thus, a small window of time, >>>during which the recipient must buffer the data, MAY exist. In >>>practice, with modern machines this interval is likely to be fairly >>>short. >>> >>> I think this means that as soon as the first party sends a CCS, they >>> must not send any app data until they have received a CCS back - they >>> must buffer it until the CCS is seen - but on reading it again I'm not >>> sure! If that were the case then the second party should never expect to >>> see app data between CCS and Finished. It doesn't tell you anything >>> about what the first party can expect though, i.e. is the second party >>> allowed to send app data between the CCS and Finished? >>> >>> Finally there is also this: >>> >>>A Finished message is always sent immediately after a change >>>cipher spec message to verify that the key exchange and >>>authentication processes were successful. >>> >>> I suppose this trumps everything else, although as this section is >>> specifically talking about handshakes you could interpret "immediately" >>> as applying to the handshake sequence only without saying anything about >>> interleaved app data records. >>> >>> I believe the intention is that app data should not be sent between the >>> CCS and Finished but the RFC wording is not exactly crystal clear. This >>> is the interpretation I have taken whilst fixing this OpenSSL bug: >>> >>> https://rt.openssl.org/Ticket/Display.html?id=3712&user=guest&pass=guest >>> >>> Can some confirm my interpretation is correct? >>> >>> Thanks >>> >>> Matt >>> >>> >> >> ___ >> TLS mailing list >> TLS@ietf.org >> https://www.ietf.org/mailman/listinfo/tls ___ TLS mailing list TLS@ietf.org https://www.ietf.org/mailman/listinfo/tls
Re: [TLS] Fwd: Clarification on interleaving app data and handshake records
On Wed, Oct 14, 2015 at 4:05 PM Matt Caswell wrote: > On 14/10/15 16:44, Martin Rex wrote: > > Matt Caswell wrote: > >> > >> Does anyone have any views on the below? > > > > Yup. Interleaving application & handshake records is a > > highly dangerous idea (and fortunately some TLS implementations > > will abort if you try). > > > > http://www.ietf.org/mail-archive/web/tls/current/msg07648.html > > > > http://www.ietf.org/mail-archive/web/tls/current/msg09743.html > > > > > > So is your recommendation that we should ignore the RFC and prevent > interleaving at all? The current OpenSSL behaviour is to abort, but this > is causing an interoperability problem. Since the RFC is clear that > OpenSSL is in the wrong we were seeking to fix it. > BoringSSL doesn't allow application/handshake interleave under any circumstances and further requires that renegotiate be server-initiated and at a quiescent point in the application protocol. That is, a point where the client is done writing and will not write more until receiving more data from the server, like between an HTTP/1.1 request and response. This avoids a ton of complexity and state-space explosion. (OpenSSL's in_read_app_data = 2 and the interaction with in_handshake are terrifying.) It's meant to be the bare minimum needed to support the legacy renego/client-auth mistake for unpipelined HTTP/1.1 as a client and nothing more. It's been shipping in Chrome for a while now and I've never had a report of breakage. But I also don't have to deal with the particular interop situation you came across, so this approach may not work as well for OpenSSL. If you really absolutely must support interleave and can't avoid it, I think it being allowed everywhere except between CCS and Finished is probably the closest you can get to coherent semantics. "Coherent" here is, of course, all relative since renego is involved. David Matt > > > > -Martin > > > >> On 30/09/15 11:06, Matt Caswell wrote: > >>> Hi all > >>> > >>> I have a question on how to interpret RFC 5246 with regards to the > >>> interleaving of app data and handshake records. > >>> > >>> RFC 5246 (and RFC 4346 before it) contains these words: > >>> > >>>Note: Data of different TLS Record layer content types MAY be > >>>interleaved. Application data is generally of lower precedence for > >>>transmission than other content types. However, records MUST be > >>>delivered to the network in the same order as they are protected by > >>>the record layer. Recipients MUST receive and process interleaved > >>>application layer traffic during handshakes subsequent to the first > >>>one on a connection. > >>> > >>> This wording seems to place no limits whatsoever on when it is valid to > >>> receive app data in the handshake. By the wording in the RFC it would > be > >>> valid for app data to be received *after* the ChangeCipherSpec has been > >>> received but *before* the Finished has been processed. > >>> > >>> There is also this wording: > >>> > >>>Note: If a rehandshake occurs while data is flowing on a connection, > >>>the communicating parties may continue to send data using the old > >>>CipherSpec. However, once the ChangeCipherSpec has been sent, the > >>>new CipherSpec MUST be used. The first side to send the > >>>ChangeCipherSpec does not know that the other side has finished > >>>computing the new keying material (e.g., if it has to perform a > >>>time-consuming public key operation). Thus, a small window of time, > >>>during which the recipient must buffer the data, MAY exist. In > >>>practice, with modern machines this interval is likely to be fairly > >>>short. > >>> > >>> I think this means that as soon as the first party sends a CCS, they > >>> must not send any app data until they have received a CCS back - they > >>> must buffer it until the CCS is seen - but on reading it again I'm not > >>> sure! If that were the case then the second party should never expect > to > >>> see app data between CCS and Finished. It doesn't tell you anything > >>> about what the first party can expect though, i.e. is the second party > >>> allowed to send app data between the CCS and Finished? > >>> > >>> Finally there is also this: > >>> > >>>A Finished message is always sent immediately after a change > >>>cipher spec message to verify that the key exchange and > >>>authentication processes were successful. > >>> > >>> I suppose this trumps everything else, although as this section is > >>> specifically talking about handshakes you could interpret "immediately" > >>> as applying to the handshake sequence only without saying anything > about > >>> interleaved app data records. > >>> > >>> I believe the intention is that app data should not be sent between the > >>> CCS and Finished but the RFC wording is not exactly crystal clear. This > >>> is the interpretation I have taken whilst fixing this OpenSSL bug: > >>> > >>> > https://rt.op
[TLS] PR #290: Removing certificate_types and adding certificate_extensions
As discussed at the Interim, I've submitted a separate PR for TLS 1.3 CertificateRequest changes: https://github.com/tlswg/tls13-spec/pull/290 PR #290 includes the following changes: 1. Removes certificate_types, which are no longer needed. 2. Adds client cert selection by certificate extension values. This helps make CertificateRequest more specific and reduce the need for the confusing "choose a certificate" UI. Suggested text includes specific matching rules for KU and EKU extensions (these are most commonly asked for by the customers). Please review, Cheers, Andrei ___ TLS mailing list TLS@ietf.org https://www.ietf.org/mailman/listinfo/tls
Re: [TLS] Fwd: Clarification on interleaving app data and handshake records
On Wed, Oct 14, 2015 at 4:42 PM Martin Thomson wrote: > On 14 October 2015 at 13:29, David Benjamin wrote: > > If you really absolutely must support interleave and can't avoid it, I > think > > it being allowed everywhere except between CCS and Finished is probably > the > > closest you can get to coherent semantics. "Coherent" here is, of course, > > all relative since renego is involved. > > I think that it needs to be more than that. I would say: > > 1. You should not interleave data with handshake messages from the same > flight. > 2. You should not report any change to handshake status until the > renegotiation is complete. That means no callbacks/events about new > peer certificates, or anything of that nature until you have received > and validated the Finished. You would have to exercise caution here > for the callbacks that are necessary during the process, like the > "please choose a certificate and private key to use" callback on > either side. > > If you can somehow manage to do all of that, then you might be able > get away with not halting progress entirely. Because - as far as the > application is concerned - application data is sent as though it were > before the renegotiation. In essence, you are keeping the application > ignorant of any changes until the whole process is over. > Indeed. This is, IMO, one of the core reasons renegotiation was a horrible mistake and one we should make sure never to repeat in the future. :-) I didn't mention it since it's more an API concern than what's over the wire, but that certainly doesn't make it any less a problem! What renego even means for the application data is extremely weird. A lot of TLS APIs and implementations I've seen don't do a very good job of scoping their private state or even public APIs properly, so it's very unclear what, say, querying the peer certificate even means at various points mid-renego. (Mid-initial-handshake is weird too, but most consumers are sensible enough not to query such stuff while some abstract "connect" operation is still going on.) This is especially problematic because handling renegotiations transparently seems a fairly popular implementation strategy. (Both NSS and OpenSSL do this. OpenSSL even allows them by default and doesn't have a good way to turn them off. Not sure about NSS. BoringSSL makes it opt-in.) Above all, by far the best way to handle renegotiation is "never do it, period". I think it's most important that any attempt to hammer down semantics in the "we already got it wrong" cases should be clear on this. New protocols should implicitly forbid renego, implementations should turn it off by default, and that at least gives a bounded body of existing mistakes to consider. David > I've heard it recommended that you add other stipulations, such as > > 3. The server cannot change certificate. > > I'm ambivalent on that because I don't believe it to materially change > the security properties (assuming that we have a good handshake, i.e., > at least R-I and session hash). I don't have proof of that, of > course. > ___ TLS mailing list TLS@ietf.org https://www.ietf.org/mailman/listinfo/tls
Re: [TLS] Fwd: Clarification on interleaving app data and handshake records
On 14/10/15 21:42, Martin Thomson wrote: > On 14 October 2015 at 13:29, David Benjamin wrote: >> If you really absolutely must support interleave and can't avoid it, I think >> it being allowed everywhere except between CCS and Finished is probably the >> closest you can get to coherent semantics. "Coherent" here is, of course, >> all relative since renego is involved. > > I think that it needs to be more than that. I would say: > > 1. You should not interleave data with handshake messages from the same > flight. > 2. You should not report any change to handshake status until the > renegotiation is complete. That means no callbacks/events about new > peer certificates, or anything of that nature until you have received > and validated the Finished. You would have to exercise caution here > for the callbacks that are necessary during the process, like the > "please choose a certificate and private key to use" callback on > either side. > > If you can somehow manage to do all of that, then you might be able > get away with not halting progress entirely. Because - as far as the > application is concerned - application data is sent as though it were > before the renegotiation. In essence, you are keeping the application > ignorant of any changes until the whole process is over. > > I've heard it recommended that you add other stipulations, such as That would be very challenging to implement. Almost certainly not possible for the stable released versions. I would hesitate to do so for the new development version too without explicit published advice in the form of an RFC/errata...it would add significant complexity. It seems my options in reality are: 1) Allow interleaved data everywhere except between CCS and Finished, as per the (hopelessly unclear) RFC. This would leave us conformant, would solve our interoperability problems, but is a "highly dangerous idea" according to your advice. or 2) Leave things as they are now where we abort on interleaved application data. This would leave us unconformant and with an interoperability problem which is causing real issues for users (who will point the finger at us for failing to fix it). "Rock" meet "hard place". :-( Matt ___ TLS mailing list TLS@ietf.org https://www.ietf.org/mailman/listinfo/tls