A fresh look at TLS1.3

It is one of these days that we decided to read the entire TLS 1.3 draft to get up to speed with all the new developments. We were surprised by the evolution of the protocol, sometimes good, sometimes bad.

In this blog post, we attempt to provide several perspectives on the protocol: the view of an implementer, a user of a TLS library and a cryptographic protocol designer.

Designing cryptographic protocols is always about making choices in the area of security, end-user privacy, implementability, efficiency,… In terms of security and privacy we are heavily inclined towards a strict approach: strict rules for client/server behavior and a strict selection of cryptographic algorithms. Implementability is not simply that fact that you can/could implement something that adheres to the standard, but rather that it should be “easy” to do so, with little or no margin for interpretation and errors. The moment an implementer has to start filling up unspecified behavior, or even start looking in multiple places to piece the correct behavior together, the standard has lost its value.

Backward compatibility is deliberately not one of our goals, as we rather prefer upgradeability of a protocol. It prevents cluttering future versions of a protocol with obsolete (often broken) features and allows for a more strict management of security in the protocol versions. It also sends a clear message to developers and users that the latest version should effectively be considered the best, and that using older versions (which may be justified for several reasons) comes at a risk. The user of the library should not be given a false sense of security (TLS 1.3 should be better than TLS 1.2).

The good

TLS1.3 features quite a number of drastic improvements over previous versions. The choice to only support AEAD ciphers instead of combinations of encrypt and MAC removes one of the main causes of security issues. We also liked switching monolithic ciphersuites for cross-product ciphers, which effectively separates the choice of the AEAD cipher, the key agreement and the signature algorithm. One of the major downsides of this choice is that many more algorithms might creep into the standard. The overall design of the handshake is coming very close to the pattern followed by the SIGMA protocol(s), which we can only applaud.

The bad

End-users have an expectation of privacy, advertising companies are already tracking people on the internet through cookies and all sorts of browser fingerprinting. Using TLS should be privacy-enhancing and not become an additional vector for browser fingerprinting, i.e. the TLS handshake should reveal as little as possible to the unauthenticated server. The current choice for a ClientHello is extremely vulnerable to fingerprinting by third parties. The client essentially reveals a combination of ciphers, groups for (EC)DHE and signature algorithms. Potentially worse, it also sends over the identities of pre-shared keys that the client has, allowing unique identification of the client. A better alternative would be to limit the first client message to indicating only the support of TLS1.3 and letting the server reply with a (versioned/timestamped and signed) list of the suites it supports. To avoid extra round trips this result can be cached, in combination with an opportunistic selection of a cipher by the client. As an additional advantage, retries can be removed from the protocol.

Along with the introduction of AEAD, a wide variety of keys derived using a chain of HKDF invocations was introduced in the protocol. We have serious doubts about the necessity of that many distinct keys, which might have some advantages in cryptographic proofs, but no security effects in practice compared to using distinct message headers. We thus strongly favor proper message headers (with checks) over complex key management. This will also drastically simplify the state machine.

Even when limiting 0-RTT early data to session resumption or PSK setups, serious issues remain with state management and replay attacks. The ‘obfuscation’ being applied to the ticket age included in the Early Data Indication reads more like a bad joke about crypto rather than an actual security measure. Using timing as the only way to rule out replay is an approach that is very vulnerable to attacks and also violates common design principles on reusage of keys and IVs. Instead, the only correct way in which a server should handle 0-RTT early data is to immediately invalidate the associated key/ticket. This is however incompatible with using encrypted tickets without server-side storage. Underneath the introduction of 0-RTT there also seems to be an implicit assumption that multiple, clustered servers will be able to handle incoming 0-RTT early data, which would complicate invalidation of keys/tickets even more. It will also be extremely difficult for a user to capture the subtle differences in security offered by regular data transfer and 0-RTT data. We believe this will often result in an improvident choice for 0-RTT. The only sane recommendation at this moment is to completely disable 0-RTT and preferably remove it from the standard.

Update: While it is very clear from the text in the draft that 0-RTT does not provide forward secrecy, it should also be made clear that a handshake with a PSK in psk_ke mode (PSK-only key establishment) does not provide forward secrecy either, as data is encrypted solely under keys that are derived using the offered PSK. Hence we recommend that the psk_ke mode is also removed from the standard.

The ugly

Despite providing extensive and exact information on the format of protocol messages and the composition thereof, the specification is surprisingly vague regarding the behavior and control flow of the client/server. To our surprise there is no state diagram for either client or server, thereby leaving the implementer with only textual information on how the respective parties must/should behave. In an attempt to draw up a state diagram ourselves, we got stuck quite fast due to several reasons. First of all, the state diagram is inexact as the standard specifies obligatory behavior for the client (‘MUST’) which are either optionally (‘MAY’) or never verified by the server. Secondly, there are instances where processing a message has implications on future messages that should be sent/received or on retries of the handshake. Overall the lack of clear and unambiguous flows and state diagrams for client and server is a major downside of the current draft.

Conclusion

Despite many of the changes in TLS1.3, we believe there is still plenty of room for improvement. Apart from some specific security concerns, the standard should be much more strict in terms of backward compatibility, algorithm selection and client/server behavior. A clarification and simplification of the control flow and the state machine of the client and server is also needed to make it easier to implement the standard. Besides the presence of 0-RTT in the current draft, we worry mostly about unneeded complexity being introduced, with no practical security benefits, which will only make the life of an implementer and user difficult.

Thanks to Roel Peeters & Jens Hermans for writing this blog post.