Lecture 4: Improving Secure Connection Establishment
This lecture discusses some of the limitations of TLS v1.3, considering
connection establishment performance, metadata leakage, and protocol
ossification. It then introduces the QUIC transport protocol. QUIC is
a new transport protocol, that tries to improve on the performance of
TLS over TCP while providing additional features.
Part 1: Improving Secure Connection Establishment
The first part of the lecture discusses some limitations of TLS v1.3.
It explains why TLS slows down connection establishment and discusses
the 0-RTT connection re-establishment feature, it's benefits, and its
risks and limitations. It discusses metadata leakage from TLS connections,
both data exposed in the TCP header and the Server Name Indication
(SNI) field in the TLS handshake. And it reviews some of the protocol
ossification issues that have affected TLS development.
00:00:00.000
In this lecture, I want to talk
00:00:03.300
about some ways in which secure connection
00:00:05.600
establishment is being improved in the Internet.
00:00:08.000
I’ll talk about some of the limitations
00:00:10.667
of TLS 1.3 that constrain its security,
00:00:13.333
and that slow down its connection establishment.
00:00:16.000
And I’ll talk about improvements being developed
00:00:18.902
to address these problems. Both to improve
00:00:21.805
TLS 1.3 when used with TCP,
00:00:24.293
and to entirely replace TCP and TLS
00:00:27.195
with a new transport protocol, QUIC,
00:00:29.683
that has faster connection establishment and in-built
00:00:32.585
security.
00:00:35.000
In the first part, I’ll talk about
00:00:37.702
some of the limitations of TLS 1.3
00:00:40.403
and how they’re being addressed.
00:00:42.333
I’ll revisit the problem of slow connection
00:00:45.134
establishment, and describe new issues around metadata
00:00:47.836
leakage and protocol ossification. And I’ll discuss
00:00:50.538
how TLS is being extended to solve
00:00:53.239
these problems.
00:00:54.011
Then, in the following parts of the
00:00:56.813
lecture, I’ll talk about the QUIC transport
00:00:59.514
protocol.
00:01:00.000
QUIC is a new transport protocol,
00:01:02.578
just finishing development in the IETF,
00:01:05.157
that aims to improve on the performance
00:01:08.165
and security of TLS and TCP,
00:01:10.743
and add some new features, while avoiding
00:01:13.751
problems due to protocol ossification.
00:01:17.000
To start with, though, I want to
00:01:19.581
talk about some of the limitations of
00:01:22.162
TLS 1.3.
00:01:24.000
The Transport Layer Security protocol, and TLS
00:01:27.453
1.3 in particular, has been a great
00:01:30.907
success.
00:01:31.500
The protocol has been successfully extended and
00:01:34.588
updated over many years, to keep abreast
00:01:37.676
with security challenges.
00:01:39.000
It’s added new features to meet the
00:01:41.777
needs of new applications, such as datagram
00:01:44.553
TLS for security of video conferencing calls.
00:01:47.330
And it has good performance and is
00:01:50.107
widely used.
00:01:51.000
TLS 1.3 is the most recent version
00:01:54.331
of TLS, and was standardised in 2018.
00:01:57.662
Compared to TLS 1.2, the previous version,
00:02:01.093
it provides some significant security and performance
00:02:04.424
improvements.
00:02:05.000
TLS 1.3 removed support for older and
00:02:07.954
less secure encryption and key exchange algorithms.
00:02:10.908
It removed support for algorithms that are
00:02:13.863
know to be secure if implemented correctly,
00:02:16.817
but that have proven difficult to implement
00:02:19.771
correctly. It improved performance of the handshake,
00:02:22.725
reducing the number of round-trips needed to
00:02:25.680
negotiate security. And it simplified the design
00:02:28.634
of the protocol.
00:02:30.000
Despite this, TLS 1.3 still has some
00:02:33.715
limitations that are difficult to fix.
00:02:37.000
Connection establishment is still relatively slow.
00:02:39.940
Connection establishment leaks potentially sensitive metadata,
00:02:42.980
that can be viewed as a security
00:02:46.410
risk.
00:02:47.000
And the protocol is ossified, due to
00:02:50.500
poor quality implementation and middleboxes, and difficult
00:02:54.000
to extend.
00:02:57.000
The first issue is TLS connection establishment
00:03:00.356
performance.
00:03:01.586
TLS is a security protocol, not a
00:03:05.042
transport protocol, and needs to be run
00:03:08.399
inside an existing transport-layer connection.
00:03:10.796
In practise, this means that TLS usually
00:03:14.253
runs inside a TCP connection.
00:03:16.000
When connecting to a TLS-enabled server,
00:03:18.490
a client must first establish a TCP
00:03:21.395
connection to the server. This proceeds with
00:03:24.300
the usual TCP connection establishment handshake.
00:03:26.790
The client sends a TCP segment with
00:03:29.695
the SYN bit set, indicating the start
00:03:32.600
of the connection. The server responds with
00:03:35.505
a SYN ACK. And the client completes
00:03:38.410
the handshake with an ACK packet.
00:03:41.000
This handshake takes one-and-a-half round trips to
00:03:43.557
complete, with the client being able to
00:03:46.114
send data after the first round trip.
00:03:48.671
That is, the client can send a
00:03:51.229
data packet immediately after it sends the
00:03:53.786
final ACK packet in the handshake,
00:03:55.978
without waiting for a response from the
00:03:58.535
server.
00:03:59.000
When using TLS, this initial TCP data
00:04:02.715
packet contains a TLS ClientHello message.
00:04:06.000
This is the first part of the
00:04:08.725
TLS handshake. It indicates the version of
00:04:11.450
TLS the client supports, and starts the
00:04:14.175
negotiation of the encryption and authentication keys.
00:04:17.000
The TLS server responds with a TLS
00:04:20.252
ServerHello message containing the information needed to
00:04:23.503
establish the secure connection. Then the client
00:04:26.755
responds with a TLS Finished message,
00:04:29.542
confirming the secure connection.
00:04:31.500
It’s only at this point, two full
00:04:33.884
round trip times after starting the connection
00:04:36.269
establishment, that the client can send a
00:04:38.653
secure request to the server, along with
00:04:41.037
the TLS Finished message.
00:04:42.500
And the earliest that a response can
00:04:44.880
be received is one round trip later,
00:04:47.260
a total of three round trips after
00:04:49.640
starting the connection setup.
00:04:54.000
Do these three round trips matter?
00:04:57.000
The table on the right shows some
00:05:00.267
typical round trip times from Glasgow.
00:05:03.067
Three round trips can easily be somewhere
00:05:06.333
in the 250 to 500 millisecond range.
00:05:09.600
Measurements show that an average web page
00:05:12.967
fetches about 1.7 megabytes of data,
00:05:15.767
comprising around 69 HTTP requests, and using
00:05:19.033
around 15 TCP connections.
00:05:21.000
And about 80% of those connections use
00:05:24.413
TLS.
00:05:25.000
Some of the TCP and TLS connections
00:05:27.625
run in parallel, certainly, but not all
00:05:30.250
of them.
00:05:31.000
And most of the time taken to
00:05:33.709
load a typical web page is actually
00:05:36.417
spent waiting for TCP and TLS connection
00:05:39.126
establishment handshakes.
00:05:40.000
If we want to make web pages
00:05:43.150
load faster, reducing the connection establishment time
00:05:46.300
is a very effective way of doing
00:05:49.450
so.
00:05:50.000
Can we speed up the TLS connection
00:05:52.644
establishment handshake?
00:05:53.500
Yes.
00:05:55.000
There are two ways.
00:05:57.000
The first is a technique known as
00:06:01.200
0-RTT connection re-establishment.
00:06:03.000
This lets us save the security parameters
00:06:05.450
the first time we connect to a
00:06:07.900
server, and re-use them in future.
00:06:10.000
It improves performance if we fetch more
00:06:12.450
than one page from the same website.
00:06:15.000
I’ll talk about 0-RTT connection re-establishment in
00:06:19.200
a minute.
00:06:20.500
The second way to improve the connection
00:06:23.332
establishment time, is if we can somehow
00:06:26.165
overlap the TCP and TLS handshakes so
00:06:28.997
they happen in parallel.
00:06:30.615
At present, we open a TCP connection,
00:06:33.548
which takes one round trip before the
00:06:36.380
client can send data, and then negotiate
00:06:39.212
the TLS security parameters, taking another round
00:06:42.045
trip. We could speed up the process
00:06:44.877
by overlapping these two handshakes.
00:06:47.000
For example, we could send the TLS
00:06:49.983
ClientHello message along with the TCP SYN
00:06:52.967
packet, and the TLS ServerHello message could
00:06:55.950
be sent in the SYN-ACK packet.
00:06:58.507
This would let the whole connection establishment
00:07:01.490
handshake, TCP and TLS, complete in one
00:07:04.474
go.
00:07:05.000
Now, doing this with TCP would require
00:07:07.826
widespread operating system changes, and updates to
00:07:10.652
all the firewalls in the world,
00:07:13.074
and so it isn’t likely to happen.
00:07:16.000
But the QUIC transport protocol, that I’ll
00:07:18.579
talk about in later parts of the
00:07:21.158
lecture, does support this optimisation.
00:07:26.000
The 0-RTT connection re-establishment technique builds on
00:07:29.290
the observation that it’s common to connect
00:07:32.580
to a previously known TLS server.
00:07:35.500
We frequently fetch more than one web
00:07:38.252
page from a site. Or visit the
00:07:41.003
same sites every day. Or connect to
00:07:43.755
the same messages, chat, or video conferencing
00:07:46.507
server.
00:07:47.000
Surely it should be possible to shortcut
00:07:49.492
the connection establishment in such cases,
00:07:51.628
and reuse information we exchanged the first
00:07:54.120
time to speed things up?
00:07:56.000
It is, but to do so we
00:07:58.858
need to understand three things.
00:08:01.000
Firstly, what the role of the TLS
00:08:04.015
handshake, and how are the security parameters
00:08:07.031
negotiated?
00:08:08.212
Second, how can we encrypt initial data
00:08:11.327
on re-establishing a secure connection?
00:08:13.481
And, finally, what are the potential risks
00:08:16.596
in short-cutting the key exchange?
00:08:21.000
So, what is the role of the
00:08:24.033
TLS handshake?
00:08:25.000
It does two things.
00:08:27.000
The first is to use public key
00:08:30.069
cryptography to securely establish a session key.
00:08:33.138
That session key is then used to
00:08:36.208
encrypt the data being sent over the
00:08:39.277
TLS connection, using a symmetric encryption algorithm.
00:08:42.346
The ClientHello and ServerHello messages, exchanged in
00:08:45.515
the TLS handshake, are used to derive
00:08:48.585
this session key.
00:08:50.000
In TLS 1.3, this is done using
00:08:54.076
the ephemeral elliptic curve Diffie-Hellman key exchange
00:08:58.153
algorithm – ECDHE.
00:09:00.000
The TLS client and server exchange their
00:09:02.800
public keys in the ClientHello and ServerHello
00:09:05.600
messages, along with a randomly chosen value.
00:09:08.400
The public keys and random values exchanged
00:09:11.200
in the TLS handshake, and the private
00:09:14.000
keys known only to each of the
00:09:16.800
endpoint, are used to derive the session
00:09:19.600
key, using the elliptic curve Diffie-Hellman algorithm.
00:09:22.500
The maths of how this is done
00:09:24.794
is complicated, and I’m not going to
00:09:27.089
try to explain it.
00:09:28.500
The key point, though, is that every
00:09:31.173
TLS connection, even if between the same
00:09:33.845
client and server, generates a unique session
00:09:36.518
key.
00:09:37.000
This provides a property known as forward
00:09:39.876
secrecy. If the encryption key for one
00:09:42.752
TLS connection somehow leaks to the public,
00:09:45.628
then it exposes the data sent over
00:09:48.504
that connection, but it doesn’t help an
00:09:51.380
attacker break the encryption on any other
00:09:54.257
connections between those endpoints.
00:09:56.000
The other role of the TLS handshake
00:09:58.333
is to retrieve the server’s certificate,
00:10:00.333
that will have a digital signature from
00:10:02.667
some Certificate Authority, part of the public
00:10:05.000
key infrastructure, allowing the client to confirm
00:10:07.333
the identity of the server.
00:10:12.000
The ECDHE algorithm requires information from both
00:10:15.085
the ClientHello and the ServerHello messages to
00:10:18.170
derive a session key. It can’t be
00:10:21.256
used until the handshake has completed.
00:10:24.000
This is why TLS usually takes a
00:10:26.868
complete round trip to negotiate the session
00:10:29.737
keys.
00:10:30.896
You can’t start encrypting the data until
00:10:33.865
after the ClientHello and ServerHello messages have
00:10:36.733
been exchanged, since those messages are used
00:10:39.601
to derive the encryption key.
00:10:41.000
0-RTT Connection Reestablishment gets around this by
00:10:44.115
sharing a key in one TLS session,
00:10:47.230
to be used in the next.
00:10:50.000
The first time a particular client makes
00:10:52.862
a connection to a TLS server,
00:10:55.315
the server sends it two additional bits
00:10:58.176
of information along with its ServerHello message.
00:11:01.038
It sends a PreSharedKey and a SessionTicket.
00:11:04.000
The PreSharedKey is an encryption key,
00:11:06.231
that the client can use to encrypt
00:11:08.834
data it sends to the server.
00:11:11.066
And the SessionTicket tells the server which
00:11:13.669
key was given to the client.
00:11:16.000
These are sent over the encrypted TLS
00:11:18.489
connection, so they’re only known to the
00:11:20.978
client and the server.
00:11:22.500
When it later reconnects to the same
00:11:25.361
server, the client can use this information
00:11:28.222
to send encrypted data along with the
00:11:31.083
ClientHello message.
00:11:32.000
In this case, the client establishes a
00:11:34.817
TCP connection to the server. Then,
00:11:37.231
it sends a TLS ClientHello message to
00:11:40.048
the server in the usual way.
00:11:42.462
But, along with this, it also sends
00:11:45.279
the SessionTicket it was previously given,
00:11:47.693
and some data.
00:11:49.000
This data is encrypted using the PreSharedKey
00:11:51.709
that was sent by the server in
00:11:54.417
a previous connection, and goes along with
00:11:57.126
the SessionTicket.
00:11:58.000
On receiving such a message, the server
00:12:00.736
responds with a ServerHello as normal.
00:12:03.082
It also uses the SessionTicket to lookup
00:12:05.818
its copy of the PreSharedKey, and decrypt
00:12:08.555
the data sent from the client.
00:12:11.000
If the server wants to reply to
00:12:13.557
the client, it sends its response along
00:12:16.114
with the ServerHello message. Since the server
00:12:18.671
has received the ClientHello message, and knows
00:12:21.229
what it sent in its ServerHello message,
00:12:23.786
it can derive an ephemeral session key
00:12:26.343
and use it to encrypt the response.
00:12:29.000
Similarly, the client can decrypt that response,
00:12:31.832
since it will follow ServerHello that provides
00:12:34.664
the information needed to complete the key
00:12:37.495
exchange.
00:12:38.000
This handshake is shown on the right
00:12:41.780
of the slide.
00:12:43.500
This process of sending a PreSharedKey in
00:12:46.212
one TLS session, and using it to
00:12:48.925
encrypt the data sent in the initial
00:12:51.637
message of the following session, is known
00:12:54.350
as 0-RTT connection re-establishment.
00:12:56.000
It provides a way for the client
00:12:58.226
to sent encrypted data to the server
00:13:00.451
in the first packet it sends after
00:13:02.677
the TLS connection is opened. That is,
00:13:04.903
it allows data to be sent with
00:13:07.128
no additional round trips.
00:13:08.500
The usual TLS handshake also takes place,
00:13:10.862
with the ClientHello and ServerHello messages used
00:13:13.225
to derive a session key. The PreSharedKey
00:13:15.587
is only used to encrypt the very
00:13:17.950
first message sent from the client to
00:13:20.312
the server on the connection.
00:13:26.000
0-RTT connection re-establishment allows data to be
00:13:29.950
sent immediately, reducing TLS connection establishment latency.
00:13:34.000
But.
00:13:35.710
It introduces two risks.
00:13:39.000
The first is that data sent along
00:13:41.811
with the ClientHello, and encrypted using a
00:13:44.623
PreSharedKey, is not forward secret. The use
00:13:47.434
of a PreSharedKey links two TLS connections
00:13:50.245
together. The key sent is securely over
00:13:53.056
one connection, encrypted using the ephemeral session
00:13:55.868
key of that session, and is used
00:13:58.679
to encrypt the data sent in the
00:14:01.490
first message of the next connection.
00:14:04.000
If, for some reason, the ephemeral session
00:14:06.666
key for the first session is exposed,
00:14:09.332
breaking the encryption of that session,
00:14:11.617
then it can be used to extract
00:14:14.283
the PreSharedKey. This, in turn, breaks the
00:14:16.949
encryption for the data sent in the
00:14:19.615
first message of the next session.
00:14:22.000
The rest of the data sent in
00:14:24.567
the next session is safe, because it’s
00:14:27.133
encrypted using the ephemeral session key for
00:14:29.700
the next session, not the PreSharedKey.
00:14:32.000
Secondly, data sent along with the ClientHello
00:14:35.279
message and encrypted using a PreSharedKey is
00:14:38.558
subject to a reply attack.
00:14:41.000
If an on-path attacker captures and re-sends
00:14:43.682
the TCP segment containing the ClientHello,
00:14:45.980
the SessionTicket, and the data protected with
00:14:48.662
the PreSharedKey, that data will be accepted
00:14:51.343
by the server again, and the server
00:14:54.025
will respond, trying to complete the handshake.
00:14:56.706
This will fail, since the connection has
00:14:59.388
already been established, but by then the
00:15:02.069
data has already been accepted and processed
00:15:04.751
by the server.
00:15:06.000
The TLS record protocol, used once the
00:15:08.632
connection has been established, can protect against
00:15:11.264
such replay attacks, but to do so
00:15:13.896
it uses the information exchanged in the
00:15:16.528
handshake.
00:15:17.654
TLS isn’t able to protect against replay
00:15:20.386
of 0-RTT data sent in the first
00:15:23.018
message from the client to the server.
00:15:25.000
Accordingly, if you use TLS with 0-RTT
00:15:28.274
re-establishment, you should make sure that any
00:15:31.547
data you send in the first message
00:15:34.821
is idempotent. That is, it won’t do
00:15:38.094
any harm if it’s received twice.
00:15:41.000
Because of these two limitations, it’s important
00:15:43.800
to be careful when using 0-RTT data
00:15:46.600
in TLS. The 0-RTT connection re-establishment mode
00:15:49.400
can improve performance, but has to be
00:15:52.200
used with care to avoid replay attacks.
00:16:00.000
The use of 0-RTT connection re-establishment can
00:16:03.450
improve connection setup times, if used carefully.
00:16:07.000
There are a couple of other limitations
00:16:09.581
of TLS that you should be aware
00:16:12.162
of, though.
00:16:13.000
The first is that TLS runs over
00:16:16.279
a TCP/IP connection, and the TCP and
00:16:19.558
IP headers are not encrypted.
00:16:22.000
This exposes certain information to anyone eavesdropping
00:16:25.430
on the connection.
00:16:27.000
An eavesdropper can observe the IP addresses
00:16:29.683
between which the packets are sent,
00:16:31.983
and the TCP port numbers.
00:16:34.000
The TCP port numbers tell you what
00:16:36.819
service is being used. For example,
00:16:39.235
they expose whether the TLS connection is
00:16:42.054
made to a web server, an email
00:16:44.873
server, a video conferencing server, a messaging
00:16:47.692
server, or whatever.
00:16:49.000
And the IP addresses often tell you
00:16:51.858
what site is being accessed.
00:16:54.000
Small sites tend to use shared hosting,
00:16:56.731
where many websites run on a shared
00:16:59.463
server with a single IP address,
00:17:01.804
but popular sites need dedicated machines to
00:17:04.535
host them, and so have their own
00:17:07.267
IP addresses. An eavesdropper can often use
00:17:09.998
the IP addresses to identify what site
00:17:12.729
is being accessed.
00:17:14.000
Maybe that doesn’t matter.
00:17:17.000
Knowing that a particular user has connected
00:17:18.989
to an IP address owned by Google
00:17:20.979
maybe doesn’t tell you much.
00:17:22.500
But knowing that they connected to an
00:17:25.300
IP address that hosts a website giving
00:17:28.100
information about a particular disease, or for
00:17:30.900
a particular political party, or for a
00:17:33.700
particular niche social network, might expose more
00:17:36.500
information about the user, even without knowing
00:17:39.300
what they said or being able to
00:17:42.100
access the data sent over that connection.
00:17:45.000
The TCP header also sends sequence numbers
00:17:48.204
unencrypted. This exposes how much information was
00:17:51.408
sent over the connection, and how fast
00:17:54.612
the data is being downloaded.
00:17:57.000
This information is often less sensitive than
00:17:59.841
the IP addresses and TCP port numbers,
00:18:02.682
but not always.
00:18:04.000
For example, it’s been shown to be
00:18:06.489
possible to identify what movie someone is
00:18:08.978
watching, on a site like Netflix,
00:18:11.111
just by looking at the pattern of
00:18:13.600
download rates for each scene, even if
00:18:16.089
the data is encrypted. The TCP sequence
00:18:18.578
numbers expose this information.
00:18:22.000
A bigger risk with TLS is that,
00:18:25.468
when used with HTTPS, the TLS ClientHello
00:18:28.936
message will include the Server Name Indication
00:18:32.405
extension.
00:18:33.000
The server name indication provides the name
00:18:35.455
of the site being requested, so the
00:18:37.911
server knows what public key to include
00:18:40.366
in its ServerHello message.
00:18:41.769
It’s needed to support shared hosting,
00:18:43.974
where many websites are hosted on a
00:18:46.429
single web server with a single IP
00:18:48.885
address, where the server can’t tell what
00:18:51.340
site is being requested based on the
00:18:53.795
address to which the client connects.
00:18:56.000
Since the client can’t know how many
00:18:58.148
sites are hosted on each server,
00:18:59.990
it has to always send the server
00:19:02.138
name information field to indicate what server
00:19:04.286
it wants.
00:19:05.000
And worse, the server name indication field
00:19:08.008
has to be unencrypted. This is because
00:19:11.016
it’s sent in the first packet,
00:19:13.595
before the session key has been negotiated,
00:19:16.603
because it’s used to determine what server
00:19:19.611
generates the ServerHello.
00:19:21.000
Similarly, the server name indication can’t be
00:19:23.772
protected by a PreSharedKey, since that’s provided
00:19:26.544
by the server, and the goal is
00:19:29.316
to select the server.
00:19:31.000
The server name information is a privacy
00:19:33.912
risk. It exposes the name of the
00:19:36.824
server to which you’re connecting to anyone
00:19:39.736
eavesdropping on the path.
00:19:41.500
Is it a significant risk?
00:19:43.443
Well, that’s not clear. As we saw
00:19:46.263
on the previous slide, the IP address
00:19:48.983
of the site is always exposed,
00:19:51.314
and that’s often enough to identify the
00:19:54.034
site you’re accessing, whether or not the
00:19:56.754
site name is exposed.
00:19:58.309
Fundamentally, TLS runs over the Internet.
00:20:00.740
And the Internet always exposes the IP
00:20:03.460
addresses in the packets, making it possible
00:20:06.180
to tell who is accessing what site.
00:20:09.000
If you care about this problem,
00:20:11.000
you need to use an application like
00:20:13.333
The Onion Router, Tor, to protect your
00:20:15.667
connections.
00:20:20.000
The final issue I want to highlight
00:20:22.908
with TLS, is that of protocol ossification.
00:20:25.815
TLS is very widely implemented, but there
00:20:28.823
are many poor quality implementations.
00:20:31.000
As an example, the TLS ClientHello indicates
00:20:33.724
the version of TLS used by the
00:20:36.448
client. The server is supposed to look
00:20:39.172
at this, and look at the different
00:20:41.896
versions of TLS that it supports,
00:20:44.230
and send a ServerHello in response indicating
00:20:46.954
the most recent compatible version.
00:20:49.000
If the ClientHello indicates support for TLS
00:20:52.028
1.3, for example, but the server only
00:20:55.057
supports TLS 1.2, the server is supposed
00:20:58.085
to respond with a ServerHello saying it
00:21:01.113
supports TLS 1.2. The client will then
00:21:04.141
decide if this is sufficient, and if
00:21:07.170
it wants to communicate.
00:21:09.000
During the development of TLS 1.3,
00:21:11.593
though, it was noticed that some TLS
00:21:14.618
servers would crash if the ClientHello message
00:21:17.643
used a version number different to TLS
00:21:20.668
1.2.
00:21:21.200
Similarly, some firewalls were found that inspected
00:21:24.761
TLS ClientHello messages, and blocked the connection
00:21:28.322
if a version other than TLS 1.2
00:21:31.883
was used.
00:21:33.000
When early versions of TLS 1.3 were
00:21:36.286
deployed, using version number 1.3 in their
00:21:39.572
ClientHello messages, measurements showed that these problems
00:21:42.858
affected around 8% of TLS servers,
00:21:45.675
and prevented TLS 1.3 from working in
00:21:48.961
those cases.
00:21:50.000
That is, around 8% of sites were
00:21:52.600
running buggy implementations of TLS, or had
00:21:55.200
buggy firewalls, that didn’t correctly implement TLS
00:21:57.800
version negotiation, and so would fail if
00:22:00.400
a newer version of TLS was used.
00:22:06.000
The designers of TLS decided that having
00:22:08.878
8% of connections fail when using TLS
00:22:11.756
1.3 was too much.
00:22:13.500
So they changed the design.
00:22:17.000
TLS 1.3 now pretends to be TLS
00:22:20.189
1.2 in the version number in its
00:22:23.378
ClientHello and ServerHello messages. But, it also
00:22:26.567
sends an extra extension header in those
00:22:29.756
messages, to say “Actually, I’m really TLS
00:22:32.944
1.3”.
00:22:33.500
Experience and testing showed that older TLS
00:22:36.300
servers, that only support TLS 1.2,
00:22:38.700
are more likely to ignore this extra
00:22:41.500
extension header, than they are to correctly
00:22:44.300
respond to a change in the version
00:22:47.100
number field.
00:22:48.000
That is, when a TLS 1.3 client
00:22:51.227
talks to TLS 1.2 server, the TLS
00:22:54.454
1.2 server is likely to ignore the
00:22:57.680
extension header and see only the version
00:23:00.907
number in the ClientHello. It will respond
00:23:04.134
to this, and negotiate TLS 1.2.
00:23:07.000
But, when a TLS 1.3 client talks
00:23:10.018
to a TLS 1.3 server, the TLS
00:23:13.035
1.3 server will see the extension,
00:23:15.622
and know it should ignore the version
00:23:18.639
number field that says TLS 1.2,
00:23:21.226
and instead go with the version signalled
00:23:24.243
in the header. It will then respond
00:23:27.261
with a ServerHello, which also says TLS
00:23:30.278
1.2 in the version field, but that
00:23:33.296
has an extension header included to indicate
00:23:36.314
that it’s really using TLS 1.3.
00:23:39.000
This is horrible.
00:23:41.000
It’s a kludge written into the TLS
00:23:43.832
standard, because experience showed that there were
00:23:46.664
too many broken implementations of TLS out
00:23:49.495
there.
00:23:50.000
The built-in version negotiation feature of TLS
00:23:52.950
turned out to be unusable in practice.
00:23:56.000
There were millions of deployed TLS servers
00:23:59.033
where trying to negotiate a TLS version
00:24:02.067
different to TLS 1.2 would cause the
00:24:05.100
server to crash.
00:24:06.500
Upgrading them all was infeasible.
00:24:08.966
The only workaround was to change the
00:24:12.517
way the protocol negotiated what version to
00:24:15.969
use, while leaving the older version there
00:24:19.421
for backwards compatibility.
00:24:21.000
Protocol ossification is a significant concern.
00:24:25.000
And the problem does not only occur
00:24:28.979
with TLS.
00:24:30.116
Widely deployed faulty implementations constrain the design
00:24:34.195
of most protocols.
00:24:36.000
One of the biggest challenges in networked
00:24:38.935
systems is being able to change the
00:24:41.871
protocol without breaking previously deployed implementations.
00:24:44.387
Even if those implementations are buggy and
00:24:47.323
broken in different ways.
00:24:51.000
How do we avoid protocol ossification?
00:24:56.000
Well, ossification occurs when extension mechanisms in
00:24:59.355
the protocol are not used. When the
00:25:02.710
protocol allows flexibility in principle, but the
00:25:06.066
implementations of the protocol don’t use that
00:25:09.421
flexibility.
00:25:10.000
For example, TLS 1.3 was released ten
00:25:14.709
years after TLS 1.2.
00:25:17.500
There was a period of ten years
00:25:20.491
when TLS was is use, and getting
00:25:23.482
increasingly popular, where only TLS 1.2 was
00:25:26.473
used.
00:25:27.000
This allowed people to build implementations of
00:25:29.822
TLS that didn’t do version negotiation correctly,
00:25:32.644
because they didn’t need to. There were
00:25:35.466
no new versions to negotiate, so no-one
00:25:38.288
properly tested that feature.
00:25:40.000
The same happened with other features of
00:25:43.412
TLS.
00:25:44.000
And the same happens with other protocols.
00:25:48.000
This hints at the solution to ossification.
00:25:51.000
Protocols ossify if they have features or
00:25:54.259
extension mechanisms that aren’t used. The implementations
00:25:57.519
of those features, those extension mechanisms,
00:26:00.313
aren’t properly tested, so buggy code gets
00:26:03.572
deployed, and constrains future changes.
00:26:06.000
So, why not use those features? Why
00:26:09.442
not use those extension mechanisms?
00:26:12.000
The idea is called GREASE. Generate Random
00:26:16.709
Extensions and Sustain Extensibility.
00:26:19.500
If the protocol allows extensions, send extensions.
00:26:22.393
Send meaningless dummy extensions that get ignored
00:26:25.287
if you have nothing else to send,
00:26:28.180
but make sure your protocol uses its
00:26:31.073
extension mechanisms.
00:26:32.000
If the protocol allows different versions,
00:26:34.495
negotiate different versions. Change the version number
00:26:37.405
occasionally, just to prove you can.
00:26:40.000
Do this even if you don’t need
00:26:43.412
to.
00:26:44.000
That is “use it or lose it”.
00:26:46.561
Assume that any features of your system
00:26:49.221
that aren’t regularly used won’t get properly
00:26:51.782
tested, and won’t be usable in practice,
00:26:54.342
so make sure that all the features
00:26:56.903
get regularly used.
00:27:01.000
This concludes our discussion of TLS 1.3.
00:27:03.937
We’ve focussed on the limitations of TLS
00:27:06.974
in this part but, to be clear,
00:27:09.911
TLS 1.3 is a highly effective and
00:27:12.848
highly secure protocol. It’s a significant improvement
00:27:15.785
on prior versions of TLS. It’s faster
00:27:18.722
and it’s more secure.
00:27:20.500
But, TLS runs within a TCP connection
00:27:23.444
and must wait for that TCP connection
00:27:26.387
to be established, and this slows down
00:27:29.331
the handshake. And, because it runs in
00:27:32.274
TCP, some metadata is leaked that can
00:27:35.218
expose potentially sensitive information.
00:27:37.000
In the next parts, I’ll talk about
00:27:39.832
QUIC, a new transport and security protocol
00:27:42.664
that aims to address these limitations of
00:27:45.495
TLS.
Part 2: QUIC Transport Protocol (1/3)
The second part of the lecture introduces the QUIC transport protocol.
QUIC is a new transport protocol, designed to replace and improve on
the combination of TCP and TLS. It reviews the history and development
of QUIC, and outlines the features and benefits it provides. A
high-level outline of the operation of a QUIC connection is provided.
00:00:00.000
In this second part, I want to
00:00:03.665
move on from talking about the limitations
00:00:06.331
of TLS and TCP, and talk instead
00:00:08.996
about the QUIC transport protocol.
00:00:11.000
QUIC is an attempt to replace,
00:00:13.600
and improve on, TCP. It incorporates TLS
00:00:16.633
and various other useful extensions.
00:00:18.800
In this part I’ll talk about the
00:00:21.933
development of QUIC, and its basic features.
00:00:24.967
Then, in the following parts, I’ll explain
00:00:28.000
how QUIC establishes connections, transfers data,
00:00:30.600
and avoids ossification.
00:00:33.000
As we saw in the previous part
00:00:36.150
of this lecture, there are three main
00:00:39.300
limitations of TLS 1.3 when running over
00:00:42.450
TCP.
00:00:43.000
It’s slow to establish a secure connection,
00:00:45.665
because the TCP connection establishment handshake and
00:00:48.331
the TLS security parameter negotiation proceed in
00:00:50.996
series, one after the other.
00:00:53.000
It leaks some metadata about the connection.
00:00:56.430
And both TLS and TCP are ossified,
00:00:59.960
and have become difficult to extend.
00:01:03.000
QUIC tries to solve these problems.
00:01:05.961
It’s a single protocol, that provided both
00:01:09.516
transport and security features. It reduces connection
00:01:12.971
establishment latency by overlapping the connection setup
00:01:16.426
and encryption key negotiation.
00:01:18.500
It tries to avoid metadata leakage by
00:01:21.187
use of pervasive encryption.
00:01:22.723
And it tries to prevent ossification by
00:01:25.510
systematic application of GREASE, and through encryption
00:01:28.197
of more of the transport headers.
00:01:33.000
QUIC is a new protocol.
00:01:36.000
Development started in 2012, as a project
00:01:38.971
inside Google to improve the security and
00:01:41.941
performance of the web. One of the
00:01:44.912
outcomes of that project was SPDY,
00:01:47.459
which was adopted by the IETF and
00:01:50.429
eventually become HTTP/2. The other was QUIC.
00:01:53.500
Google transferred control of the QUIC protocol
00:01:55.794
to the IETF in 2016, and the
00:01:58.087
IETF formed a working group to standardise
00:02:00.381
and develop the protocol. The links on
00:02:02.674
the slide point to the working group
00:02:04.968
materials, if you’re interested in the details
00:02:07.262
of how this was done.
00:02:09.000
As of January 2021, the QUIC specifications
00:02:11.830
have gone through 34 different versions in
00:02:14.661
the IETF. The websites linked have all
00:02:17.491
34 versions, so you can see how
00:02:20.322
the protocol has changed as it developed.
00:02:23.152
And, if you follow the links and
00:02:25.983
find the GitHub repo where the specification
00:02:28.813
was written, you’ll see that it’s a
00:02:31.643
highly active project, with around 2200 issues
00:02:34.474
and 2500 pull requests to date.
00:02:37.000
The final result is clearly inspired by
00:02:39.914
Google’s initial proposal, but it’s been significantly
00:02:42.828
changed as a result of the IETF
00:02:45.742
process, and is now a much better
00:02:48.656
protocol. It’s more extensible, more secure,
00:02:51.153
and a provides a cleaner basis for
00:02:54.067
further development.
00:02:55.000
As of the end of January 2021,
00:02:58.000
draft 34 of the QUIC specification has
00:03:01.000
completed its development in the IETF working
00:03:04.000
group, and is undergoing final review by
00:03:07.000
the Internet Engineering Steering Group, the IESG.
00:03:10.000
It’s likely that it will be approved
00:03:12.250
for publication during the IESG meeting on
00:03:14.500
4th February, and the standard should be
00:03:16.750
published as an RFC around Easter 2021.
00:03:21.000
So, what is QUIC?
00:03:22.600
The figure on the slide shows how
00:03:25.500
QUIC relates to the other layers of
00:03:28.300
the Internet protocol stack.
00:03:30.000
QUIC performs most of the functions of
00:03:33.892
TCP, completely subsumes TLS, and adds some
00:03:37.784
features from HTTP. Essentially, it’s trying to
00:03:41.676
replace TCP and TLS.
00:03:44.000
QUIC runs on UDP.
00:03:45.781
That is, QUIC packets are sent as
00:03:48.997
the payload within UDP packets, rather than
00:03:52.113
running directly on IP. This was done
00:03:55.229
for ease of development and deployment.
00:03:58.000
On top of that, QUIC provides reliability,
00:04:01.832
ordering, and congestion control. These are the
00:04:05.663
features usually provided by TCP.
00:04:08.500
It also incorporates TLS security, and provides
00:04:12.200
the same security guarantees as TLS 1.3.
00:04:16.000
And, finally, it adds the idea of
00:04:18.819
stream multiplexing from HTTP/2. That is,
00:04:21.235
where a TCP connection delivers a single
00:04:24.054
stream of data, QUIC allows multiple different
00:04:26.873
streams of data to be sent over
00:04:29.692
a single connection.
00:04:31.000
The result is a general purpose,
00:04:34.560
reliable, congestion controlled, and secure, client server
00:04:38.713
transport protocol.
00:04:40.000
QUIC is intended to be useful for
00:04:43.052
any application that currently uses TCP,
00:04:45.668
and aims to provide a better,
00:04:48.284
and more secure, replacement for TCP.
00:04:51.000
It was also designed to run HTTP
00:04:53.579
effectively, and to improve web applications.
00:04:55.789
In parallel with the development of QUIC,
00:04:58.368
the IETF is also developing HTTP version
00:05:00.947
3, which is the version of HTTP
00:05:03.526
that runs on QUIC.
00:05:08.000
One of the key benefits of QUIC
00:05:10.841
is that it overlaps the connection establishment
00:05:13.682
and security handshakes.
00:05:15.000
On the left, we see the process
00:05:17.882
by which a TLS connection is established
00:05:20.765
running over TCP.
00:05:22.000
As we saw in the previous part
00:05:24.800
of the lecture, it proceeds in two
00:05:27.600
stages.
00:05:28.000
First the TCP connection is established,
00:05:31.200
with a SYN, SYN-ACK, ACK exchange.
00:05:34.500
Then, TLS takes over to negotiate the
00:05:37.838
security parameters and encryption keys, and to
00:05:41.177
authenticate the server. It exchanges the TLS
00:05:44.515
ClientHello, ServerHello, and Finished messages.
00:05:47.000
And only then can the data be
00:05:51.288
sent.
00:05:52.000
QUIC combines those two stages into one.
00:05:54.763
As we’ll see in the next part
00:05:57.526
of this lecture, QUIC sends the equivalent
00:06:00.289
of the TCP SYN and TLS ClientHello
00:06:03.053
messages in one packet at the start
00:06:05.816
of the connection.
00:06:07.000
This begins connection setup, and starts to
00:06:10.715
negotiate security parameters, in one message.
00:06:14.000
The response contains the equivalent of the
00:06:17.332
TCP SYN-ACK and the TLS ServerHello,
00:06:20.188
combined into one. This establishes the connection
00:06:23.520
and provides the security parameters.
00:06:26.000
Then, the final packet in the handshake
00:06:28.673
sends the equivalents of the TCP ACK
00:06:31.345
and TLS Finished messages, and the initial
00:06:34.018
data.
00:06:34.500
The result is that QUIC saves one
00:06:37.641
round trip compared to the combination of
00:06:40.783
TCP and TLS. It’s normal case establishes
00:06:43.924
a secure connection as fast TCP and
00:06:47.066
TLS can perform 0-RTT session resumption,
00:06:49.759
and without the limitations of session resumption.
00:06:53.000
And QUIC also supports the 0-RTT session
00:06:56.008
resumption mode. This allows the very first
00:06:59.016
packet sent from a client to a
00:07:02.024
previously known server to both establish the
00:07:05.032
connection, negotiate security parameters, and carry an
00:07:08.041
initial request.
00:07:09.000
This lets QUIC achieve the best possible
00:07:11.739
performance: to send a request to a
00:07:14.478
server and get the response one round
00:07:17.217
trip later.
00:07:20.000
QUIC allows applications to send and receive
00:07:22.492
streams of data.
00:07:23.560
Unlike TCP, where each TCP connection allows
00:07:26.152
a single stream of data to be
00:07:28.644
sent and a single stream of data
00:07:31.136
to be received, QUIC allows more than
00:07:33.628
one stream of data to be sent
00:07:36.120
and received on each connection.
00:07:38.000
This lets applications separate out different objects,
00:07:40.709
delivering each on a separate stream within
00:07:43.419
the QUIC connection. For example, when fetching
00:07:46.128
a web page that includes multiple images,
00:07:48.837
QUIC would allow each image to be
00:07:51.546
sent on a separate stream within that
00:07:54.256
connection, rather than requiring a new connection
00:07:56.965
to be opened for each.
00:07:59.000
The data for these connections is sent
00:08:02.430
within QUIC packets.
00:08:04.000
QUIC packets are, in turn, sent within
00:08:08.200
UDP datagrams.
00:08:09.500
Each QUIC packet starts with a header,
00:08:12.125
and contains one or more frames of
00:08:14.750
data. The frames contain data for the
00:08:17.375
individual streams, acknowledgements, or other control messages.
00:08:25.000
QUIC packets can be long header packets
00:08:27.740
or short header packets.
00:08:29.306
At the start of a connection,
00:08:31.754
QUIC sends what are known as long
00:08:34.494
header packets.
00:08:35.277
The format of these is shown on
00:08:38.117
the slide.
00:08:39.000
They start with a common header.
00:08:41.059
This common header begins with single byte,
00:08:43.460
where the first two bits are set
00:08:45.862
to one, to indicate that it’s a
00:08:48.264
long header packet. The next two bits
00:08:50.666
of this byte, labelled TT in the
00:08:53.067
diagram, indicate type of long header packet.
00:08:55.469
And the remaining four bits of this
00:08:57.871
byte are unused.
00:08:59.000
This is followed by a version number,
00:09:02.815
a destination connection identifier, a source connection
00:09:06.630
identifier, and the packet-type specific data.
00:09:10.000
The connection identifiers allow QUIC connections to
00:09:12.666
survive address changes. For example, if a
00:09:15.332
smartphone connected to a home WiFi network
00:09:17.998
establishes a connection to a server,
00:09:20.283
then moves out of range of the
00:09:22.949
WiFi and switches to its 4G connection,
00:09:25.615
then its IP address will change.
00:09:28.000
This change in IP address will cause
00:09:31.442
a TCP connection to fail.
00:09:34.000
The connection identifiers allow a QUIC connection,
00:09:37.640
though, to automatically reconnect to the server
00:09:41.280
and continue where it left off.
00:09:44.500
Following the connection identifiers is packet type
00:09:47.767
specific data. There are four different types
00:09:51.033
of long header packet.
00:09:53.000
An Initial packet is used to initiate
00:09:56.013
a connection and start the TLS handshake.
00:09:59.026
It plays the same role as a
00:10:02.039
TCP SYN packet and a TLS ClientHello.
00:10:05.052
A 0-RTT packet is used to carry
00:10:08.165
the idempotent data sent when 0-RTT session
00:10:11.178
re-establishment is being used.
00:10:13.000
A Handshake packet is used to complete
00:10:15.929
the TLS handshake. Depending on its contents,
00:10:18.858
a Handshake packet is either the equivalent
00:10:21.787
of a TCP SYN-ACK with a TLS
00:10:24.716
ServerHello; or a TCP ACK with a
00:10:27.645
TLS Finished message.
00:10:29.000
And the Retry packet is used to
00:10:31.772
force address validation, as part of connection
00:10:34.544
migration, and to prevent some types of
00:10:37.316
denial of service attack.
00:10:39.000
These different types of QUIC long header
00:10:41.818
packet all contain QUIC frames, and are
00:10:44.637
all sent inside UDP datagrams.
00:10:46.750
To improve efficiency, QUIC allows several Initial,
00:10:49.948
0-RTT, and handshake packets to be included
00:10:53.147
in a single UDP datagram, one after
00:10:56.345
the other, followed by a short header
00:10:59.543
packet.
00:11:02.000
QUIC switches to sending short header packets
00:11:04.613
once the connection has been established.
00:11:06.853
QUIC short header packets omit the version
00:11:09.567
number and source connection identifier to save
00:11:12.180
space, since these can be inferred to
00:11:14.793
be the same as those sent during
00:11:17.407
the connection establishment handshake.
00:11:19.000
There is currently only one type of
00:11:21.649
short header packet, known as 1-RTT packets.
00:11:24.297
These are used for all packets sent
00:11:26.946
after the QUIC handshake has completed,
00:11:29.216
and contain a sequence of encrypted and
00:11:31.865
authenticated QUIC frames.
00:11:35.000
Both long and short header packets contain
00:11:38.413
QUIC frames.
00:11:39.388
Frames provide the core functionality of QUIC.
00:11:43.000
There are many different types of frame.
00:11:46.000
CRYPTO frames are used to carry TLS
00:11:49.344
messages such as the ClientHello, ServerHello,
00:11:52.211
and Finished messages used during the connection
00:11:55.556
establishment handshake to negotiate the encryption keys.
00:11:59.000
STREAM and ACK frames send data and
00:12:03.288
acknowledgements.
00:12:04.000
Migration between network interfaces is supported by
00:12:07.755
PATH_CHALLENGE and PATH_RESPONSE frames.
00:12:10.000
And the other types of frame control
00:12:12.858
progress of a QUIC connection.
00:12:15.000
In many cases, QUIC frames play the
00:12:18.251
role taken in TCP by header fields.
00:12:21.502
For example, a TCP header contains an
00:12:24.753
acknowledgement field that indicates the next packet
00:12:28.004
expected. The QUIC header does not.
00:12:30.791
Rather, QUIC packets include an ACK frame
00:12:34.042
that carries that information.
00:12:36.000
This makes QUIC more flexible and more
00:12:38.528
extensible. Rather than have a fixed header,
00:12:41.056
that becomes difficult to change, QUIC can
00:12:43.583
just add new frame types if it
00:12:46.111
wants to send different types of control
00:12:48.639
information.
00:12:52.000
That concludes our discussion of the history
00:12:54.422
of QUIC, and its basic features.
00:12:56.497
In the next part, I’ll talk in
00:12:59.019
more detail about how connection establishment works
00:13:01.441
in QUIC, and how QUIC reliably transfers
00:13:03.862
streams of data.
Part 3: QUIC Transport Protocol (2/3)
The third part of the lecture discusses QUIC connection establishment
and data transfer in more detail. It explains the QUIC connection
establishment handshake, and shows how it overlaps the TLS security
parameter negotiation and connection establishment operations into one
handshake, to speed up connection establishment compared to TLS over
TCP. And it outlines the process by which QUIC connections transfer
data over streams, showing how the multi-streaming nature of QUIC
improves on TCP.
00:00:00.000
In this part, I want to follow
00:00:03.212
on from the introduction to QUIC,
00:00:05.108
and talk in detail about how QUIC
00:00:07.320
establishes connections and transfers data.
00:00:10.000
Like TCP, a QUIC connection proceeds in
00:00:13.250
two phases. It starts with a handshake,
00:00:16.400
and then moves on to a data
00:00:19.550
transfer phase.
00:00:20.450
The QUIC handshake uses long header packets.
00:00:23.700
It establishes the connection, negotiates encryption keys,
00:00:26.850
and authenticates the server
00:00:28.650
The data transfer phase uses short header
00:00:31.900
packets. It’s where the data is sent
00:00:35.050
and received, and where acknowledgements are generated,
00:00:38.200
after the connection has been established.
00:00:42.000
QUIC improves on the performance of TCP
00:00:44.978
and TLS by combining the connection establishment
00:00:47.956
handshake and the TLS handshake into one
00:00:50.933
round-trip.
00:00:52.109
A QUIC connection starts with the client
00:00:55.187
sending a UDP datagram containing a QUIC
00:00:58.164
Initial packet to the server. This Initial
00:01:01.142
packet plays the equivalent role to a
00:01:04.120
TCP SYN packet and indicates that the
00:01:07.098
client wishes to establish a connection.
00:01:09.000
The Initial packet also contains a QUIC
00:01:12.400
CRYPTO frame. Inside that CRYPTO frame is
00:01:15.800
a TLS ClientHello message, the same as
00:01:19.200
if TLS was being used over TCP.
00:01:22.600
That ClientHello message starts the negotiation of
00:01:26.000
the encryption keys and other security parameters.
00:01:29.500
The QUIC Initial packet therefore simultaneously starts
00:01:33.187
both the connection establishment and the TLS
00:01:36.873
handshake.
00:01:37.500
In response to this, the server sends
00:01:40.252
a QUIC Initial packet and a QUIC
00:01:43.003
Handshake packet back to the client.
00:01:45.362
These are both included in a single
00:01:48.114
UDP datagram.
00:01:49.000
The Initial packet sent from the server
00:01:51.737
back to the client plays the role
00:01:54.475
of the TCP SYN-ACK packet, and indicates
00:01:57.212
to the client that the server is
00:01:59.950
willing to establish the connection. The Initial
00:02:02.687
packet also includes a CRYPTO frame containing
00:02:05.425
a TLS ServerHello message, that provides the
00:02:08.162
information needed to finish negotiating encryption keys.
00:02:11.000
Along with the Initial packet is a
00:02:14.100
QUIC Handshake packet. This contains the information
00:02:17.200
needed for TLS to authenticate the server,
00:02:20.300
and to negotiate any QUIC extensions used.
00:02:23.500
Once this initial packet and the handshake
00:02:26.109
packet arrives at the client, the connection
00:02:28.718
is ready to go. Both the client
00:02:31.327
and server have agreed to communicate,
00:02:33.564
and they both have the information needed
00:02:36.173
to encrypt and authenticate the data sent
00:02:38.782
over the connection.
00:02:40.000
The client concludes the handshake, and starts
00:02:42.925
the data transfer, by sending a third
00:02:45.851
packet. This is a UDP datagram that
00:02:48.776
contains a QUIC Initial Packet, a QUIC
00:02:51.701
Handshake Packet, and a 1-RTT short header
00:02:54.626
packet. This second QUIC Initial packet contains
00:02:57.552
an ACK frame, acknowledging the Initial packet
00:03:00.477
sent by the server.
00:03:02.148
The QUIC Handshake packet contains a CRYPTO
00:03:05.174
frame, that in turn contains the TLS
00:03:08.099
Finished message needed to complete the security
00:03:11.024
handshake.
00:03:12.192
And the QUIC 1-RTT packet contains a
00:03:15.217
STREAM frame, with the initial data sent
00:03:18.143
from the client to the server.
00:03:21.000
The format of a QUIC Initial packet
00:03:24.220
is shown on the slide. It’s a
00:03:27.440
long header packet, used during the QUIC
00:03:30.660
connection establishment handshake.
00:03:32.040
QUIC Initial packets play two roles.
00:03:35.000
Firstly, they’re used to synchronise the client
00:03:37.998
and server state. In this respect,
00:03:40.568
the play the same role as TCP’s
00:03:43.566
SYN and SYN-ACK packets.
00:03:45.279
They also carry a CRYPTO frame,
00:03:47.949
containing either a TLS ClientHello or a
00:03:50.947
TLS Finished message, as part of the
00:03:53.945
encryption setup.
00:03:54.802
And they can also contain ACK frames.
00:03:58.000
The Initial packets combine connection setup and
00:04:02.025
security negotiation into one packet.
00:04:05.000
QUIC Initial packets can also carry an
00:04:07.979
optional Token.
00:04:08.831
A QUIC server can refuse a connection
00:04:11.910
attempt, and send a Retry packet to
00:04:14.890
the client containing a Token. If this
00:04:17.869
happens, the client must retry the connection,
00:04:20.849
providing the Token in its Initial packet.
00:04:23.828
If the Token matches, the connection establishment
00:04:26.808
then proceeds as normal.
00:04:28.510
This is used to prevent connection spoofing.
00:04:31.590
And to validate that a connection that’s
00:04:34.569
being re-established after an IP address change
00:04:37.549
is valid.
00:04:39.500
QUIC Handshake packets complete the TLS 1.3
00:04:42.685
exchange. They contain either a TLS ServerHello
00:04:45.869
message or a TLS Finished message,
00:04:48.599
contained within a CRYPTO frame.
00:04:50.873
The combination of the TLS ClientHello,
00:04:53.703
sent in the Initial packet, and the
00:04:56.887
TLS ServerHello and Finished messages, sent in
00:05:00.072
the Handshake packets, completes the TLS security
00:05:03.256
handshake. It works just the same as
00:05:06.441
TLS over TCP, except that the messages
00:05:09.625
are sent inside QUIC packets.
00:05:12.000
Handshake packets use a long header,
00:05:14.128
and have the format shown on the
00:05:16.611
left of the slide.
00:05:18.030
In most cases, a Handshake packet is
00:05:20.613
sent in the same UDP datagram as
00:05:23.095
an Initial packet, to reduce overheads.
00:05:25.223
If the combined packet is too big
00:05:27.806
to fit in a single UDP datagram,
00:05:30.289
though, the Initial and Handshake packets may
00:05:32.772
be sent in two separate datagrams.
00:05:36.000
The normal QUIC connection establishment takes one
00:05:38.913
round trip, after which both client and
00:05:41.826
server have agreed to communicate and have
00:05:44.739
the information they need to derive the
00:05:47.652
symmetric encryption key.
00:05:49.000
If this is too slow, QUIC also
00:05:52.230
supports TLS 0-RTT session re-establishment.
00:05:54.536
This works in a similar way to
00:05:57.866
TLS over TCP. The QUIC client and
00:06:01.095
server establish a connection as normal,
00:06:03.864
and the server sends a PreSharedKey and
00:06:07.093
a SessionTicket to the client.
00:06:09.500
When the client next establishes a QUIC
00:06:12.300
connection to that server, it adds the
00:06:15.100
SessionTicket to the CRYPTO frame it sends
00:06:17.900
in its initial packet, along with the
00:06:20.700
TLS ClientHello message.
00:06:22.000
And it also includes a QUIC 0-RTT
00:06:25.279
packet, containing a STREAM frame that carries
00:06:28.558
data encrypted using the PreSharedKey.
00:06:31.000
The QUIC server can use the SessionTicket
00:06:34.052
to look up its copy of the
00:06:37.104
PreSharedKey, and uses that to decrypt the
00:06:40.156
stream data sent in the 0-RTT packet.
00:06:43.208
The server then responds with QUIC Initial
00:06:46.360
and Handshake packets, as normal, along with
00:06:49.412
a 1-RTT short header packet containing a
00:06:52.464
reply.
00:06:53.000
As with TLS over TCP, the data
00:06:56.041
sent in the 0-RTT packet is not
00:06:59.081
forward secret, and needs to be idempotent
00:07:02.122
since it’s potentially subject to replay attacks.
00:07:05.162
The difference is that 0-RTT session re-establishment
00:07:08.303
in QUIC really does send the data
00:07:11.344
in the very first packet, after zero
00:07:14.384
RTTs, whereas TLS over TCP sends it
00:07:17.425
in the first packet after the TCP
00:07:20.466
handshake.
00:07:22.000
The result of all this is that
00:07:25.394
QUIC establishes a secure connection, in the
00:07:28.789
usual case, in one round trip,
00:07:31.698
whereas TLS over TCP needs two round
00:07:35.092
trips.
00:07:36.327
QUIC combines connection establishment and encryption key
00:07:39.822
negotiation into a single handshake. TLS-over-TCP runs
00:07:43.216
the two handshakes sequentially.
00:07:45.156
QUIC therefore speeds up the connection establishment.
00:07:49.000
Once the handshake has finished, QUIC switches
00:07:51.898
to sending short header packets. These short
00:07:54.795
header packets are used to transfer,
00:07:57.279
and acknowledge, data.
00:07:58.521
Each short header contains a Packet Number
00:08:01.519
field. This plays a similar role to
00:08:04.416
the sequence number in TCP segments.
00:08:07.000
Unlike TCP, though, QUIC Packet Numbers increase
00:08:10.009
by one for each packet sent.
00:08:12.588
Packet numbers in QUIC count the number
00:08:15.597
of packets sent. In contrast, the TCP
00:08:18.606
sequence number counts the number of bytes
00:08:21.615
of data sent.
00:08:22.904
The QUIC header does not include any
00:08:26.013
equivalent of the TCP acknowledgement number.
00:08:28.593
Instead, ACK frames are sent as part
00:08:31.601
of the protected payload data, to indicate
00:08:34.610
received packet numbers.
00:08:36.000
Also in contrast to TCP, QUIC never
00:08:39.077
retransmits packets. If the UDP datagram containing
00:08:42.153
a QUIC packet is lost, QUIC will
00:08:45.230
retransmit the frames of data that were
00:08:48.307
in that packet in new QUIC packets,
00:08:51.384
and those packets will have new sequence
00:08:54.460
numbers.
00:08:55.000
TCP, on the other hand, retransmits lost
00:08:58.010
packets with their original sequence number.
00:09:00.590
This means TCP cannot tell the difference
00:09:03.700
between the arrival of a retransmitted packet,
00:09:06.710
and a very delayed arrival of the
00:09:09.720
original packet. QUIC can always tell these
00:09:12.730
apart, since they have different packet numbers.
00:09:15.740
This simplifies the design of QUIC’s congestion
00:09:18.750
control algorithm, compared to TCP.
00:09:21.000
We’ll talk more about congestion control in
00:09:24.549
Lecture 6.
00:09:25.563
Finally, a QUIC short header packet ends
00:09:29.212
with a protected payload section. This contains
00:09:32.760
encrypted and authenticated QUIC frames. These can
00:09:36.309
be STREAM frames containing data, ACK frames
00:09:39.858
containing acknowledgements, or other control data.
00:09:44.000
QUIC sends acknowledgements for received packets in
00:09:47.072
ACK frames. The slide shows the format
00:09:50.144
of an ACK frame.
00:09:52.000
ACK frames are sent inside long- and
00:09:55.085
short-header packets. Unlike TCP, the acknowledgements are
00:09:58.170
not part of the QUIC packet headers.
00:10:01.256
Also unlike TCP, acknowledgements indicate the sequence
00:10:04.441
numbers of QUIC packets that were received.
00:10:07.526
TCP sequence numbers and acknowledgements count the
00:10:10.611
number of bytes sent, whereas QUIC counts
00:10:13.696
the number of packets sent.
00:10:17.000
Finally, data is sent within STREAM frames,
00:10:19.854
that are sent within QUIC packets,
00:10:22.300
that are contained within UDP datagrams.
00:10:24.746
The format of a STREAM frame is
00:10:27.700
shown on the right.
00:10:29.331
It contains a stream identifier, the offset
00:10:32.285
of the data within the stream,
00:10:34.731
the length of the data, and the
00:10:37.585
data itself.
00:10:38.500
QUIC provides multiple reliable byte streams within
00:10:41.860
a single connection.
00:10:43.300
Data for each stream is delivered reliably
00:10:46.760
and, in the order it was sent,
00:10:50.120
within that stream, but data order is
00:10:53.480
not preserved between streams.
00:10:55.500
For example, assume that a client has
00:10:58.170
a connection to a server and is
00:11:00.840
sending data on two streams, stream A
00:11:03.510
and stream B, within that connection.
00:11:05.798
The client first sends a message on
00:11:08.468
stream A, and then it sends another
00:11:11.138
message on stream B.
00:11:12.664
All the data sent on stream A
00:11:15.434
will arrive reliably and in the order
00:11:18.104
it was sent. The same is true
00:11:20.773
of stream B. But the message sent
00:11:23.443
on stream A, which was sent first,
00:11:26.113
might arrive after the message sent on
00:11:28.783
stream B.
00:11:29.546
That is, QUIC avoids head-of-line blocking between
00:11:32.316
streams, but not within a stream.
00:11:34.604
We’ll talk more about head of line
00:11:37.274
blocking in Lecture 5.
00:11:39.000
There are two ways to view QUIC
00:11:42.850
streams.
00:11:43.500
You can view QUIC streams as allowing
00:11:46.480
you to send multiple unframed byte streams
00:11:49.460
sent within a single connection. In this
00:11:52.440
view, a QUIC connection offers the same
00:11:55.420
service model as several parallel TCP connections.
00:11:58.500
Alternatively, you can view each QUIC stream
00:12:01.855
as framing a message. In this view,
00:12:05.210
a QUIC connection delivers a series of
00:12:08.566
framed messages, each sent on a separate
00:12:11.921
stream.
00:12:12.500
They’re both entirely reasonable ways of looking
00:12:14.967
at a QUIC connection, but they lead
00:12:17.433
people to use QUIC in different ways.
00:12:20.000
QUIC is quite flexible, and is different
00:12:23.475
to TCP. It’s also new. We’re still
00:12:26.950
developing best practices for how to use
00:12:30.425
it, how to view the multiple connections.
00:12:35.000
This concludes our discussion of QUIC connection
00:12:39.144
establishment and data transfer.
00:12:41.512
In the next part, I’ll talk about
00:12:45.756
how QUIC tries to avoid protocol ossification.
Part 4: QUIC Transport Protocol (3/3)
The final part of this lecture explains why QUIC is designed to run
over UDP, rather than running natively on IP. It discusses the protocol
ossification and deployment concerns that drove this choice, and the
tools that QUIC employs to help prevent further ossification: protocol
invariants, pervasive encryption of transport headers, and GREASE.
It concludes by reviewing the benefits and costs of switching to QUIC.
00:00:00.000
In the final part of the lecture,
00:00:03.314
I’d like to discuss some features of
00:00:05.628
QUIC that are intended to avoid ossification.
00:00:07.942
And I’d like to touch a little
00:00:10.256
on the costs and benefits of using
00:00:12.569
QUIC.
00:00:14.000
One of the unusual features of QUIC
00:00:16.631
is that it’s a transport protocol that
00:00:19.262
runs over another transport protocol. QUIC runs
00:00:21.893
over UDP, rather than running directly on
00:00:24.524
IP.
00:00:25.000
Why is this?
00:00:26.532
Well, there are two reasons.
00:00:29.184
The first is to make end-system deployment
00:00:32.858
in user-space applications easier.
00:00:35.000
It’s difficult to implement protocols that run
00:00:38.407
directly over IP.
00:00:39.867
The native API that the existing transport
00:00:43.373
protocols, TCP and UDP, use to talk
00:00:46.780
to the IP implementation is hidden inside
00:00:50.187
the operating system kernel. It’s an internal
00:00:53.593
interface, that’s generally undocumented, proprietary, and inaccessible.
00:00:57.000
Anything built at this level needs to
00:00:59.212
run within the operating system kernel,
00:01:01.108
and will be very tightly tied to
00:01:03.320
the details of that kernel.
00:01:05.000
There’s also a reasonably portable interface,
00:01:07.509
known as raw sockets, that lets you
00:01:10.436
send packets directly over IP. The raw
00:01:13.364
sockets interface is not the easiest API
00:01:16.291
to use, tends to be relatively low
00:01:19.218
performance, and offers limited control, but it
00:01:22.145
could be workable.
00:01:23.500
Except that both raw sockets, and the
00:01:26.429
native kernel interfaces, both require programs that
00:01:29.358
access them to run with administrator privileges.
00:01:32.287
This is a security risk, and prevents
00:01:35.216
those programs from being uploaded to the
00:01:38.145
relevant app stores.
00:01:39.500
This makes such programs, even if they
00:01:42.669
could be implemented, difficult to deploy.
00:01:45.386
On the other hand, writing user space
00:01:48.656
applications that run over UDP, using the
00:01:51.825
portable Berkeley Sockets API, or Windows Sockets,
00:01:54.994
is straightforward.
00:01:56.000
The same API works everywhere. The programming
00:01:59.367
model is widely understood. And there’s no
00:02:02.733
need for privileged access, so the programs
00:02:06.100
are easy to distribute and install.
00:02:08.986
It’s much easier, and more portable,
00:02:11.971
to run QUIC over UDP than natively
00:02:15.338
over IP.
00:02:16.500
The second reason for running QUIC over
00:02:19.235
UDP is protocol ossification.
00:02:20.797
Almost every home and business that connects
00:02:23.632
to the Internet does so via a
00:02:26.367
NAT or firewall. NAT devices know how
00:02:29.101
to find and translate the port numbers
00:02:31.836
in TCP and UDP headers. Firewalls know
00:02:34.571
how to inspect the headers and contents
00:02:37.305
of TCP connections and UDP packets.
00:02:39.649
And the same is true of all
00:02:42.384
the other proxies, gateways, and middleboxes in
00:02:45.119
the network.
00:02:46.000
None of these understand QUIC.
00:02:48.306
If we run QUIC inside UDP packets,
00:02:51.633
there’s a chance it will work.
00:02:54.500
NATs can translate UDP packet headers without
00:02:57.705
inspecting the contents of those packets,
00:03:00.453
and many firewalls allow outgoing UDP traffic
00:03:03.658
to pass an establish an incoming firewall
00:03:06.863
pinhole, because this is needed for applications
00:03:10.068
like Zoom to work.
00:03:12.000
This wouldn’t be the case if QUIC
00:03:14.461
ran directly over IP. NATs wouldn’t know
00:03:16.923
how to translate the QUIC packets.
00:03:19.032
And firewalls tend to block anything that
00:03:21.494
isn’t TCP or UDP.
00:03:23.000
If we run QUIC over UDP,
00:03:25.385
it will probably work across the Internet
00:03:28.167
today. But if we run it directly
00:03:30.950
over IP, then we’d have to update
00:03:33.732
every firewall and NAT before it would
00:03:36.515
work – an essentially impossible task.
00:03:40.000
This is another example of protocol ossification.
00:03:43.116
Information that’s visible in the packet headers
00:03:46.332
or payload, that’s not encrypted and authenticated,
00:03:49.448
can be inspected and modified by devices
00:03:52.565
in the network.
00:03:54.000
This means that NATs and firewalls can
00:03:56.819
inspect the contents of IP packets.
00:03:59.235
They can tell whether those packets contain
00:04:02.054
TCP, UDP, or something else. This is
00:04:04.873
possible because the IP header and payload
00:04:07.692
are not encrypted.
00:04:09.000
Similarly, because the contents of those IP
00:04:12.300
packets are not authenticated, these NATs,
00:04:15.129
firewalls, and other devices can modify the
00:04:18.429
packets.
00:04:19.000
This means we can buy NAT boxes
00:04:21.390
that modify the packets. That change the
00:04:23.779
IP, TCP, and UDP packet headers to
00:04:26.169
allow several devices to share an IP
00:04:28.559
address.
00:04:29.000
It means we can buy firewalls that
00:04:31.387
inspect network packets and claim to protect
00:04:33.774
us from malware.
00:04:34.797
And it means we can buy all
00:04:37.285
the other proxies, caches, and other devices
00:04:39.672
that inspect and modify traffic in the
00:04:42.059
network.
00:04:42.500
But maybe we don’t want the network
00:04:45.383
to read or modify our data.
00:04:47.855
So we use TLS to protect the
00:04:50.838
data we send within TCP connections.
00:04:53.310
Or datagram TLS, that does the same
00:04:56.193
for data sent within UDP packets.
00:04:58.664
And that works.
00:05:00.000
But what it doesn’t do, though,
00:05:02.495
is stop those devices inspecting and modifying
00:05:05.405
the TCP and UDP packet headers.
00:05:08.000
And it doesn’t stop them looking at
00:05:10.373
the IP packets, and deciding to block
00:05:12.746
them because the contents are not TCP
00:05:15.120
or UDP. Or because the TCP or
00:05:17.493
UDP header doesn’t exactly match their understanding
00:05:19.866
of how it should be formatted.
00:05:22.000
This means protocols like QUIC have to
00:05:24.581
hide inside UDP packets, to have a
00:05:27.163
chance of going through the network.
00:05:29.375
And it makes it harder to change
00:05:32.056
how TCP or UDP work.
00:05:34.000
We couldn’t change the format of the
00:05:37.048
TCP header now, for example, because too
00:05:40.096
many devices expect the existing format.
00:05:42.708
Similarly, it’s difficult to add even new
00:05:45.756
options to TCP packets, because too many
00:05:48.804
devices think they understand what options exist,
00:05:51.852
and fail when they see something unexpected.
00:05:55.000
The paper shown on the slide is
00:05:57.513
a study that tries to measure how
00:06:00.026
often firewalls and NATs block TCP packets
00:06:02.538
that include standardised but rarely used extensions.
00:06:05.051
And how often they block TCP packets
00:06:07.564
that use non-standard extensions, as you might
00:06:10.077
use when experimenting with changes to TCP.
00:06:12.590
It showed that TCP extensions were hard
00:06:15.103
to deploy. And while the results are
00:06:17.615
almost ten years old now, I doubt
00:06:20.128
it’s gotten easier to deploy changes to
00:06:22.641
TCP.
00:06:25.000
Protocol ossification is becoming an increasing problem.
00:06:28.060
We’ve seen that it caused problems when
00:06:31.221
TLS 1.3 was being deployed. It causes
00:06:34.281
problems when trying to extend TCP.
00:06:36.905
And it was one of the reasons
00:06:39.965
why QUIC is designed to hide within
00:06:43.026
UDP packets.
00:06:44.000
Ossification is Increasingly viewed as a problem
00:06:46.463
by the standards community. It makes it
00:06:48.926
difficult to evolve network protocols to address
00:06:51.389
new requirements, and leads to the concern
00:06:53.852
that the network will get stuck.
00:06:55.963
That it’ll have known problems and limitations,
00:06:58.426
what we know how to solve,
00:07:00.537
but where we can’t deploy the fix.
00:07:06.000
The designers of QUIC went to great
00:07:08.542
lengths to make QUIC deployable, and to
00:07:11.084
prevent it from becoming ossified.
00:07:13.000
Running over UDP was the first of
00:07:15.878
these.
00:07:17.039
And there are three more techniques they
00:07:20.017
used: they published the protocol invariants;
00:07:22.483
they make use of pervasive encryption of
00:07:25.361
transport headers; and they make use of
00:07:28.239
GREASE.
00:07:28.000
The goal is to make it difficult,
00:07:30.848
and ideally impossible, for middleboxes to interfere
00:07:33.695
with QUIC connections. That is, a network
00:07:36.543
can allow QUIC traffic, or it can
00:07:39.391
block it entirely.
00:07:40.611
But it can’t inspect or modify QUIC
00:07:43.559
flows, apart from the invariant features.
00:07:50.000
The QUIC invariants are the properties of
00:07:52.262
QUIC that the IETF has indicated will
00:07:54.523
never change.
00:07:55.169
The developers of QUIC, and the IETF
00:07:57.531
standards community, have written down a set
00:07:59.792
of properties of QUIC packets that they
00:08:02.054
guarantee will be true for every QUIC
00:08:04.315
packet, for all time, and for all
00:08:06.577
versions.
00:08:07.000
These are the properties that middleboxes,
00:08:09.957
NATs, and firewalls are allowed to inspect.
00:08:13.407
Anything else, the IETF has said,
00:08:16.464
is subject to change in future versions
00:08:19.914
of QUIC.
00:08:21.000
What are those invariants?
00:08:22.469
That QUIC packets will either start with
00:08:25.139
a long header or a short header.
00:08:27.709
There will be no other header formats.
00:08:30.279
That the first bit of the first
00:08:32.949
byte of a long header packet is
00:08:35.519
set to one. That bytes 2-5 of
00:08:38.089
a long header packet contain a version
00:08:40.659
number. And the following that version number
00:08:43.229
are the destination connection identifier then the
00:08:45.799
source connection identifier.
00:08:47.000
And for short header packets, that the
00:08:49.225
first bit of the first byte is
00:08:51.450
always zero. And that the first byte
00:08:53.675
is followed by the destination connection identifier.
00:08:56.000
And that’s it.
00:08:59.000
A QUIC version 1 connection starts with
00:09:01.630
a connection establishment handshake, sent in long
00:09:04.259
header packets, then the connection switches to
00:09:06.889
use short header packets, but there is
00:09:09.519
no guarantee that future versions will do
00:09:12.149
the same.
00:09:13.000
QUIC version 1 defines the format of
00:09:15.475
the other 7 bits of the first
00:09:17.950
byte, but there’s no guarantee that future
00:09:20.425
versions of QUIC won’t change that meaning.
00:09:23.000
And QUIC makes no guarantees about the
00:09:25.753
contents of the packets following the connection
00:09:28.507
identifiers.
00:09:30.000
Now, of course, writing a standard that
00:09:32.912
says “middleboxes MUST NOT look at these
00:09:35.824
fields in QUIC packets” doesn’t stop middleboxes
00:09:38.736
looking at those fields.
00:09:40.500
Accordingly, QUIC applies two other techniques to
00:09:44.200
make sure middleboxes can’t inspect its packets.
00:09:48.000
The first is that QUIC encrypts as
00:09:50.638
much of its packets as possible.
00:09:53.000
Everything except the invariant fields, and the
00:09:55.630
last 7 bits of the first byte
00:09:58.259
of the packet, is encrypted. This makes
00:10:00.889
it impossible for middleboxes to inspect any
00:10:03.519
part of a QUIC header after the
00:10:06.149
connection identifiers.
00:10:07.000
Since QUIC incorporates TLS, this is straightforward
00:10:09.950
to do for most packets.
00:10:12.057
An encryption key is agreed using connection
00:10:15.107
establishment, and this is used to encrypt
00:10:18.057
the packets.
00:10:19.000
What about the connection establishment packets themselves?
00:10:22.080
How are they encrypted?
00:10:23.840
Well, these contain the public keys,
00:10:26.580
which are supposed to be public,
00:10:29.220
so they don’t actually need to be
00:10:32.300
encrypted. TLS over TCP doesn’t encrypt these
00:10:35.380
packets, for example. But QUIC encrypts them
00:10:38.460
anyway.
00:10:39.000
So, what encryption key does it use?
00:10:41.355
Well, it can’t use a TLS key,
00:10:43.809
since these packets are sent before the
00:10:46.164
TLS handshake is completed. And it can’t
00:10:48.518
use a PreSharedKey, because this might be
00:10:50.873
the first time the client and server
00:10:53.227
have communicated.
00:10:54.000
What it does, is to take the
00:10:56.384
connection identifiers from the long header in
00:10:58.769
the connection establishment packets, and use them
00:11:01.153
as the encryption key to encrypt the
00:11:03.537
rest of the packet.
00:11:05.000
On the face of it, this offers
00:11:08.033
no benefit.
00:11:09.000
It certainly doesn’t provide any security.
00:11:11.583
The encryption key for the connection establishment
00:11:14.596
packet is included, unprotected, at the start
00:11:17.609
of the packet.
00:11:19.000
That is doesn’t provide security doesn’t matter,
00:11:21.800
though, since there’s nothing secret in the
00:11:24.600
connection establishment packets.
00:11:25.800
What is does do, is make the
00:11:28.700
middlebox implementors think.
00:11:30.000
You can build a TCP middlebox by
00:11:32.598
running a tool like wireshark or tcpdump,
00:11:35.197
and looking at the packets as they
00:11:37.795
go by. Everything is visible, and the
00:11:40.393
patterns of how the headers changes,
00:11:42.620
in the common cases, are obvious.
00:11:44.847
You can get away without reading the
00:11:47.446
TCP specification at all, and still build
00:11:50.044
a middlebox that sort-of works.
00:11:52.000
Of course it doesn’t really work,
00:11:54.016
and causes problems when people try to
00:11:56.368
do uncommon things with TCP. But it
00:11:58.720
works for the simple cases.
00:12:00.500
You can’t do that with QUIC.
00:12:02.814
Everything appears to be encrypted.
00:12:04.843
You have the read and understand the
00:12:07.643
QUIC specification to realise that the handshake
00:12:10.343
packets are encrypted in a way that
00:12:13.043
lets you easily decrypt them. Otherwise,
00:12:15.357
you get nothing useful.
00:12:18.000
QUIC also makes extensive use of GREASE.
00:12:20.753
It makes sure that every field in
00:12:23.607
a QUIC packet is either encrypted,
00:12:25.967
or has a value that is,
00:12:28.327
at least sometimes, unpredictable.
00:12:30.000
The connection identifiers are randomly chosen at
00:12:32.633
the start of a connection.
00:12:34.514
QUIC clients will randomly try to negotiate
00:12:37.248
a random version number, that the server
00:12:39.881
will reject, to make sure devices in
00:12:42.514
the network don’t get stuck only supporting
00:12:45.148
version one.
00:12:46.000
And any unused fields in the headers
00:12:48.858
are set to random values.
00:12:51.000
This goal is that middleboxes can’t make
00:12:53.718
any assumptions about QUIC header values,
00:12:56.047
because nothing in the header is predictable.
00:12:58.765
The hope is that this avoids ossification.
00:13:01.582
There are no patterns to the header
00:13:04.300
values, so middleboxes can’t make wrong assumptions
00:13:07.018
about how the headers behave that will
00:13:09.735
cause problems later.
00:13:11.000
Will it work? Will it prevent ossification?
00:13:14.582
We don’t know.
00:13:16.218
Ask me again in a few years.
00:13:21.000
That concludes this introduction to the QUIC
00:13:23.975
transport protocol.
00:13:24.825
Why might you want to use QUIC?
00:13:28.000
Because it can speed-up secure connection establishment;
00:13:31.139
because it solves some of the limitations
00:13:34.277
of TLS 1.3 running over TCP;
00:13:36.968
and because it supports sending multiple streams
00:13:40.106
within a single connection.
00:13:42.000
And because it, hopefully, reduces risk of
00:13:45.665
ossification, and provides a long-term basis for
00:13:49.329
future protocol development.
00:13:51.000
That said, QUIC is new. The standard
00:13:53.709
hasn’t yet been published, and we don’t
00:13:56.417
have a lot of experience with using
00:13:59.126
the protocol.
00:14:00.000
And while there are many implementations of
00:14:02.967
QUIC, in many different languages, they’re all
00:14:05.933
still immature, poorly documented, and frequently buggy.
00:14:09.000
And QUIC is often, currently, slower,
00:14:12.171
and uses more CPU, than TLS over
00:14:15.871
TCP.
00:14:16.500
This is not because of inherent limitations
00:14:19.533
of QUIC. Rather, it’s because the TCP
00:14:22.567
implementations have had 40 years more optimisation
00:14:25.600
and debugging time.
00:14:27.000
When the implementations are finished, debugged,
00:14:29.527
and optimised, QUIC ought to perform at
00:14:32.476
least as well as, and probably significantly
00:14:35.424
better than TCP. And it should be
00:14:38.373
more secure and easier to extend.
00:14:41.000
TCP lasted 40 years – QUIC is
00:14:44.665
a similarly long-term project, that’s only just
00:14:48.329
reaching version 1.0.
00:14:51.000
That’s all for this lecture. I’ve spoken
00:14:53.527
about some of the limitations of TLS,
00:14:56.054
and how the QUIC transport protocol tries
00:14:58.580
to address them.
00:14:59.663
In the next lecture, I’ll move on
00:15:02.290
from connection establishment, to talk about reliability
00:15:04.817
and data transfer.
Discussion
Lecture 4 discussed how to improve secure connection establishment.
It started with a discussion of some of the limitations of TLS 1.3,
how 0-RTT connection re-establishment can be used to reduce connection
setup latency, and some of the metadata leakage inherent in TLS. It
then moved on to discuss the QUIC transport protocol, and how QUIC
can be used to improve secure connection establishment.
The focus of the discussion will be to check your understanding of
secure connection establishment and its limitations. What are the
risks and benefits of 0-RTT mode in TLS? What is the nature of the
privacy guarantees TLS provides?
And how does QUIC improve on TLS and TCP, to reduce connection setup
latency and reduce the risk of ossification? How does it improve on
the TCP and TLS service model?